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

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

Issue 7346017: Clean up users of a deprecated base::LaunchApp API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros Created 9 years, 5 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
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 "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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 CommandLine command_line(state.command); 433 CommandLine command_line(state.command);
434 434
435 // Add command line arguments that should be applied to all UI tests. 435 // Add command line arguments that should be applied to all UI tests.
436 PrepareTestCommandline(&command_line, state.include_testing_id); 436 PrepareTestCommandline(&command_line, state.include_testing_id);
437 DebugFlags::ProcessDebugFlags( 437 DebugFlags::ProcessDebugFlags(
438 &command_line, ChildProcessInfo::UNKNOWN_PROCESS, false); 438 &command_line, ChildProcessInfo::UNKNOWN_PROCESS, false);
439 439
440 // TODO(phajdan.jr): Only run it for "main" browser launch. 440 // TODO(phajdan.jr): Only run it for "main" browser launch.
441 browser_launch_time_ = base::TimeTicks::Now(); 441 browser_launch_time_ = base::TimeTicks::Now();
442 442
443 base::LaunchOptions options;
444 options.wait = wait;
445 options.process_handle = process;
446
443 #if defined(OS_WIN) 447 #if defined(OS_WIN)
444 bool started = base::LaunchApp(command_line, wait, 448 options.start_hidden = !state.show_window;
445 !state.show_window, process);
446 #elif defined(OS_POSIX) 449 #elif defined(OS_POSIX)
447 // Sometimes one needs to run the browser under a special environment 450 // Sometimes one needs to run the browser under a special environment
448 // (e.g. valgrind) without also running the test harness (e.g. python) 451 // (e.g. valgrind) without also running the test harness (e.g. python)
449 // under the special environment. Provide a way to wrap the browser 452 // under the special environment. Provide a way to wrap the browser
450 // commandline with a special prefix to invoke the special environment. 453 // commandline with a special prefix to invoke the special environment.
451 const char* browser_wrapper = getenv("BROWSER_WRAPPER"); 454 const char* browser_wrapper = getenv("BROWSER_WRAPPER");
452 if (browser_wrapper) { 455 if (browser_wrapper) {
453 command_line.PrependWrapper(browser_wrapper); 456 command_line.PrependWrapper(browser_wrapper);
454 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " 457 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with "
455 << browser_wrapper; 458 << browser_wrapper;
456 } 459 }
457 460
458 base::file_handle_mapping_vector fds; 461 base::file_handle_mapping_vector fds;
459 if (automation_proxy_.get()) 462 if (automation_proxy_.get())
460 fds = automation_proxy_->fds_to_map(); 463 fds = automation_proxy_->fds_to_map();
461 464 options.fds_to_remap = &fds;
462 bool started = base::LaunchApp(command_line.argv(), fds, wait, process);
463 #endif 465 #endif
464 466
465 return started; 467 return base::LaunchProcess(command_line, options);
466 } 468 }
467 469
468 AutomationProxy* ProxyLauncher::automation() const { 470 AutomationProxy* ProxyLauncher::automation() const {
469 EXPECT_TRUE(automation_proxy_.get()); 471 EXPECT_TRUE(automation_proxy_.get());
470 return automation_proxy_.get(); 472 return automation_proxy_.get();
471 } 473 }
472 474
473 FilePath ProxyLauncher::user_data_dir() const { 475 FilePath ProxyLauncher::user_data_dir() const {
474 EXPECT_TRUE(temp_profile_dir_.IsValid()); 476 EXPECT_TRUE(temp_profile_dir_.IsValid());
475 return temp_profile_dir_.path(); 477 return temp_profile_dir_.path();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); 577 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads));
576 } 578 }
577 579
578 void AnonymousProxyLauncher::TerminateConnection() { 580 void AnonymousProxyLauncher::TerminateConnection() {
579 CloseBrowserAndServer(); 581 CloseBrowserAndServer();
580 } 582 }
581 583
582 std::string AnonymousProxyLauncher::PrefixedChannelID() const { 584 std::string AnonymousProxyLauncher::PrefixedChannelID() const {
583 return channel_id_; 585 return channel_id_;
584 } 586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698