| OLD | NEW |
| 1 // Copyright (c) 2010 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| (...skipping 114 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // make sure there isn't one already there before browser launch. | 520 // make sure there isn't one already there before browser launch. |
| 521 EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); | 521 EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); |
| 522 | 522 |
| 523 // Set up IPC testing interface as a client. | 523 // Set up IPC testing interface as a client. |
| 524 LaunchBrowser(state); | 524 LaunchBrowser(state); |
| 525 } | 525 } |
| 526 | 526 |
| 527 // Wait for browser to be ready for connections. | 527 // Wait for browser to be ready for connections. |
| 528 bool testing_channel_exists = false; | 528 bool testing_channel_exists = false; |
| 529 for (int wait_time = 0; | 529 for (int wait_time = 0; |
| 530 wait_time < TestTimeouts::command_execution_timeout_ms(); | 530 wait_time < TestTimeouts::action_max_timeout_ms(); |
| 531 wait_time += automation::kSleepTime) { | 531 wait_time += automation::kSleepTime) { |
| 532 testing_channel_exists = file_util::PathExists(testing_channel_path); | 532 testing_channel_exists = file_util::PathExists(testing_channel_path); |
| 533 if (testing_channel_exists) | 533 if (testing_channel_exists) |
| 534 break; | 534 break; |
| 535 base::PlatformThread::Sleep(automation::kSleepTime); | 535 base::PlatformThread::Sleep(automation::kSleepTime); |
| 536 } | 536 } |
| 537 EXPECT_TRUE(testing_channel_exists); | 537 EXPECT_TRUE(testing_channel_exists); |
| 538 | 538 |
| 539 ConnectToRunningBrowser(wait_for_initial_loads); | 539 ConnectToRunningBrowser(wait_for_initial_loads); |
| 540 } | 540 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 LaunchBrowserAndServer(state, wait_for_initial_loads); | 572 LaunchBrowserAndServer(state, wait_for_initial_loads); |
| 573 } | 573 } |
| 574 | 574 |
| 575 void AnonymousProxyLauncher::TerminateConnection() { | 575 void AnonymousProxyLauncher::TerminateConnection() { |
| 576 CloseBrowserAndServer(); | 576 CloseBrowserAndServer(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 579 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
| 580 return channel_id_; | 580 return channel_id_; |
| 581 } | 581 } |
| OLD | NEW |