Commit 3edba584 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Use Browser.close to quit

Currently, ChromeDriver closes desktop Chrome by simply killing the
top-level Chrome process. This isn't graceful, and causes problems
in some scenarios. This commit sends a Browser.close command to close
the browser gracefully.

Bug: chromedriver:2311
Change-Id: Idec9338b094f0aab89022b8453dd2a98268ad1e7
Reviewed-on: https://chromium-review.googlesource.com/1037585
Commit-Queue: John Chen <johnchen@chromium.org>
Reviewed-by: default avatarJonathon Kereliuk <kereliuk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556689}
parent 409c9eb4
......@@ -207,6 +207,15 @@ bool ChromeDesktopImpl::IsNetworkConnectionEnabled() const {
}
Status ChromeDesktopImpl::QuitImpl() {
Status status = devtools_websocket_client_->ConnectIfNecessary();
if (status.IsOk()) {
status = devtools_websocket_client_->SendCommandAndIgnoreResponse(
"Browser.close", base::DictionaryValue());
if (status.IsOk() && process_.WaitForExitWithTimeout(
base::TimeDelta::FromSeconds(10), nullptr))
return status;
}
// If the Chrome session uses a custom user data directory, try sending a
// SIGTERM signal before SIGKILL, so that Chrome has a chance to write
// everything back out to the user data directory and exit cleanly. If we're
......
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