Resize destination bus to the actual number of decoded frames.
[chromium-blink-merge.git] / base / test / multiprocess_test.cc
blob27f997077b92fa4da39dde3ad97cb071661e7f2a
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"
10 namespace base {
12 MultiProcessTest::MultiProcessTest() {
15 ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname,
16 bool debug_on_start) {
17 FileHandleMappingVector empty_file_list;
18 return SpawnChildImpl(procname, empty_file_list, debug_on_start);
21 #if defined(OS_POSIX)
22 ProcessHandle MultiProcessTest::SpawnChild(
23 const std::string& procname,
24 const FileHandleMappingVector& fds_to_map,
25 bool debug_on_start) {
26 return SpawnChildImpl(procname, fds_to_map, debug_on_start);
28 #endif
30 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname,
31 bool debug_on_start) {
32 CommandLine cl(*CommandLine::ForCurrentProcess());
33 cl.AppendSwitchASCII(switches::kTestChildProcess, procname);
34 if (debug_on_start)
35 cl.AppendSwitch(switches::kDebugOnStart);
36 return cl;
39 #if !defined(OS_ANDROID)
40 ProcessHandle MultiProcessTest::SpawnChildImpl(
41 const std::string& procname,
42 const FileHandleMappingVector& fds_to_map,
43 bool debug_on_start) {
44 ProcessHandle handle = kNullProcessHandle;
45 base::LaunchOptions options;
46 #if defined(OS_WIN)
47 options.start_hidden = true;
48 #else
49 options.fds_to_remap = &fds_to_map;
50 #endif
51 base::LaunchProcess(MakeCmdLine(procname, debug_on_start), options, &handle);
52 return handle;
54 #endif // !defined(OS_ANDROID)
56 } // namespace base