We can't rely on HasSelection() returning true immediately after calling SelectAll() because this operation (as almost all the other ones) is asynchronous with WebKit and might not have completed yet when we check for the selection existence. There doesn't seem to be any way to wait for its completion, so just poll the selection state for some time before deciding that it hasn't been updated. In practice, just a couple of ms is enough on a normal machine, but wait up to 50ms on Travis just to be on the safe side. Note that to reliably reproduce the problem locally it's enough to run "taskset 1 ./test_gui -c Selection WebView", i.e. pin both the main and WebKit processes to the same CPU.
12 KiB
12 KiB