Index: chrome/test/automation/proxy_launcher.cc |
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc |
index 2fb04c6c2595dbccb78e2b9cd64474fb6e9f3c89..04915383808b0445e45a615d9f6d0408a145d0dc 100644 |
--- a/chrome/test/automation/proxy_launcher.cc |
+++ b/chrome/test/automation/proxy_launcher.cc |
@@ -499,11 +499,11 @@ base::TimeDelta ProxyLauncher::browser_quit_time() const { |
// NamedProxyLauncher functions |
NamedProxyLauncher::NamedProxyLauncher(const std::string& channel_id, |
- bool launch_browser, |
- bool disconnect_on_failure) |
+ const InitParams& params) |
: channel_id_(channel_id), |
- launch_browser_(launch_browser), |
- disconnect_on_failure_(disconnect_on_failure) { |
+ launch_browser_(params.launch_browser), |
+ disconnect_on_failure_(params.disconnect_on_failure), |
+ wait_for_server_channel_(params.wait_for_server_channel) { |
} |
AutomationProxy* NamedProxyLauncher::CreateAutomationProxy( |
@@ -514,7 +514,7 @@ AutomationProxy* NamedProxyLauncher::CreateAutomationProxy( |
return proxy; |
} |
-void NamedProxyLauncher::InitializeConnection(const LaunchState& state, |
+bool NamedProxyLauncher::InitializeConnection(const LaunchState& state, |
bool wait_for_initial_loads) { |
FilePath testing_channel_path; |
#if defined(OS_WIN) |
@@ -526,25 +526,40 @@ void NamedProxyLauncher::InitializeConnection(const LaunchState& state, |
if (launch_browser_) { |
// Because we are waiting on the existence of the testing file below, |
// make sure there isn't one already there before browser launch. |
- EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); |
+ if (!file_util::Delete(testing_channel_path, false)) { |
+ LOG(ERROR) << "Failed to delete " << testing_channel_path.value(); |
+ return false; |
+ } |
+ |
+ if (!LaunchBrowser(state)) { |
+ LOG(ERROR) << "Failed to LaunchBrowser"; |
+ return false; |
+ } |
+ } |
- // Set up IPC testing interface as a client. |
- ASSERT_TRUE(LaunchBrowser(state)); |
+ if (wait_for_server_channel_) { |
+ // Wait for browser to be ready for connections. |
+ bool testing_channel_exists = false; |
+ for (int wait_time = 0; |
+ wait_time < TestTimeouts::action_max_timeout_ms(); |
+ wait_time += automation::kSleepTime) { |
+ testing_channel_exists = file_util::PathExists(testing_channel_path); |
+ if (testing_channel_exists) |
+ break; |
+ base::PlatformThread::Sleep(automation::kSleepTime); |
+ } |
+ if (!testing_channel_exists) { |
+ LOG(ERROR) << "Failed to wait for testing channel presence."; |
+ return false; |
+ } |
} |
- // Wait for browser to be ready for connections. |
- bool testing_channel_exists = false; |
- for (int wait_time = 0; |
- wait_time < TestTimeouts::action_max_timeout_ms(); |
- wait_time += automation::kSleepTime) { |
- testing_channel_exists = file_util::PathExists(testing_channel_path); |
- if (testing_channel_exists) |
- break; |
- base::PlatformThread::Sleep(automation::kSleepTime); |
+ if (!ConnectToRunningBrowser(wait_for_initial_loads)) { |
+ LOG(ERROR) << "Failed to ConnectToRunningBrowser"; |
+ return false; |
} |
- EXPECT_TRUE(testing_channel_exists); |
- ASSERT_TRUE(ConnectToRunningBrowser(wait_for_initial_loads)); |
+ return true; |
} |
void NamedProxyLauncher::TerminateConnection() { |
@@ -575,9 +590,9 @@ AutomationProxy* AnonymousProxyLauncher::CreateAutomationProxy( |
return proxy; |
} |
-void AnonymousProxyLauncher::InitializeConnection(const LaunchState& state, |
+bool AnonymousProxyLauncher::InitializeConnection(const LaunchState& state, |
bool wait_for_initial_loads) { |
- ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); |
+ return LaunchBrowserAndServer(state, wait_for_initial_loads); |
} |
void AnonymousProxyLauncher::TerminateConnection() { |