diff options
author | timurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 06:48:58 +0000 |
---|---|---|
committer | timurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 06:48:58 +0000 |
commit | 9d3d9fae9ca6c4f06bd646474feacfb2ff357296 (patch) | |
tree | 094f832a0d349f3a153d7584fb1c7ff5dc38ff03 /chrome/test | |
parent | d98261678787d9f149316e3049b56b278f6c5c8c (diff) | |
download | chromium_src-9d3d9fae9ca6c4f06bd646474feacfb2ff357296.zip chromium_src-9d3d9fae9ca6c4f06bd646474feacfb2ff357296.tar.gz chromium_src-9d3d9fae9ca6c4f06bd646474feacfb2ff357296.tar.bz2 |
Add BROWSER_WRAPPER support on Windows [was: POSIX-only]
TEST=Run ui_tests,browser_tests with BROWSER_WRAPPER=echo, make sure it prints out the cmdlines and everything fails :)
Review URL: http://codereview.chromium.org/7461063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94048 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/proxy_launcher.cc | 22 | ||||
-rw-r--r-- | chrome/test/out_of_proc_test_runner.cc | 13 |
2 files changed, 22 insertions, 13 deletions
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc index 6e0138c..eea9b418 100644 --- a/chrome/test/automation/proxy_launcher.cc +++ b/chrome/test/automation/proxy_launcher.cc @@ -437,26 +437,30 @@ bool ProxyLauncher::LaunchBrowserHelper(const LaunchState& state, bool wait, DebugFlags::ProcessDebugFlags( &command_line, ChildProcessInfo::UNKNOWN_PROCESS, false); - // TODO(phajdan.jr): Only run it for "main" browser launch. - browser_launch_time_ = base::TimeTicks::Now(); - - base::LaunchOptions options; - options.wait = wait; - -#if defined(OS_WIN) - options.start_hidden = !state.show_window; -#elif defined(OS_POSIX) // Sometimes one needs to run the browser under a special environment // (e.g. valgrind) without also running the test harness (e.g. python) // under the special environment. Provide a way to wrap the browser // commandline with a special prefix to invoke the special environment. const char* browser_wrapper = getenv("BROWSER_WRAPPER"); if (browser_wrapper) { +#if defined(OS_WIN) + command_line.PrependWrapper(ASCIIToWide(browser_wrapper)); +#elif defined(OS_POSIX) command_line.PrependWrapper(browser_wrapper); +#endif VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " << browser_wrapper; } + // TODO(phajdan.jr): Only run it for "main" browser launch. + browser_launch_time_ = base::TimeTicks::Now(); + + base::LaunchOptions options; + options.wait = wait; + +#if defined(OS_WIN) + options.start_hidden = !state.show_window; +#elif defined(OS_POSIX) base::file_handle_mapping_vector fds; if (automation_proxy_.get()) fds = automation_proxy_->fds_to_map(); diff --git a/chrome/test/out_of_proc_test_runner.cc b/chrome/test/out_of_proc_test_runner.cc index 94ff0d5..e509117 100644 --- a/chrome/test/out_of_proc_test_runner.cc +++ b/chrome/test/out_of_proc_test_runner.cc @@ -20,6 +20,7 @@ #include "base/test/test_suite.h" #include "base/test/test_timeouts.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/test_launcher_utils.h" @@ -352,17 +353,21 @@ int RunTest(const std::string& test_name, int default_timeout_ms) { // file:// access for ChromeOS. new_cmd_line.AppendSwitch(switches::kAllowFileAccess); - base::ProcessHandle process_handle; - base::LaunchOptions options; - -#if defined(OS_POSIX) const char* browser_wrapper = getenv("BROWSER_WRAPPER"); if (browser_wrapper) { +#if defined(OS_WIN) + new_cmd_line.PrependWrapper(ASCIIToWide(browser_wrapper)); +#elif defined(OS_POSIX) new_cmd_line.PrependWrapper(browser_wrapper); +#endif VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " << browser_wrapper; } + base::ProcessHandle process_handle; + base::LaunchOptions options; + +#if defined(OS_POSIX) // On POSIX, we launch the test in a new process group with pgid equal to // its pid. Any child processes that the test may create will inherit the // same pgid. This way, if the test is abruptly terminated, we can clean up |