OLD | NEW |
1 // Copyright (c) 2006-2008 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 scoped_ptr<WaitableEvent> channel_created_; | 215 scoped_ptr<WaitableEvent> channel_created_; |
216 std::string channel_name_; | 216 std::string channel_name_; |
217 Channel::Mode mode_; | 217 Channel::Mode mode_; |
218 scoped_ptr<SyncChannel> channel_; | 218 scoped_ptr<SyncChannel> channel_; |
219 base::Thread ipc_thread_; | 219 base::Thread ipc_thread_; |
220 base::Thread listener_thread_; | 220 base::Thread listener_thread_; |
221 base::Thread* overrided_thread_; | 221 base::Thread* overrided_thread_; |
222 | 222 |
223 base::WaitableEvent shutdown_event_; | 223 base::WaitableEvent shutdown_event_; |
224 | 224 |
225 DISALLOW_EVIL_CONSTRUCTORS(Worker); | 225 DISALLOW_COPY_AND_ASSIGN(Worker); |
226 }; | 226 }; |
227 | 227 |
228 | 228 |
229 // Starts the test with the given workers. This function deletes the workers | 229 // Starts the test with the given workers. This function deletes the workers |
230 // when it's done. | 230 // when it's done. |
231 void RunTest(std::vector<Worker*> workers) { | 231 void RunTest(std::vector<Worker*> workers) { |
232 // First we create the workers that are channel servers, or else the other | 232 // First we create the workers that are channel servers, or else the other |
233 // workers' channel initialization might fail because the pipe isn't created.. | 233 // workers' channel initialization might fail because the pipe isn't created.. |
234 for (size_t i = 0; i < workers.size(); ++i) { | 234 for (size_t i = 0; i < workers.size(); ++i) { |
235 if (workers[i]->mode() == Channel::MODE_SERVER) { | 235 if (workers[i]->mode() == Channel::MODE_SERVER) { |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 | 1108 |
1109 } // namespace | 1109 } // namespace |
1110 | 1110 |
1111 // Tests basic synchronous call | 1111 // Tests basic synchronous call |
1112 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { | 1112 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { |
1113 std::vector<Worker*> workers; | 1113 std::vector<Worker*> workers; |
1114 workers.push_back(new SyncMessageFilterServer()); | 1114 workers.push_back(new SyncMessageFilterServer()); |
1115 workers.push_back(new SimpleClient()); | 1115 workers.push_back(new SimpleClient()); |
1116 RunTest(workers); | 1116 RunTest(workers); |
1117 } | 1117 } |
OLD | NEW |