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

Side by Side Diff: ipc/ipc_test_base.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 | « ipc/ipc_channel_posix_unittest.cc ('k') | mojo/common/test/multiprocess_test_helper.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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "ipc/ipc_test_base.h" 7 #include "ipc/ipc_test_base.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/debug_on_start_win.h" 10 #include "base/debug/debug_on_start_win.h"
11 #include "base/process/kill.h" 11 #include "base/process/kill.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "ipc/ipc_descriptors.h" 14 #include "ipc/ipc_descriptors.h"
15 #include "ipc/ipc_switches.h"
16 15
17 #if defined(OS_POSIX) 16 #if defined(OS_POSIX)
18 #include "base/posix/global_descriptors.h" 17 #include "base/posix/global_descriptors.h"
19 #endif 18 #endif
20 19
21 // static 20 // static
22 std::string IPCTestBase::GetChannelName(const std::string& test_client_name) { 21 std::string IPCTestBase::GetChannelName(const std::string& test_client_name) {
23 DCHECK(!test_client_name.empty()); 22 DCHECK(!test_client_name.empty());
24 return test_client_name + "__Channel"; 23 return test_client_name + "__Channel";
25 } 24 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 88
90 void IPCTestBase::DestroyChannelProxy() { 89 void IPCTestBase::DestroyChannelProxy() {
91 CHECK(channel_proxy_.get()); 90 CHECK(channel_proxy_.get());
92 channel_proxy_.reset(); 91 channel_proxy_.reset();
93 } 92 }
94 93
95 bool IPCTestBase::StartClient() { 94 bool IPCTestBase::StartClient() {
96 DCHECK(client_process_ == base::kNullProcessHandle); 95 DCHECK(client_process_ == base::kNullProcessHandle);
97 96
98 std::string test_main = test_client_name_ + "TestClientMain"; 97 std::string test_main = test_client_name_ + "TestClientMain";
99 bool debug_on_start =
100 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugChildren);
101 98
102 #if defined(OS_WIN) 99 #if defined(OS_WIN)
103 client_process_ = SpawnChild(test_main, debug_on_start); 100 client_process_ = SpawnChild(test_main);
104 #elif defined(OS_POSIX) 101 #elif defined(OS_POSIX)
105 base::FileHandleMappingVector fds_to_map; 102 base::FileHandleMappingVector fds_to_map;
106 const int ipcfd = channel_.get() ? channel_->GetClientFileDescriptor() : 103 const int ipcfd = channel_.get() ? channel_->GetClientFileDescriptor() :
107 channel_proxy_->GetClientFileDescriptor(); 104 channel_proxy_->GetClientFileDescriptor();
108 if (ipcfd > -1) 105 if (ipcfd > -1)
109 fds_to_map.push_back(std::pair<int, int>(ipcfd, 106 fds_to_map.push_back(std::pair<int, int>(ipcfd,
110 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 107 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
111 base::LaunchOptions options; 108 base::LaunchOptions options;
112 options.fds_to_remap = &fds_to_map; 109 options.fds_to_remap = &fds_to_map;
113 client_process_ = SpawnChildWithOptions(test_main, options, debug_on_start); 110 client_process_ = SpawnChildWithOptions(test_main, options);
114 #endif 111 #endif
115 112
116 return client_process_ != base::kNullProcessHandle; 113 return client_process_ != base::kNullProcessHandle;
117 } 114 }
118 115
119 bool IPCTestBase::WaitForClientShutdown() { 116 bool IPCTestBase::WaitForClientShutdown() {
120 DCHECK(client_process_ != base::kNullProcessHandle); 117 DCHECK(client_process_ != base::kNullProcessHandle);
121 118
122 bool rv = base::WaitForSingleProcess(client_process_, 119 bool rv = base::WaitForSingleProcess(client_process_,
123 base::TimeDelta::FromSeconds(5)); 120 base::TimeDelta::FromSeconds(5));
124 base::CloseProcessHandle(client_process_); 121 base::CloseProcessHandle(client_process_);
125 client_process_ = base::kNullProcessHandle; 122 client_process_ = base::kNullProcessHandle;
126 return rv; 123 return rv;
127 } 124 }
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix_unittest.cc ('k') | mojo/common/test/multiprocess_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698