diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-30 20:15:53 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-30 20:15:53 +0000 |
commit | 809d04236179a9bfa7231e3fccddc96027529064 (patch) | |
tree | af096b6f8d89a638b22e4b851790eab95c99a872 /chrome/test/ui/ui_test.cc | |
parent | dcd869cd5cc3d237e76608126094240c09fc3632 (diff) | |
download | chromium_src-809d04236179a9bfa7231e3fccddc96027529064.zip chromium_src-809d04236179a9bfa7231e3fccddc96027529064.tar.gz chromium_src-809d04236179a9bfa7231e3fccddc96027529064.tar.bz2 |
GTTF: Retry launching the browser a few times in UITest.
This should help us with some temporary bad conditions
on the bots. The browser shouldn't fail to start
three times in a row.
TEST=ui_tests
BUG=52746
Review URL: http://codereview.chromium.org/3126034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57897 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui/ui_test.cc')
-rw-r--r-- | chrome/test/ui/ui_test.cc | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 9b4f645..d1bd4c5 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -272,14 +272,43 @@ void UITestBase::LaunchBrowserAndServer() { // Set up IPC testing interface server. server_.reset(CreateAutomationProxy(command_execution_timeout_ms_)); - LaunchBrowser(launch_arguments_, clear_profile_); - server_->WaitForAppLaunch(); - if (wait_for_initial_loads_) - ASSERT_TRUE(server_->WaitForInitialLoads()); - else - PlatformThread::Sleep(sleep_timeout_ms()); - - EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet())); + const int kTries = 3; + for (int i = 0; i < kTries; i++) { + if (i > 0) { + LOG(ERROR) << "Launching browser again, retry #" << i; + } + + LaunchBrowser(launch_arguments_, clear_profile_); + AutomationLaunchResult launch_result = server_->WaitForAppLaunch(); + if (launch_result == AUTOMATION_SUCCESS) { + bool initial_loads_result = false; + if (wait_for_initial_loads_) { + initial_loads_result = server_->WaitForInitialLoads(); + } else { + PlatformThread::Sleep(sleep_timeout_ms()); + initial_loads_result = true; + } + + if (initial_loads_result) { + if (automation()->SetFilteredInet(ShouldFilterInet())) { + return; + } else { + LOG(ERROR) << "SetFilteredInet failed"; + } + } else { + LOG(ERROR) << "WaitForInitialLoadsFailed"; + } + } else { + LOG(ERROR) << "WaitForAppLaunch failed: " << launch_result; + } + + // The browser is likely hosed or already down at this point. Do not wait + // for it, just kill anything that is still running, preparing a clean + // environment for the next retry. + CleanupAppProcesses(); + } + + FAIL() << "Failed to launch browser"; } void UITestBase::CloseBrowserAndServer() { |