OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 // channel does not crash after the channel has been closed. | 1129 // channel does not crash after the channel has been closed. |
1130 class ServerSendAfterClose : public Worker { | 1130 class ServerSendAfterClose : public Worker { |
1131 public: | 1131 public: |
1132 ServerSendAfterClose() | 1132 ServerSendAfterClose() |
1133 : Worker(Channel::MODE_SERVER, "simpler_server"), | 1133 : Worker(Channel::MODE_SERVER, "simpler_server"), |
1134 send_result_(true) { | 1134 send_result_(true) { |
1135 } | 1135 } |
1136 | 1136 |
1137 bool SendDummy() { | 1137 bool SendDummy() { |
1138 ListenerThread()->message_loop()->PostTask( | 1138 ListenerThread()->message_loop()->PostTask( |
1139 FROM_HERE, base::IgnoreReturn<bool>( | 1139 FROM_HERE, base::Bind(base::IgnoreResult(&ServerSendAfterClose::Send), |
1140 base::Bind(&ServerSendAfterClose::Send, this, | 1140 this, new SyncChannelTestMsg_NoArgs)); |
1141 new SyncChannelTestMsg_NoArgs))); | |
1142 return true; | 1141 return true; |
1143 } | 1142 } |
1144 | 1143 |
1145 bool send_result() const { | 1144 bool send_result() const { |
1146 return send_result_; | 1145 return send_result_; |
1147 } | 1146 } |
1148 | 1147 |
1149 private: | 1148 private: |
1150 virtual void Run() { | 1149 virtual void Run() { |
1151 CloseChannel(); | 1150 CloseChannel(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 std::vector<Worker*> workers; | 1328 std::vector<Worker*> workers; |
1330 workers.push_back(new NonRestrictedDispatchServer); | 1329 workers.push_back(new NonRestrictedDispatchServer); |
1331 workers.push_back(server); | 1330 workers.push_back(server); |
1332 workers.push_back( | 1331 workers.push_back( |
1333 new RestrictedDispatchClient(&sent_ping_event, server, &success)); | 1332 new RestrictedDispatchClient(&sent_ping_event, server, &success)); |
1334 RunTest(workers); | 1333 RunTest(workers); |
1335 EXPECT_EQ(3, success); | 1334 EXPECT_EQ(3, success); |
1336 } | 1335 } |
1337 | 1336 |
1338 } // namespace IPC | 1337 } // namespace IPC |
OLD | NEW |