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

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

Issue 191483002: Get rid of multiprocess_test's debug_on_start arguments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: restore ipc_switches.* 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 unified diff | Download patch | Annotate | Revision Log
« 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 ProcessHandle 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 bool debug_on_start) {
18 CommandLine command_line(base_command_line); 17 CommandLine command_line(base_command_line);
19 // TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file. 18 // TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file.
20 // 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
21 // command line. 20 // command line.
22 if (!command_line.HasSwitch(switches::kTestChildProcess)) { 21 if (!command_line.HasSwitch(switches::kTestChildProcess))
23 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); 22 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
24 if (debug_on_start)
25 command_line.AppendSwitch(switches::kDebugOnStart);
26 }
27 23
28 ProcessHandle handle = kNullProcessHandle; 24 ProcessHandle handle = kNullProcessHandle;
29 LaunchProcess(command_line, options, &handle); 25 LaunchProcess(command_line, options, &handle);
30 return handle; 26 return handle;
31 } 27 }
32 #endif // !defined(OS_ANDROID) 28 #endif // !defined(OS_ANDROID)
33 29
34 CommandLine GetMultiProcessTestChildBaseCommandLine() { 30 CommandLine GetMultiProcessTestChildBaseCommandLine() {
35 return *CommandLine::ForCurrentProcess(); 31 return *CommandLine::ForCurrentProcess();
36 } 32 }
37 33
38 // MultiProcessTest ------------------------------------------------------------ 34 // MultiProcessTest ------------------------------------------------------------
39 35
40 MultiProcessTest::MultiProcessTest() { 36 MultiProcessTest::MultiProcessTest() {
41 } 37 }
42 38
43 ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname, 39 ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname) {
44 bool debug_on_start) {
45 LaunchOptions options; 40 LaunchOptions options;
46 #if defined(OS_WIN) 41 #if defined(OS_WIN)
47 options.start_hidden = true; 42 options.start_hidden = true;
48 #endif 43 #endif
49 return SpawnChildWithOptions(procname, options, debug_on_start); 44 return SpawnChildWithOptions(procname, options);
50 } 45 }
51 46
52 ProcessHandle MultiProcessTest::SpawnChildWithOptions( 47 ProcessHandle MultiProcessTest::SpawnChildWithOptions(
53 const std::string& procname, 48 const std::string& procname,
54 const LaunchOptions& options, 49 const LaunchOptions& options) {
55 bool debug_on_start) { 50 return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options);
56 return SpawnMultiProcessTestChild(procname,
57 MakeCmdLine(procname, debug_on_start),
58 options,
59 debug_on_start);
60 } 51 }
61 52
62 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname, 53 CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname) {
63 bool debug_on_start) {
64 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); 54 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine();
65 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); 55 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
66 if (debug_on_start)
67 command_line.AppendSwitch(switches::kDebugOnStart);
68 return command_line; 56 return command_line;
69 } 57 }
70 58
71 } // namespace base 59 } // 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