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 "base/test/multiprocess_test.h" | 5 #include "base/test/multiprocess_test.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/threading/thread_restrictions.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 | 15 |
15 #if !defined(OS_ANDROID) | 16 #if !defined(OS_ANDROID) |
16 SpawnChildResult SpawnMultiProcessTestChild( | 17 SpawnChildResult SpawnMultiProcessTestChild( |
17 const std::string& procname, | 18 const std::string& procname, |
18 const CommandLine& base_command_line, | 19 const CommandLine& base_command_line, |
19 const LaunchOptions& options) { | 20 const LaunchOptions& options) { |
20 CommandLine command_line(base_command_line); | 21 CommandLine command_line(base_command_line); |
(...skipping 16 matching lines...) Expand all Loading... |
37 | 38 |
38 bool TerminateMultiProcessTestChild(const Process& process, | 39 bool TerminateMultiProcessTestChild(const Process& process, |
39 int exit_code, | 40 int exit_code, |
40 bool wait) { | 41 bool wait) { |
41 return process.Terminate(exit_code, wait); | 42 return process.Terminate(exit_code, wait); |
42 } | 43 } |
43 | 44 |
44 #endif // !defined(OS_ANDROID) | 45 #endif // !defined(OS_ANDROID) |
45 | 46 |
46 CommandLine GetMultiProcessTestChildBaseCommandLine() { | 47 CommandLine GetMultiProcessTestChildBaseCommandLine() { |
| 48 base::ThreadRestrictions::ScopedAllowIO allow_io; |
47 CommandLine cmd_line = *CommandLine::ForCurrentProcess(); | 49 CommandLine cmd_line = *CommandLine::ForCurrentProcess(); |
48 cmd_line.SetProgram(MakeAbsoluteFilePath(cmd_line.GetProgram())); | 50 cmd_line.SetProgram(MakeAbsoluteFilePath(cmd_line.GetProgram())); |
49 return cmd_line; | 51 return cmd_line; |
50 } | 52 } |
51 | 53 |
52 // MultiProcessTest ------------------------------------------------------------ | 54 // MultiProcessTest ------------------------------------------------------------ |
53 | 55 |
54 MultiProcessTest::MultiProcessTest() { | 56 MultiProcessTest::MultiProcessTest() { |
55 } | 57 } |
56 | 58 |
(...skipping 11 matching lines...) Expand all Loading... |
68 return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options); | 70 return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options); |
69 } | 71 } |
70 | 72 |
71 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname) { | 73 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname) { |
72 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); | 74 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); |
73 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); | 75 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); |
74 return command_line; | 76 return command_line; |
75 } | 77 } |
76 | 78 |
77 } // namespace base | 79 } // namespace base |
OLD | NEW |