OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/test/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 CommandLine new_cmd_line(command_line); | 90 CommandLine new_cmd_line(command_line); |
91 | 91 |
92 // Always enable disabled tests. This method is not called with disabled | 92 // Always enable disabled tests. This method is not called with disabled |
93 // tests unless this flag was specified to the browser test executable. | 93 // tests unless this flag was specified to the browser test executable. |
94 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); | 94 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); |
95 new_cmd_line.AppendSwitchASCII("gtest_filter", test_name); | 95 new_cmd_line.AppendSwitchASCII("gtest_filter", test_name); |
96 new_cmd_line.AppendSwitch(kSingleProcessTestsFlag); | 96 new_cmd_line.AppendSwitch(kSingleProcessTestsFlag); |
97 | 97 |
98 int exit_code = base::LaunchChildGTestProcess(new_cmd_line, | 98 int exit_code = base::LaunchChildGTestProcess(new_cmd_line, |
| 99 getenv("BROWSER_WRAPPER"), |
99 default_timeout, | 100 default_timeout, |
100 was_timeout); | 101 was_timeout); |
101 if (*was_timeout) { | 102 if (*was_timeout) { |
102 LOG(ERROR) << "Test timeout (" << default_timeout.InMilliseconds() | 103 LOG(ERROR) << "Test timeout (" << default_timeout.InMilliseconds() |
103 << " ms) exceeded for " << test_name; | 104 << " ms) exceeded for " << test_name; |
104 } | 105 } |
105 | 106 |
106 return exit_code; | 107 return exit_code; |
107 } | 108 } |
108 | 109 |
(...skipping 14 matching lines...) Expand all Loading... |
123 #endif | 124 #endif |
124 | 125 |
125 base::ScopedTempDir temp_dir; | 126 base::ScopedTempDir temp_dir; |
126 // Create a new data dir and pass it to the child. | 127 // Create a new data dir and pass it to the child. |
127 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { | 128 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { |
128 LOG(ERROR) << "Error creating temp data directory"; | 129 LOG(ERROR) << "Error creating temp data directory"; |
129 return -1; | 130 return -1; |
130 } | 131 } |
131 | 132 |
132 CommandLine new_cmd_line(*CommandLine::ForCurrentProcess()); | 133 CommandLine new_cmd_line(*CommandLine::ForCurrentProcess()); |
133 | |
134 const char* browser_wrapper = getenv("BROWSER_WRAPPER"); | |
135 if (browser_wrapper) { | |
136 #if defined(OS_WIN) | |
137 new_cmd_line.PrependWrapper(ASCIIToWide(browser_wrapper)); | |
138 #elif defined(OS_POSIX) | |
139 new_cmd_line.PrependWrapper(browser_wrapper); | |
140 #endif | |
141 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " | |
142 << browser_wrapper; | |
143 } | |
144 | |
145 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line, | 134 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line, |
146 temp_dir.path())) { | 135 temp_dir.path())) { |
147 return -1; | 136 return -1; |
148 } | 137 } |
149 | 138 |
150 return DoRunTestInternal( | 139 return DoRunTestInternal( |
151 test_case, test_name, new_cmd_line, default_timeout, was_timeout); | 140 test_case, test_name, new_cmd_line, default_timeout, was_timeout); |
152 } | 141 } |
153 | 142 |
154 void PrintUsage() { | 143 void PrintUsage() { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 341 |
353 WrapperTestLauncherDelegate delegate(launcher_delegate); | 342 WrapperTestLauncherDelegate delegate(launcher_delegate); |
354 return base::LaunchTests(&delegate, argc, argv); | 343 return base::LaunchTests(&delegate, argc, argv); |
355 } | 344 } |
356 | 345 |
357 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 346 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
358 return g_launcher_delegate; | 347 return g_launcher_delegate; |
359 } | 348 } |
360 | 349 |
361 } // namespace content | 350 } // namespace content |
OLD | NEW |