| Index: chrome/test/ui/ui_test.cc
|
| diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
|
| index 9b4f6459656565d499a8f77e00567ba050b88ef4..d1bd4c567ebe9826bed3df5556184f86eb726cd4 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() {
|
|
|