| 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/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 // Now, drop the automation IPC channel so that the automation provider in | 296 // Now, drop the automation IPC channel so that the automation provider in |
| 297 // the browser notices and drops its reference to the browser process. | 297 // the browser notices and drops its reference to the browser process. |
| 298 if (automation_proxy_.get()) | 298 if (automation_proxy_.get()) |
| 299 automation_proxy_->Disconnect(); | 299 automation_proxy_->Disconnect(); |
| 300 | 300 |
| 301 // Wait for the browser process to quit. It should quit once all tabs have | 301 // Wait for the browser process to quit. It should quit once all tabs have |
| 302 // been closed. | 302 // been closed. |
| 303 int exit_code = -1; | 303 int exit_code = -1; |
| 304 EXPECT_TRUE(WaitForBrowserProcessToQuit( | 304 EXPECT_TRUE(WaitForBrowserProcessToQuit( |
| 305 TestTimeouts::wait_for_terminate_timeout_ms(), &exit_code)); | 305 TestTimeouts::action_max_timeout_ms(), &exit_code)); |
| 306 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. | 306 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. |
| 307 | 307 |
| 308 browser_quit_time_ = base::TimeTicks::Now() - quit_start; | 308 browser_quit_time_ = base::TimeTicks::Now() - quit_start; |
| 309 } | 309 } |
| 310 | 310 |
| 311 void ProxyLauncher::TerminateBrowser() { | 311 void ProxyLauncher::TerminateBrowser() { |
| 312 // If we have already finished waiting for the browser to exit | 312 // If we have already finished waiting for the browser to exit |
| 313 // (or it hasn't launched at all), there's nothing to do here. | 313 // (or it hasn't launched at all), there's nothing to do here. |
| 314 if (process_ == base::kNullProcessHandle) | 314 if (process_ == base::kNullProcessHandle) |
| 315 return; | 315 return; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 327 // the browser notices and drops its reference to the browser process. | 327 // the browser notices and drops its reference to the browser process. |
| 328 if (automation_proxy_.get()) | 328 if (automation_proxy_.get()) |
| 329 automation_proxy_->Disconnect(); | 329 automation_proxy_->Disconnect(); |
| 330 | 330 |
| 331 #if defined(OS_POSIX) | 331 #if defined(OS_POSIX) |
| 332 EXPECT_EQ(kill(process_, SIGTERM), 0); | 332 EXPECT_EQ(kill(process_, SIGTERM), 0); |
| 333 #endif // OS_POSIX | 333 #endif // OS_POSIX |
| 334 | 334 |
| 335 int exit_code = -1; | 335 int exit_code = -1; |
| 336 EXPECT_TRUE(WaitForBrowserProcessToQuit( | 336 EXPECT_TRUE(WaitForBrowserProcessToQuit( |
| 337 TestTimeouts::wait_for_terminate_timeout_ms(), &exit_code)); | 337 TestTimeouts::action_max_timeout_ms(), &exit_code)); |
| 338 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. | 338 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. |
| 339 | 339 |
| 340 browser_quit_time_ = base::TimeTicks::Now() - quit_start; | 340 browser_quit_time_ = base::TimeTicks::Now() - quit_start; |
| 341 } | 341 } |
| 342 | 342 |
| 343 void ProxyLauncher::AssertAppNotRunning(const std::wstring& error_message) { | 343 void ProxyLauncher::AssertAppNotRunning(const std::wstring& error_message) { |
| 344 std::wstring final_error_message(error_message); | 344 std::wstring final_error_message(error_message); |
| 345 | 345 |
| 346 ChromeProcessList processes = GetRunningChromeProcesses(process_id_); | 346 ChromeProcessList processes = GetRunningChromeProcesses(process_id_); |
| 347 if (!processes.empty()) { | 347 if (!processes.empty()) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); | 613 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void AnonymousProxyLauncher::TerminateConnection() { | 616 void AnonymousProxyLauncher::TerminateConnection() { |
| 617 CloseBrowserAndServer(); | 617 CloseBrowserAndServer(); |
| 618 } | 618 } |
| 619 | 619 |
| 620 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 620 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
| 621 return channel_id_; | 621 return channel_id_; |
| 622 } | 622 } |
| OLD | NEW |