OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 base::Thread* ListenerThread() { | 163 base::Thread* ListenerThread() { |
164 return overrided_thread_ ? overrided_thread_ : &listener_thread_; | 164 return overrided_thread_ ? overrided_thread_ : &listener_thread_; |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
168 // Called on the listener thread to create the sync channel. | 168 // Called on the listener thread to create the sync channel. |
169 void OnStart() { | 169 void OnStart() { |
170 // Link ipc_thread_, listener_thread_ and channel_ altogether. | 170 // Link ipc_thread_, listener_thread_ and channel_ altogether. |
171 StartThread(&ipc_thread_, MessageLoop::TYPE_IO); | 171 StartThread(&ipc_thread_, MessageLoop::TYPE_IO); |
172 channel_.reset(new SyncChannel( | 172 channel_.reset(new SyncChannel( |
173 channel_name_, mode_, this, NULL, ipc_thread_.message_loop(), true, | 173 channel_name_, mode_, this, ipc_thread_.message_loop(), true, |
174 &shutdown_event_)); | 174 &shutdown_event_)); |
175 channel_created_->Signal(); | 175 channel_created_->Signal(); |
176 Run(); | 176 Run(); |
177 } | 177 } |
178 | 178 |
179 void OnListenerThreadShutdown1(WaitableEvent* listener_event, | 179 void OnListenerThreadShutdown1(WaitableEvent* listener_event, |
180 WaitableEvent* ipc_event) { | 180 WaitableEvent* ipc_event) { |
181 // SyncChannel needs to be destructed on the thread that it was created on. | 181 // SyncChannel needs to be destructed on the thread that it was created on. |
182 channel_.reset(); | 182 channel_.reset(); |
183 | 183 |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 server.done_event()->Wait(); | 1162 server.done_event()->Wait(); |
1163 server.done_event()->Reset(); | 1163 server.done_event()->Reset(); |
1164 | 1164 |
1165 server.SendDummy(); | 1165 server.SendDummy(); |
1166 server.done_event()->Wait(); | 1166 server.done_event()->Wait(); |
1167 | 1167 |
1168 EXPECT_FALSE(server.send_result()); | 1168 EXPECT_FALSE(server.send_result()); |
1169 } | 1169 } |
1170 | 1170 |
1171 | 1171 |
OLD | NEW |