OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/edk/test/multiprocess_test_helper.h" | 5 #include "mojo/edk/test/multiprocess_test_helper.h" |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 #endif | 141 #endif |
142 | 142 |
143 ScopedMessagePipeHandle pipe; | 143 ScopedMessagePipeHandle pipe; |
144 std::string child_token = mojo::edk::GenerateRandomToken(); | 144 std::string child_token = mojo::edk::GenerateRandomToken(); |
145 if (launch_type == LaunchType::CHILD || | 145 if (launch_type == LaunchType::CHILD || |
146 launch_type == LaunchType::NAMED_CHILD) { | 146 launch_type == LaunchType::NAMED_CHILD) { |
147 pipe = CreateParentMessagePipe(pipe_token, child_token); | 147 pipe = CreateParentMessagePipe(pipe_token, child_token); |
148 } else if (launch_type == LaunchType::PEER) { | 148 } else if (launch_type == LaunchType::PEER) { |
149 pipe = ConnectToPeerProcess(channel.PassServerHandle()); | 149 pipe = ConnectToPeerProcess(channel.PassServerHandle()); |
150 } else if (launch_type == LaunchType::NAMED_PEER) { | 150 } else if (launch_type == LaunchType::NAMED_PEER) { |
151 pipe = ConnectToPeerProcess(CreateServerHandle(named_pipe, false)); | 151 pipe = ConnectToPeerProcess(CreateServerHandle(named_pipe)); |
152 } | 152 } |
153 | 153 |
154 test_child_ = | 154 test_child_ = |
155 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); | 155 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); |
156 if (launch_type == LaunchType::CHILD || launch_type == LaunchType::PEER) | 156 if (launch_type == LaunchType::CHILD || launch_type == LaunchType::PEER) |
157 channel.ChildProcessLaunched(); | 157 channel.ChildProcessLaunched(); |
158 | 158 |
159 if (launch_type == LaunchType::CHILD) { | 159 if (launch_type == LaunchType::CHILD) { |
160 ChildProcessLaunched(test_child_.Handle(), channel.PassServerHandle(), | 160 ChildProcessLaunched(test_child_.Handle(), channel.PassServerHandle(), |
161 child_token, process_error_callback_); | 161 child_token, process_error_callback_); |
162 } else if (launch_type == LaunchType::NAMED_CHILD) { | 162 } else if (launch_type == LaunchType::NAMED_CHILD) { |
163 ChildProcessLaunched(test_child_.Handle(), | 163 ChildProcessLaunched(test_child_.Handle(), CreateServerHandle(named_pipe), |
164 CreateServerHandle(named_pipe, false), child_token, | 164 child_token, process_error_callback_); |
165 process_error_callback_); | |
166 } | 165 } |
167 | 166 |
168 CHECK(test_child_.IsValid()); | 167 CHECK(test_child_.IsValid()); |
169 return pipe; | 168 return pipe; |
170 } | 169 } |
171 | 170 |
172 int MultiprocessTestHelper::WaitForChildShutdown() { | 171 int MultiprocessTestHelper::WaitForChildShutdown() { |
173 CHECK(test_child_.IsValid()); | 172 CHECK(test_child_.IsValid()); |
174 | 173 |
175 int rv = -1; | 174 int rv = -1; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 ::testing::Test::HasNonfatalFailure()) ? 1 : 0; | 238 ::testing::Test::HasNonfatalFailure()) ? 1 : 0; |
240 }); | 239 }); |
241 } | 240 } |
242 | 241 |
243 // static | 242 // static |
244 mojo::ScopedMessagePipeHandle MultiprocessTestHelper::primordial_pipe; | 243 mojo::ScopedMessagePipeHandle MultiprocessTestHelper::primordial_pipe; |
245 | 244 |
246 } // namespace test | 245 } // namespace test |
247 } // namespace edk | 246 } // namespace edk |
248 } // namespace mojo | 247 } // namespace mojo |
OLD | NEW |