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
3 // found in the LICENSE file.
5 #include "base/test/multiprocess_test.h"
7 #include "base/base_switches.h"
8 #include "base/command_line.h"
12 MultiProcessTest::MultiProcessTest() {
15 ProcessHandle
MultiProcessTest::SpawnChild(const std::string
& procname
,
16 bool debug_on_start
) {
17 LaunchOptions options
;
19 options
.start_hidden
= true;
21 return SpawnChildWithOptions(procname
, options
, debug_on_start
);
24 #if !defined(OS_ANDROID)
25 ProcessHandle
MultiProcessTest::SpawnChildWithOptions(
26 const std::string
& procname
,
27 const LaunchOptions
& options
,
28 bool debug_on_start
) {
29 ProcessHandle handle
= kNullProcessHandle
;
30 LaunchProcess(MakeCmdLine(procname
, debug_on_start
), options
, &handle
);
36 ProcessHandle
MultiProcessTest::SpawnChild(
37 const std::string
& procname
,
38 const FileHandleMappingVector
& fds_to_map
,
39 bool debug_on_start
) {
40 LaunchOptions options
;
41 options
.fds_to_remap
= &fds_to_map
;
42 return SpawnChildWithOptions(procname
, options
, debug_on_start
);
46 CommandLine
MultiProcessTest::MakeCmdLine(const std::string
& procname
,
47 bool debug_on_start
) {
48 CommandLine
cl(*CommandLine::ForCurrentProcess());
49 cl
.AppendSwitchASCII(switches::kTestChildProcess
, procname
);
51 cl
.AppendSwitch(switches::kDebugOnStart
);