Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Side by Side Diff: chrome/test/automation/proxy_launcher.cc

Issue 7980053: Don't waste time on browser that crashed before connecting to the IPC channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/automation_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698