[wptrunner] Respect timeout for checking WebDriver browser liveliness (#47375)
wptrunner has two layers of timeouts:
a. To deal with runner process hangs, each test starts a timer thread
in the main process that resolves the result as EXTERNAL-TIMEOUT
after test_timeout + 3 * extra_timeout
seconds 0.
b. To deal with browser hangs, the runner process interacts with the
browser in a separate thread. The main thread waits up to
test_timeout + 2 * extra_timeout
for the runner thread to set a
test result 1.
Timeout (a) should normally outlive timeout (b) as long as the
is_alive()
check in 1 is less than the two timeouts' difference of
extra_timeout
(currently set to 5s). For WebDriver-based executors,
is_alive()
may not meet this condition because the 2s command timeout
2 is not actually respected. This PR fixes this by actually plumbing
the timeout to the socket backing the HTTP WebDriver connection.
This should fix https://crbug.com/348054600 and relands the reverted
part of #46869.