diff options
author | huanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 20:48:10 +0000 |
---|---|---|
committer | huanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 20:48:10 +0000 |
commit | b515843ebdf6ddc8bf454d88a353323a62d0f127 (patch) | |
tree | f412e9813d763ca828ddc000fe534a2175ee4514 /chrome/test/ui/ui_test.cc | |
parent | 0de6bd3689c9a2790ddb013ca5f761798aafdc40 (diff) | |
download | chromium_src-b515843ebdf6ddc8bf454d88a353323a62d0f127.zip chromium_src-b515843ebdf6ddc8bf454d88a353323a62d0f127.tar.gz chromium_src-b515843ebdf6ddc8bf454d88a353323a62d0f127.tar.bz2 |
Retry r15294. The previous two tries caused
a crash spike in ChromeBot.
The crash spike is caused by some observers
don't remove themselves from notification list
after being deleted. The clean up done by pkasting
may fix this so I am give this change another
try.
TEST=None
BUG=None
Original change description:
Close browser window synchronously during UI test
tear down. This is an effor to reduce random
failure due to browser crash with multiple window
open during shutdown.
Review URL: http://codereview.chromium.org/113856
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui/ui_test.cc')
-rw-r--r-- | chrome/test/ui/ui_test.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 5a993db..762f25d 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -410,9 +410,12 @@ void UITest::QuitBrowser() { #if !defined(OS_LINUX) for (BrowserVector::iterator iter = browsers.begin(); iter != browsers.end(); ++iter) { - // Use ApplyAccelerator since it doesn't wait - (*iter)->ApplyAccelerator(IDC_CLOSE_WINDOW); + bool application_closed = false; + CloseBrowserWithTimeout(*iter, &application_closed, + action_timeout_ms(), NULL); delete (*iter); + if (application_closed) + break; } #endif @@ -741,22 +744,31 @@ void UITest::CloseBrowserAsync(BrowserProxy* browser) const { bool UITest::CloseBrowser(BrowserProxy* browser, bool* application_closed) const { + return CloseBrowserWithTimeout(browser, application_closed, + base::kNoTimeout, NULL); +} + +bool UITest::CloseBrowserWithTimeout(BrowserProxy* browser, + bool* application_closed, + int timeout_ms, + bool* is_timeout) const { DCHECK(application_closed); if (!browser->is_valid() || !browser->handle()) return false; bool result = true; - bool succeeded = server_->Send(new AutomationMsg_CloseBrowser( - 0, browser->handle(), &result, application_closed)); + bool succeeded = server_->SendWithTimeout( + new AutomationMsg_CloseBrowser( + 0, browser->handle(), &result, application_closed), + timeout_ms, is_timeout); if (!succeeded) return false; if (*application_closed) { // Let's wait until the process dies (if it is not gone already). - bool success = base::WaitForSingleProcess(process_, base::kNoTimeout); - DCHECK(success); + result = base::WaitForSingleProcess(process_, timeout_ms); } return result; |