| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/automation/proxy_launcher.h" | 5 #include "chrome/test/automation/proxy_launcher.h" |
| 6 | 6 |
| 7 #include "app/sql/connection.h" | 7 #include "app/sql/connection.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 else | 126 else |
| 127 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); | 127 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); |
| 128 | 128 |
| 129 EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet())); | 129 EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet())); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void ProxyLauncher::LaunchBrowserAndServer(const LaunchState& state, | 132 void ProxyLauncher::LaunchBrowserAndServer(const LaunchState& state, |
| 133 bool wait_for_initial_loads) { | 133 bool wait_for_initial_loads) { |
| 134 // Set up IPC testing interface as a server. | 134 // Set up IPC testing interface as a server. |
| 135 automation_proxy_.reset(CreateAutomationProxy( | 135 automation_proxy_.reset(CreateAutomationProxy( |
| 136 TestTimeouts::command_execution_timeout_ms())); | 136 TestTimeouts::action_max_timeout_ms())); |
| 137 | 137 |
| 138 LaunchBrowser(state); | 138 LaunchBrowser(state); |
| 139 WaitForBrowserLaunch(wait_for_initial_loads); | 139 WaitForBrowserLaunch(wait_for_initial_loads); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ProxyLauncher::ConnectToRunningBrowser(bool wait_for_initial_loads) { | 142 void ProxyLauncher::ConnectToRunningBrowser(bool wait_for_initial_loads) { |
| 143 // Set up IPC testing interface as a client. | 143 // Set up IPC testing interface as a client. |
| 144 automation_proxy_.reset(CreateAutomationProxy( | 144 automation_proxy_.reset(CreateAutomationProxy( |
| 145 TestTimeouts::command_execution_timeout_ms())); | 145 TestTimeouts::action_max_timeout_ms())); |
| 146 WaitForBrowserLaunch(wait_for_initial_loads); | 146 WaitForBrowserLaunch(wait_for_initial_loads); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ProxyLauncher::CloseBrowserAndServer() { | 149 void ProxyLauncher::CloseBrowserAndServer() { |
| 150 QuitBrowser(); | 150 QuitBrowser(); |
| 151 CleanupAppProcesses(); | 151 CleanupAppProcesses(); |
| 152 | 152 |
| 153 // Suppress spammy failures that seem to be occurring when running | 153 // Suppress spammy failures that seem to be occurring when running |
| 154 // the UI tests in single-process mode. | 154 // the UI tests in single-process mode. |
| 155 // TODO(jhughes): figure out why this is necessary at all, and fix it | 155 // TODO(jhughes): figure out why this is necessary at all, and fix it |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // make sure there isn't one already there before browser launch. | 523 // make sure there isn't one already there before browser launch. |
| 524 EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); | 524 EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); |
| 525 | 525 |
| 526 // Set up IPC testing interface as a client. | 526 // Set up IPC testing interface as a client. |
| 527 LaunchBrowser(state); | 527 LaunchBrowser(state); |
| 528 } | 528 } |
| 529 | 529 |
| 530 // Wait for browser to be ready for connections. | 530 // Wait for browser to be ready for connections. |
| 531 bool testing_channel_exists = false; | 531 bool testing_channel_exists = false; |
| 532 for (int wait_time = 0; | 532 for (int wait_time = 0; |
| 533 wait_time < TestTimeouts::command_execution_timeout_ms(); | 533 wait_time < TestTimeouts::action_max_timeout_ms(); |
| 534 wait_time += automation::kSleepTime) { | 534 wait_time += automation::kSleepTime) { |
| 535 testing_channel_exists = file_util::PathExists(testing_channel_path); | 535 testing_channel_exists = file_util::PathExists(testing_channel_path); |
| 536 if (testing_channel_exists) | 536 if (testing_channel_exists) |
| 537 break; | 537 break; |
| 538 base::PlatformThread::Sleep(automation::kSleepTime); | 538 base::PlatformThread::Sleep(automation::kSleepTime); |
| 539 } | 539 } |
| 540 EXPECT_TRUE(testing_channel_exists); | 540 EXPECT_TRUE(testing_channel_exists); |
| 541 | 541 |
| 542 ConnectToRunningBrowser(wait_for_initial_loads); | 542 ConnectToRunningBrowser(wait_for_initial_loads); |
| 543 } | 543 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 LaunchBrowserAndServer(state, wait_for_initial_loads); | 575 LaunchBrowserAndServer(state, wait_for_initial_loads); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void AnonymousProxyLauncher::TerminateConnection() { | 578 void AnonymousProxyLauncher::TerminateConnection() { |
| 579 CloseBrowserAndServer(); | 579 CloseBrowserAndServer(); |
| 580 } | 580 } |
| 581 | 581 |
| 582 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 582 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
| 583 return channel_id_; | 583 return channel_id_; |
| 584 } | 584 } |
| OLD | NEW |