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

Side by Side Diff: content/public/test/test_launcher.cc

Issue 17910005: Fix handling of BROWSER_WRAPPER in the test launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 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
« no previous file with comments | « base/test/test_launcher.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) 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
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 char* browser_wrapper = getenv("BROWSER_WRAPPER");
99 default_timeout, 99 int exit_code = base::LaunchChildGTestProcess(
100 was_timeout); 100 new_cmd_line,
101 browser_wrapper ? browser_wrapper : std::string(),
102 default_timeout,
103 was_timeout);
101 if (*was_timeout) { 104 if (*was_timeout) {
102 LOG(ERROR) << "Test timeout (" << default_timeout.InMilliseconds() 105 LOG(ERROR) << "Test timeout (" << default_timeout.InMilliseconds()
103 << " ms) exceeded for " << test_name; 106 << " ms) exceeded for " << test_name;
104 } 107 }
105 108
106 return exit_code; 109 return exit_code;
107 } 110 }
108 111
109 // Runs test specified by |test_name| in a child process, 112 // Runs test specified by |test_name| in a child process,
110 // and returns the exit code. 113 // and returns the exit code.
(...skipping 12 matching lines...) Expand all
123 #endif 126 #endif
124 127
125 base::ScopedTempDir temp_dir; 128 base::ScopedTempDir temp_dir;
126 // Create a new data dir and pass it to the child. 129 // Create a new data dir and pass it to the child.
127 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { 130 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) {
128 LOG(ERROR) << "Error creating temp data directory"; 131 LOG(ERROR) << "Error creating temp data directory";
129 return -1; 132 return -1;
130 } 133 }
131 134
132 CommandLine new_cmd_line(*CommandLine::ForCurrentProcess()); 135 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, 136 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line,
146 temp_dir.path())) { 137 temp_dir.path())) {
147 return -1; 138 return -1;
148 } 139 }
149 140
150 return DoRunTestInternal( 141 return DoRunTestInternal(
151 test_case, test_name, new_cmd_line, default_timeout, was_timeout); 142 test_case, test_name, new_cmd_line, default_timeout, was_timeout);
152 } 143 }
153 144
154 void PrintUsage() { 145 void PrintUsage() {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 343
353 WrapperTestLauncherDelegate delegate(launcher_delegate); 344 WrapperTestLauncherDelegate delegate(launcher_delegate);
354 return base::LaunchTests(&delegate, argc, argv); 345 return base::LaunchTests(&delegate, argc, argv);
355 } 346 }
356 347
357 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { 348 TestLauncherDelegate* GetCurrentTestLauncherDelegate() {
358 return g_launcher_delegate; 349 return g_launcher_delegate;
359 } 350 }
360 351
361 } // namespace content 352 } // namespace content
OLDNEW
« no previous file with comments | « base/test/test_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698