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

Unified Diff: base/test/multiprocess_test.cc

Issue 189373002: Add multiprocess test helper functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: restore old MakeCmdLine behavior Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/multiprocess_test.h ('k') | base/test/multiprocess_test_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/multiprocess_test.cc
diff --git a/base/test/multiprocess_test.cc b/base/test/multiprocess_test.cc
index 6be5c46e87c38d85e360470a2978deafeec19ef7..dfe01598264ad8f9b4474796ab3ded90d7d8e04e 100644
--- a/base/test/multiprocess_test.cc
+++ b/base/test/multiprocess_test.cc
@@ -9,6 +9,34 @@
namespace base {
+#if !defined(OS_ANDROID)
+ProcessHandle SpawnMultiProcessTestChild(
+ const std::string& procname,
+ const CommandLine& base_command_line,
+ const LaunchOptions& options,
+ bool debug_on_start) {
+ CommandLine command_line(base_command_line);
+ // TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file.
+ // This is a temporary hack, since |MakeCmdLine()| has to provide a full
+ // command line.
+ if (!command_line.HasSwitch(switches::kTestChildProcess)) {
+ command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
+ if (debug_on_start)
+ command_line.AppendSwitch(switches::kDebugOnStart);
+ }
+
+ ProcessHandle handle = kNullProcessHandle;
+ LaunchProcess(command_line, options, &handle);
+ return handle;
+}
+#endif // !defined(OS_ANDROID)
+
+CommandLine GetMultiProcessTestChildBaseCommandLine() {
+ return *CommandLine::ForCurrentProcess();
+}
+
+// MultiProcessTest ------------------------------------------------------------
+
MultiProcessTest::MultiProcessTest() {
}
@@ -21,24 +49,23 @@ ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname,
return SpawnChildWithOptions(procname, options, debug_on_start);
}
-#if !defined(OS_ANDROID)
ProcessHandle MultiProcessTest::SpawnChildWithOptions(
const std::string& procname,
const LaunchOptions& options,
bool debug_on_start) {
- ProcessHandle handle = kNullProcessHandle;
- LaunchProcess(MakeCmdLine(procname, debug_on_start), options, &handle);
- return handle;
+ return SpawnMultiProcessTestChild(procname,
+ MakeCmdLine(procname, debug_on_start),
+ options,
+ debug_on_start);
}
-#endif
CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname,
bool debug_on_start) {
- CommandLine cl(*CommandLine::ForCurrentProcess());
- cl.AppendSwitchASCII(switches::kTestChildProcess, procname);
+ CommandLine command_line = GetMultiProcessTestChildBaseCommandLine();
+ command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
if (debug_on_start)
- cl.AppendSwitch(switches::kDebugOnStart);
- return cl;
+ command_line.AppendSwitch(switches::kDebugOnStart);
+ return command_line;
}
} // namespace base
« no previous file with comments | « base/test/multiprocess_test.h ('k') | base/test/multiprocess_test_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698