| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; | 443 base::LaunchOptions options; |
| 444 options.wait = wait; | 444 options.wait = wait; |
| 445 options.process_handle = process; | |
| 446 | 445 |
| 447 #if defined(OS_WIN) | 446 #if defined(OS_WIN) |
| 448 options.start_hidden = !state.show_window; | 447 options.start_hidden = !state.show_window; |
| 449 #elif defined(OS_POSIX) | 448 #elif defined(OS_POSIX) |
| 450 // Sometimes one needs to run the browser under a special environment | 449 // Sometimes one needs to run the browser under a special environment |
| 451 // (e.g. valgrind) without also running the test harness (e.g. python) | 450 // (e.g. valgrind) without also running the test harness (e.g. python) |
| 452 // under the special environment. Provide a way to wrap the browser | 451 // under the special environment. Provide a way to wrap the browser |
| 453 // commandline with a special prefix to invoke the special environment. | 452 // commandline with a special prefix to invoke the special environment. |
| 454 const char* browser_wrapper = getenv("BROWSER_WRAPPER"); | 453 const char* browser_wrapper = getenv("BROWSER_WRAPPER"); |
| 455 if (browser_wrapper) { | 454 if (browser_wrapper) { |
| 456 command_line.PrependWrapper(browser_wrapper); | 455 command_line.PrependWrapper(browser_wrapper); |
| 457 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " | 456 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " |
| 458 << browser_wrapper; | 457 << browser_wrapper; |
| 459 } | 458 } |
| 460 | 459 |
| 461 base::file_handle_mapping_vector fds; | 460 base::file_handle_mapping_vector fds; |
| 462 if (automation_proxy_.get()) | 461 if (automation_proxy_.get()) |
| 463 fds = automation_proxy_->fds_to_map(); | 462 fds = automation_proxy_->fds_to_map(); |
| 464 options.fds_to_remap = &fds; | 463 options.fds_to_remap = &fds; |
| 465 #endif | 464 #endif |
| 466 | 465 |
| 467 return base::LaunchProcess(command_line, options); | 466 return base::LaunchProcess(command_line, options, process); |
| 468 } | 467 } |
| 469 | 468 |
| 470 AutomationProxy* ProxyLauncher::automation() const { | 469 AutomationProxy* ProxyLauncher::automation() const { |
| 471 EXPECT_TRUE(automation_proxy_.get()); | 470 EXPECT_TRUE(automation_proxy_.get()); |
| 472 return automation_proxy_.get(); | 471 return automation_proxy_.get(); |
| 473 } | 472 } |
| 474 | 473 |
| 475 FilePath ProxyLauncher::user_data_dir() const { | 474 FilePath ProxyLauncher::user_data_dir() const { |
| 476 EXPECT_TRUE(temp_profile_dir_.IsValid()); | 475 EXPECT_TRUE(temp_profile_dir_.IsValid()); |
| 477 return temp_profile_dir_.path(); | 476 return temp_profile_dir_.path(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); | 576 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); |
| 578 } | 577 } |
| 579 | 578 |
| 580 void AnonymousProxyLauncher::TerminateConnection() { | 579 void AnonymousProxyLauncher::TerminateConnection() { |
| 581 CloseBrowserAndServer(); | 580 CloseBrowserAndServer(); |
| 582 } | 581 } |
| 583 | 582 |
| 584 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 583 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
| 585 return channel_id_; | 584 return channel_id_; |
| 586 } | 585 } |
| OLD | NEW |