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

Side by Side Diff: ipc/ipc_sync_channel_unittest.cc

Issue 6334061: Clean up channel modes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up agl's comments Created 9 years, 10 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_win.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Unit test for SyncChannel. 5 // Unit test for SyncChannel.
6 6
7 #include "ipc/ipc_sync_channel.h" 7 #include "ipc/ipc_sync_channel.h"
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 DISALLOW_COPY_AND_ASSIGN(Worker); 226 DISALLOW_COPY_AND_ASSIGN(Worker);
227 }; 227 };
228 228
229 229
230 // Starts the test with the given workers. This function deletes the workers 230 // Starts the test with the given workers. This function deletes the workers
231 // when it's done. 231 // when it's done.
232 void RunTest(std::vector<Worker*> workers) { 232 void RunTest(std::vector<Worker*> workers) {
233 // First we create the workers that are channel servers, or else the other 233 // First we create the workers that are channel servers, or else the other
234 // workers' channel initialization might fail because the pipe isn't created.. 234 // workers' channel initialization might fail because the pipe isn't created..
235 for (size_t i = 0; i < workers.size(); ++i) { 235 for (size_t i = 0; i < workers.size(); ++i) {
236 if (workers[i]->mode() == Channel::MODE_SERVER) { 236 if (workers[i]->mode() & Channel::MODE_SERVER_FLAG) {
237 workers[i]->Start(); 237 workers[i]->Start();
238 workers[i]->WaitForChannelCreation(); 238 workers[i]->WaitForChannelCreation();
239 } 239 }
240 } 240 }
241 241
242 // now create the clients 242 // now create the clients
243 for (size_t i = 0; i < workers.size(); ++i) { 243 for (size_t i = 0; i < workers.size(); ++i) {
244 if (workers[i]->mode() == Channel::MODE_CLIENT) 244 if (workers[i]->mode() & Channel::MODE_CLIENT_FLAG)
245 workers[i]->Start(); 245 workers[i]->Start();
246 } 246 }
247 247
248 // wait for all the workers to finish 248 // wait for all the workers to finish
249 for (size_t i = 0; i < workers.size(); ++i) 249 for (size_t i = 0; i < workers.size(); ++i)
250 workers[i]->done_event()->Wait(); 250 workers[i]->done_event()->Wait();
251 251
252 STLDeleteContainerPointers(workers.begin(), workers.end()); 252 STLDeleteContainerPointers(workers.begin(), workers.end());
253 } 253 }
254 254
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 server.done_event()->Wait(); 1158 server.done_event()->Wait();
1159 server.done_event()->Reset(); 1159 server.done_event()->Reset();
1160 1160
1161 server.SendDummy(); 1161 server.SendDummy();
1162 server.done_event()->Wait(); 1162 server.done_event()->Wait();
1163 1163
1164 EXPECT_FALSE(server.send_result()); 1164 EXPECT_FALSE(server.send_result());
1165 } 1165 }
1166 1166
1167 1167
OLDNEW
« no previous file with comments | « ipc/ipc_channel_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698