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 "base/environment.h" | 7 #include "base/environment.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 #if !defined(OS_MACOSX) | 211 #if !defined(OS_MACOSX) |
212 bool ProxyLauncher::LaunchAnotherBrowserBlockUntilClosed( | 212 bool ProxyLauncher::LaunchAnotherBrowserBlockUntilClosed( |
213 const LaunchState& state) { | 213 const LaunchState& state) { |
214 return LaunchBrowserHelper(state, false, true, NULL); | 214 return LaunchBrowserHelper(state, false, true, NULL); |
215 } | 215 } |
216 #endif | 216 #endif |
217 | 217 |
218 void ProxyLauncher::QuitBrowser() { | 218 void ProxyLauncher::QuitBrowser() { |
219 // If we have already finished waiting for the browser to exit | 219 // If we have already finished waiting for the browser to exit |
220 // (or it hasn't launched at all), there's nothing to do here. | 220 // (or it hasn't launched at all), there's nothing to do here. |
221 if (process_ == base::kNullProcessHandle) | 221 if (process_ == base::kNullProcessHandle || !automation_proxy_.get()) |
222 return; | 222 return; |
223 | 223 |
224 if (SESSION_ENDING == shutdown_type_) { | 224 if (SESSION_ENDING == shutdown_type_) { |
225 TerminateBrowser(); | 225 TerminateBrowser(); |
226 return; | 226 return; |
227 } | 227 } |
228 | 228 |
229 base::TimeTicks quit_start = base::TimeTicks::Now(); | 229 base::TimeTicks quit_start = base::TimeTicks::Now(); |
230 | 230 |
231 EXPECT_TRUE(automation()->SetFilteredInet(false)); | 231 EXPECT_TRUE(automation()->SetFilteredInet(false)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 EXPECT_TRUE(WaitForBrowserProcessToQuit( | 281 EXPECT_TRUE(WaitForBrowserProcessToQuit( |
282 TestTimeouts::action_max_timeout_ms(), &exit_code)); | 282 TestTimeouts::action_max_timeout_ms(), &exit_code)); |
283 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. | 283 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. |
284 | 284 |
285 browser_quit_time_ = base::TimeTicks::Now() - quit_start; | 285 browser_quit_time_ = base::TimeTicks::Now() - quit_start; |
286 } | 286 } |
287 | 287 |
288 void ProxyLauncher::TerminateBrowser() { | 288 void ProxyLauncher::TerminateBrowser() { |
289 // If we have already finished waiting for the browser to exit | 289 // If we have already finished waiting for the browser to exit |
290 // (or it hasn't launched at all), there's nothing to do here. | 290 // (or it hasn't launched at all), there's nothing to do here. |
291 if (process_ == base::kNullProcessHandle) | 291 if (process_ == base::kNullProcessHandle || !automation_proxy_.get()) |
292 return; | 292 return; |
293 | 293 |
294 base::TimeTicks quit_start = base::TimeTicks::Now(); | 294 base::TimeTicks quit_start = base::TimeTicks::Now(); |
295 | 295 |
296 EXPECT_TRUE(automation()->SetFilteredInet(false)); | 296 EXPECT_TRUE(automation()->SetFilteredInet(false)); |
297 #if defined(OS_WIN) | 297 #if defined(OS_WIN) |
298 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 298 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
299 ASSERT_TRUE(browser.get()); | 299 ASSERT_TRUE(browser.get()); |
300 ASSERT_TRUE(browser->TerminateSession()); | 300 ASSERT_TRUE(browser->TerminateSession()); |
301 #endif // defined(OS_WIN) | 301 #endif // defined(OS_WIN) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 return LaunchBrowserAndServer(state, wait_for_initial_loads); | 598 return LaunchBrowserAndServer(state, wait_for_initial_loads); |
599 } | 599 } |
600 | 600 |
601 void AnonymousProxyLauncher::TerminateConnection() { | 601 void AnonymousProxyLauncher::TerminateConnection() { |
602 CloseBrowserAndServer(); | 602 CloseBrowserAndServer(); |
603 } | 603 } |
604 | 604 |
605 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 605 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
606 return channel_id_; | 606 return channel_id_; |
607 } | 607 } |
OLD | NEW |