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

Side by Side Diff: base/test/multiprocess_test.cc

Issue 843113003: MultiProcessTest: Update SpawnChild* to return a Process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « base/test/multiprocess_test.h ('k') | base/test/multiprocess_test_android.cc » ('j') | 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 "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 9
10 namespace base { 10 namespace base {
11 11
12 #if !defined(OS_ANDROID) 12 #if !defined(OS_ANDROID)
13 ProcessHandle SpawnMultiProcessTestChild( 13 Process SpawnMultiProcessTestChild(
14 const std::string& procname, 14 const std::string& procname,
15 const CommandLine& base_command_line, 15 const CommandLine& base_command_line,
16 const LaunchOptions& options) { 16 const LaunchOptions& options) {
17 CommandLine command_line(base_command_line); 17 CommandLine command_line(base_command_line);
18 // TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file. 18 // TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file.
19 // This is a temporary hack, since |MakeCmdLine()| has to provide a full 19 // This is a temporary hack, since |MakeCmdLine()| has to provide a full
20 // command line. 20 // command line.
21 if (!command_line.HasSwitch(switches::kTestChildProcess)) 21 if (!command_line.HasSwitch(switches::kTestChildProcess))
22 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); 22 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
23 23
24 ProcessHandle handle = kNullProcessHandle; 24 return LaunchProcess(command_line, options);
25 LaunchProcess(command_line, options, &handle);
26 return handle;
27 } 25 }
28 #endif // !defined(OS_ANDROID) 26 #endif // !defined(OS_ANDROID)
29 27
30 CommandLine GetMultiProcessTestChildBaseCommandLine() { 28 CommandLine GetMultiProcessTestChildBaseCommandLine() {
31 return *CommandLine::ForCurrentProcess(); 29 return *CommandLine::ForCurrentProcess();
32 } 30 }
33 31
34 // MultiProcessTest ------------------------------------------------------------ 32 // MultiProcessTest ------------------------------------------------------------
35 33
36 MultiProcessTest::MultiProcessTest() { 34 MultiProcessTest::MultiProcessTest() {
37 } 35 }
38 36
39 ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname) { 37 Process MultiProcessTest::SpawnChild(const std::string& procname) {
40 LaunchOptions options; 38 LaunchOptions options;
41 #if defined(OS_WIN) 39 #if defined(OS_WIN)
42 options.start_hidden = true; 40 options.start_hidden = true;
43 #endif 41 #endif
44 return SpawnChildWithOptions(procname, options); 42 return SpawnChildWithOptions(procname, options);
45 } 43 }
46 44
47 ProcessHandle MultiProcessTest::SpawnChildWithOptions( 45 Process MultiProcessTest::SpawnChildWithOptions(
48 const std::string& procname, 46 const std::string& procname,
49 const LaunchOptions& options) { 47 const LaunchOptions& options) {
50 return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options); 48 return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options);
51 } 49 }
52 50
53 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname) { 51 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname) {
54 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); 52 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine();
55 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); 53 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
56 return command_line; 54 return command_line;
57 } 55 }
58 56
59 } // namespace base 57 } // namespace base
OLDNEW
« 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