Commit c0f801e2 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Adjust DevTools connect timeout

Change the initial DevTools connect timeout from 1 second to 2 seconds.
While a timeout of 1 second was sufficient for Linux and Mac, it turned
out to be too short for Windows, where a normal successful connection
usually takes very close to 1 second.

Change-Id: I685ac9aa45a7ce250f2af718959661c59dcf8f0d
Reviewed-on: https://chromium-review.googlesource.com/1037806Reviewed-by: default avatarJonathon Kereliuk <kereliuk@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555549}
parent 767a9f35
...@@ -55,11 +55,12 @@ bool SyncWebSocketImpl::Core::Connect(const GURL& url) { ...@@ -55,11 +55,12 @@ bool SyncWebSocketImpl::Core::Connect(const GURL& url) {
bool success = false; bool success = false;
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED); base::WaitableEvent::InitialState::NOT_SIGNALED);
// Connect with retries. The retry timeout starts at 1 second, with // Connect with retries. The retry timeout starts at 2 seconds, with
// exponential backoff, up to 16 seconds. The maximum total wait time is // exponential backoff, up to 16 seconds. The maximum total wait time is
// about 31 seconds. // about 30 seconds. (Normally, a successful connection takes only a few
// milliseconds on Linux and Mac, but around a second on Windows.)
const int kMaxTimeout = 16; const int kMaxTimeout = 16;
for (int timeout = 1; timeout <= kMaxTimeout; timeout *= 2) { for (int timeout = 2; timeout <= kMaxTimeout; timeout *= 2) {
context_getter_->GetNetworkTaskRunner()->PostTask( context_getter_->GetNetworkTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&SyncWebSocketImpl::Core::ConnectOnIO, this, FROM_HERE, base::BindOnce(&SyncWebSocketImpl::Core::ConnectOnIO, this,
url, &success, &event)); url, &success, &event));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment