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

Side by Side Diff: mojo/edk/test/multiprocess_test_helper.cc

Issue 2019973002: [mojo-edk] Bind a child token to child launches and port reservations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 | « mojo/edk/system/node_controller.cc ('k') | services/shell/runner/common/client_util.h » ('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 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #elif defined(OS_WIN) 109 #elif defined(OS_WIN)
110 options.start_hidden = true; 110 options.start_hidden = true;
111 if (base::win::GetVersion() >= base::win::VERSION_VISTA) 111 if (base::win::GetVersion() >= base::win::VERSION_VISTA)
112 options.handles_to_inherit = &handle_passing_info; 112 options.handles_to_inherit = &handle_passing_info;
113 else 113 else
114 options.inherit_handles = true; 114 options.inherit_handles = true;
115 #else 115 #else
116 #error "Not supported yet." 116 #error "Not supported yet."
117 #endif 117 #endif
118 118
119 ScopedMessagePipeHandle pipe = CreateParentMessagePipe(pipe_token); 119 std::string child_token = mojo::edk::GenerateRandomToken();
120 ScopedMessagePipeHandle pipe = CreateParentMessagePipe(pipe_token,
121 child_token);
120 122
121 test_child_ = 123 test_child_ =
122 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); 124 base::SpawnMultiProcessTestChild(test_child_main, command_line, options);
123 channel.ChildProcessLaunched(); 125 channel.ChildProcessLaunched();
124 126
125 ChildProcessLaunched(test_child_.Handle(), channel.PassServerHandle()); 127 ChildProcessLaunched(test_child_.Handle(), channel.PassServerHandle(),
128 child_token);
126 CHECK(test_child_.IsValid()); 129 CHECK(test_child_.IsValid());
127 130
128 return pipe; 131 return pipe;
129 } 132 }
130 133
131 int MultiprocessTestHelper::WaitForChildShutdown() { 134 int MultiprocessTestHelper::WaitForChildShutdown() {
132 CHECK(test_child_.IsValid()); 135 CHECK(test_child_.IsValid());
133 136
134 int rv = -1; 137 int rv = -1;
135 #if defined(OS_ANDROID) 138 #if defined(OS_ANDROID)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 ::testing::Test::HasNonfatalFailure()) ? 1 : 0; 185 ::testing::Test::HasNonfatalFailure()) ? 1 : 0;
183 }); 186 });
184 } 187 }
185 188
186 // static 189 // static
187 std::string MultiprocessTestHelper::primordial_pipe_token; 190 std::string MultiprocessTestHelper::primordial_pipe_token;
188 191
189 } // namespace test 192 } // namespace test
190 } // namespace edk 193 } // namespace edk
191 } // namespace mojo 194 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/node_controller.cc ('k') | services/shell/runner/common/client_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698