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

Side by Side Diff: ipc/ipc_test_base.cc

Issue 1554443003: Stop linking in the old Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and fix new flaky test Created 4 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 | « ipc/ipc_test_base.h ('k') | ipc/mojo/BUILD.gn » ('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 "ipc/ipc_test_base.h" 5 #include "ipc/ipc_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/process/kill.h" 10 #include "base/process/kill.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DCHECK(channel_.get()); 74 DCHECK(channel_.get());
75 channel_.reset(); 75 channel_.reset();
76 } 76 }
77 77
78 void IPCTestBase::CreateChannelFromChannelHandle( 78 void IPCTestBase::CreateChannelFromChannelHandle(
79 const IPC::ChannelHandle& channel_handle, 79 const IPC::ChannelHandle& channel_handle,
80 IPC::Listener* listener) { 80 IPC::Listener* listener) {
81 CHECK(!channel_.get()); 81 CHECK(!channel_.get());
82 CHECK(!channel_proxy_.get()); 82 CHECK(!channel_proxy_.get());
83 channel_ = CreateChannelFactory( 83 channel_ = CreateChannelFactory(
84 channel_handle, task_runner().get())->BuildChannel(listener); 84 channel_handle, io_task_runner().get())->BuildChannel(listener);
85 } 85 }
86 86
87 void IPCTestBase::CreateChannelProxy( 87 void IPCTestBase::CreateChannelProxy(
88 IPC::Listener* listener, 88 IPC::Listener* listener,
89 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { 89 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
90 CHECK(!channel_.get()); 90 CHECK(!channel_.get());
91 CHECK(!channel_proxy_.get()); 91 CHECK(!channel_proxy_.get());
92 channel_proxy_ = IPC::ChannelProxy::Create( 92 channel_proxy_ = IPC::ChannelProxy::Create(
93 CreateChannelFactory(GetTestChannelHandle(), ipc_task_runner.get()), 93 CreateChannelFactory(GetTestChannelHandle(), ipc_task_runner.get()),
94 listener, ipc_task_runner); 94 listener, ipc_task_runner);
(...skipping 23 matching lines...) Expand all
118 118
119 bool IPCTestBase::StartClientWithFD(int ipcfd) { 119 bool IPCTestBase::StartClientWithFD(int ipcfd) {
120 DCHECK(!client_process_.IsValid()); 120 DCHECK(!client_process_.IsValid());
121 121
122 base::FileHandleMappingVector fds_to_map; 122 base::FileHandleMappingVector fds_to_map;
123 if (ipcfd > -1) 123 if (ipcfd > -1)
124 fds_to_map.push_back(std::pair<int, int>(ipcfd, 124 fds_to_map.push_back(std::pair<int, int>(ipcfd,
125 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 125 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
126 base::LaunchOptions options; 126 base::LaunchOptions options;
127 options.fds_to_remap = &fds_to_map; 127 options.fds_to_remap = &fds_to_map;
128 AboutToSpawnChild(&options);
128 client_process_ = SpawnChildWithOptions(GetTestMainName(), options); 129 client_process_ = SpawnChildWithOptions(GetTestMainName(), options);
129 130
130 return DidStartClient(); 131 return DidStartClient();
131 } 132 }
132 133
133 #elif defined(OS_WIN) 134 #elif defined(OS_WIN)
134 135
135 bool IPCTestBase::StartClient() { 136 bool IPCTestBase::StartClient() {
136 DCHECK(!client_process_.IsValid()); 137 DCHECK(!client_process_.IsValid());
137 client_process_ = SpawnChild(GetTestMainName()); 138 base::LaunchOptions options;
139 base::HandlesToInheritVector handles_to_inherit;
140 options.handles_to_inherit = &handles_to_inherit;
141 AboutToSpawnChild(&options);
142 client_process_ = SpawnChildWithOptions(GetTestMainName(), options);
138 return DidStartClient(); 143 return DidStartClient();
139 } 144 }
140 145
141 #endif 146 #endif
142 147
143 bool IPCTestBase::WaitForClientShutdown() { 148 bool IPCTestBase::WaitForClientShutdown() {
144 DCHECK(client_process_.IsValid()); 149 DCHECK(client_process_.IsValid());
145 150
146 int exit_code; 151 int exit_code;
147 bool rv = client_process_.WaitForExitWithTimeout( 152 bool rv = client_process_.WaitForExitWithTimeout(
148 base::TimeDelta::FromSeconds(5), &exit_code); 153 base::TimeDelta::FromSeconds(5), &exit_code);
149 client_process_.Close(); 154 client_process_.Close();
150 return rv; 155 return rv;
151 } 156 }
152 157
153 IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() { 158 IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() {
154 return GetChannelName(test_client_name_); 159 return GetChannelName(test_client_name_);
155 } 160 }
156 161
157 scoped_refptr<base::SequencedTaskRunner> IPCTestBase::task_runner() { 162 scoped_refptr<base::TaskRunner> IPCTestBase::io_task_runner() {
158 return message_loop_->task_runner(); 163 return message_loop_->task_runner();
159 } 164 }
160 165
161 scoped_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory( 166 scoped_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory(
162 const IPC::ChannelHandle& handle, 167 const IPC::ChannelHandle& handle,
163 base::SequencedTaskRunner* runner) { 168 base::TaskRunner* runner) {
164 return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER); 169 return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER);
165 } 170 }
OLDNEW
« no previous file with comments | « ipc/ipc_test_base.h ('k') | ipc/mojo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698