| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // make sure there isn't one already there before browser launch. | 535 // make sure there isn't one already there before browser launch. |
| 536 EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); | 536 EXPECT_TRUE(file_util::Delete(testing_channel_path, false)); |
| 537 | 537 |
| 538 // Set up IPC testing interface as a client. | 538 // Set up IPC testing interface as a client. |
| 539 LaunchBrowser(state); | 539 LaunchBrowser(state); |
| 540 } | 540 } |
| 541 | 541 |
| 542 // Wait for browser to be ready for connections. | 542 // Wait for browser to be ready for connections. |
| 543 bool testing_channel_exists = false; | 543 bool testing_channel_exists = false; |
| 544 for (int wait_time = 0; | 544 for (int wait_time = 0; |
| 545 wait_time < TestTimeouts::command_execution_timeout_ms(); | 545 wait_time < TestTimeouts::action_max_timeout_ms(); |
| 546 wait_time += automation::kSleepTime) { | 546 wait_time += automation::kSleepTime) { |
| 547 testing_channel_exists = file_util::PathExists(testing_channel_path); | 547 testing_channel_exists = file_util::PathExists(testing_channel_path); |
| 548 if (testing_channel_exists) | 548 if (testing_channel_exists) |
| 549 break; | 549 break; |
| 550 base::PlatformThread::Sleep(automation::kSleepTime); | 550 base::PlatformThread::Sleep(automation::kSleepTime); |
| 551 } | 551 } |
| 552 EXPECT_TRUE(testing_channel_exists); | 552 EXPECT_TRUE(testing_channel_exists); |
| 553 | 553 |
| 554 ConnectToRunningBrowser(wait_for_initial_loads); | 554 ConnectToRunningBrowser(wait_for_initial_loads); |
| 555 } | 555 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 LaunchBrowserAndServer(state, wait_for_initial_loads); | 587 LaunchBrowserAndServer(state, wait_for_initial_loads); |
| 588 } | 588 } |
| 589 | 589 |
| 590 void AnonymousProxyLauncher::TerminateConnection() { | 590 void AnonymousProxyLauncher::TerminateConnection() { |
| 591 CloseBrowserAndServer(); | 591 CloseBrowserAndServer(); |
| 592 } | 592 } |
| 593 | 593 |
| 594 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 594 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
| 595 return channel_id_; | 595 return channel_id_; |
| 596 } | 596 } |
| OLD | NEW |