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

Side by Side Diff: base/win/wait_chain_unittest.cc

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Synced Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/win/wait_chain.h" 5 #include "base/win/wait_chain.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); 187 CommandLine command_line = GetMultiProcessTestChildBaseCommandLine();
188 188
189 AppendSwitchHandle(&command_line, "mutex", mutex); 189 AppendSwitchHandle(&command_line, "mutex", mutex);
190 AppendSwitchHandle(&command_line, "sync_event", sync_event); 190 AppendSwitchHandle(&command_line, "sync_event", sync_event);
191 191
192 LaunchOptions options; 192 LaunchOptions options;
193 HandlesToInheritVector handle_vector; 193 HandlesToInheritVector handle_vector;
194 handle_vector.push_back(mutex); 194 handle_vector.push_back(mutex);
195 handle_vector.push_back(sync_event); 195 handle_vector.push_back(sync_event);
196 options.handles_to_inherit = &handle_vector; 196 options.handles_to_inherit = &handle_vector;
197 return SpawnMultiProcessTestChild("WaitChainTestProc", command_line, options); 197 base::SpawnChildResult spawn_result =
198 SpawnMultiProcessTestChild("WaitChainTestProc", command_line, options);
199 return std::move(spawn_result.process);
198 } 200 }
199 201
200 // Returns true if the |wait_chain| is an alternating sequence of thread objects 202 // Returns true if the |wait_chain| is an alternating sequence of thread objects
201 // and synchronization objects. 203 // and synchronization objects.
202 bool WaitChainStructureIsCorrect(const WaitChainNodeVector& wait_chain) { 204 bool WaitChainStructureIsCorrect(const WaitChainNodeVector& wait_chain) {
203 // Checks thread objects. 205 // Checks thread objects.
204 for (size_t i = 0; i < wait_chain.size(); i += 2) { 206 for (size_t i = 0; i < wait_chain.size(); i += 2) {
205 if (wait_chain[i].ObjectType != WctThreadType) 207 if (wait_chain[i].ObjectType != WctThreadType)
206 return false; 208 return false;
207 } 209 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Unblock child process and wait for it to terminate. 311 // Unblock child process and wait for it to terminate.
310 ASSERT_TRUE(::SetEvent(sync_event.Get())); 312 ASSERT_TRUE(::SetEvent(sync_event.Get()));
311 ASSERT_TRUE(child_process.WaitForExit(nullptr)); 313 ASSERT_TRUE(child_process.WaitForExit(nullptr));
312 314
313 // The SimpleThread API expect Join() to be called before destruction. 315 // The SimpleThread API expect Join() to be called before destruction.
314 waiting_thread_3->Join(); 316 waiting_thread_3->Join();
315 } 317 }
316 318
317 } // namespace win 319 } // namespace win
318 } // namespace base 320 } // namespace base
OLDNEW
« no previous file with comments | « base/win/scoped_handle_unittest.cc ('k') | chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698