diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-19 20:36:14 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-19 20:36:14 +0000 |
commit | b24a4a4c2fb6caa39dbd36ac2ec0482aa11269fa (patch) | |
tree | 967a1cc5c34531ac78c0fe1a141736949ba7932f | |
parent | 4e02cfc28dd1c99049a42cf34b1c30d8735f9b60 (diff) | |
download | chromium_src-b24a4a4c2fb6caa39dbd36ac2ec0482aa11269fa.zip chromium_src-b24a4a4c2fb6caa39dbd36ac2ec0482aa11269fa.tar.gz chromium_src-b24a4a4c2fb6caa39dbd36ac2ec0482aa11269fa.tar.bz2 |
Make ui_tests fail faster if all tests fail.
UITest::CreateProxyLauncher() creates a proxy launcher that severes
the IPC connection to the browser process on AutomationProxy::Send().
If a bug makes the browser misbehave on startup, the IPC connection
is dropped immediately, which means that
ProxyLauncher::WaitForBrowserProcessToQuit() will always timeout.
Fix this by assuming that waiting for shutdown will always fail if
the IPC connection was prematurely dropped.
BUG=106517
TEST=Change a test to timeout. The runner now takes 2*action_timeout (90s) instead 3*action_timeout (135s) to realize that.
Review URL: http://codereview.chromium.org/8907004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115017 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 2 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 8 | ||||
-rw-r--r-- | chrome/test/automation/proxy_launcher.cc | 7 |
3 files changed, 16 insertions, 1 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index bfa4ade..fdfc5eb 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -106,6 +106,7 @@ AutomationProxy::AutomationProxy(int action_timeout_ms, shutdown_event_(new base::WaitableEvent(true, false)), perform_version_check_(false), disconnect_on_failure_(disconnect_on_failure), + channel_disconnected_on_failure_(false), action_timeout_( TimeDelta::FromMilliseconds(action_timeout_ms)), listener_thread_id_(0) { @@ -452,6 +453,7 @@ bool AutomationProxy::Send(IPC::Message* message, int timeout_ms) { // state, and further IPC requests are extremely likely to fail (possibly // timeout, which would make tests slower). Disconnect the channel now // to avoid the slowness. + channel_disconnected_on_failure_ = true; LOG(ERROR) << "Disconnecting channel after error!"; Disconnect(); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index db3366c..931d9c5 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -287,6 +287,11 @@ class AutomationProxy : public IPC::Channel::Listener, void SetChannel(IPC::Channel* channel); void ResetChannel(); + // See description above |channel_disconnected_on_failure_|. + bool channel_disconnected_on_failure() const { + return channel_disconnected_on_failure_; + } + protected: template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle); void InitializeThread(); @@ -317,6 +322,9 @@ class AutomationProxy : public IPC::Channel::Listener, // to send an IPC message. This helps avoid long timeouts in tests. bool disconnect_on_failure_; + // Set if disconnect_on_failure_ caused the connection to be dropped. + bool channel_disconnected_on_failure_; + // Delay to let the browser execute the command. base::TimeDelta action_timeout_; diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc index 8cdc42ae..90a85c4 100644 --- a/chrome/test/automation/proxy_launcher.cc +++ b/chrome/test/automation/proxy_launcher.cc @@ -340,7 +340,12 @@ bool ProxyLauncher::WaitForBrowserProcessToQuit(int timeout, int* exit_code) { #ifdef WAIT_FOR_DEBUGGER_ON_OPEN timeout = 500000; #endif - bool success = base::WaitForExitCodeWithTimeout(process_, exit_code, timeout); + bool success = false; + + // Only wait for exit if the "browser, please terminate" message had a + // chance of making it through. + if (!automation_proxy_->channel_disconnected_on_failure()) + success = base::WaitForExitCodeWithTimeout(process_, exit_code, timeout); if (!success) TerminateAllChromeProcesses(process_id_); |