OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ListenerThread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 59 ListenerThread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
60 this, &Worker::OnListenerThreadShutdown1, &listener_done, | 60 this, &Worker::OnListenerThreadShutdown1, &listener_done, |
61 &ipc_done)); | 61 &ipc_done)); |
62 listener_done.Wait(); | 62 listener_done.Wait(); |
63 ipc_done.Wait(); | 63 ipc_done.Wait(); |
64 ipc_thread_.Stop(); | 64 ipc_thread_.Stop(); |
65 listener_thread_.Stop(); | 65 listener_thread_.Stop(); |
66 } | 66 } |
67 void AddRef() { } | 67 void AddRef() { } |
68 void Release() { } | 68 void Release() { } |
69 static bool ImplementsThreadSafeReferenceCounting() { return true; } | |
70 bool Send(Message* msg) { return channel_->Send(msg); } | 69 bool Send(Message* msg) { return channel_->Send(msg); } |
71 bool SendWithTimeout(Message* msg, int timeout_ms) { | 70 bool SendWithTimeout(Message* msg, int timeout_ms) { |
72 return channel_->SendWithTimeout(msg, timeout_ms); | 71 return channel_->SendWithTimeout(msg, timeout_ms); |
73 } | 72 } |
74 void WaitForChannelCreation() { channel_created_->Wait(); } | 73 void WaitForChannelCreation() { channel_created_->Wait(); } |
75 void CloseChannel() { | 74 void CloseChannel() { |
76 DCHECK(MessageLoop::current() == ListenerThread()->message_loop()); | 75 DCHECK(MessageLoop::current() == ListenerThread()->message_loop()); |
77 channel_->Close(); | 76 channel_->Close(); |
78 } | 77 } |
79 void Start() { | 78 void Start() { |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 | 1000 |
1002 // Tests http://b/1474092 - that if after the done_event is set but before | 1001 // Tests http://b/1474092 - that if after the done_event is set but before |
1003 // OnObjectSignaled is called another message is sent out, then after its | 1002 // OnObjectSignaled is called another message is sent out, then after its |
1004 // reply comes back OnObjectSignaled will be called for the first message. | 1003 // reply comes back OnObjectSignaled will be called for the first message. |
1005 TEST_F(IPCSyncChannelTest, DoneEventRace) { | 1004 TEST_F(IPCSyncChannelTest, DoneEventRace) { |
1006 std::vector<Worker*> workers; | 1005 std::vector<Worker*> workers; |
1007 workers.push_back(new DoneEventRaceServer()); | 1006 workers.push_back(new DoneEventRaceServer()); |
1008 workers.push_back(new SimpleClient()); | 1007 workers.push_back(new SimpleClient()); |
1009 RunTest(workers); | 1008 RunTest(workers); |
1010 } | 1009 } |
OLD | NEW |