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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 SendWithTimeoutMixedOKAndTimeout(false); | 1027 SendWithTimeoutMixedOKAndTimeout(false); |
1028 SendWithTimeoutMixedOKAndTimeout(true); | 1028 SendWithTimeoutMixedOKAndTimeout(true); |
1029 } | 1029 } |
1030 | 1030 |
1031 //------------------------------------------------------------------------------ | 1031 //------------------------------------------------------------------------------ |
1032 | 1032 |
1033 namespace { | 1033 namespace { |
1034 | 1034 |
1035 void NestedCallback(Worker* server) { | 1035 void NestedCallback(Worker* server) { |
1036 // Sleep a bit so that we wake up after the reply has been received. | 1036 // Sleep a bit so that we wake up after the reply has been received. |
1037 base::PlatformThread::Sleep(250); | 1037 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(250)); |
1038 server->SendAnswerToLife(true, base::kNoTimeout, true); | 1038 server->SendAnswerToLife(true, base::kNoTimeout, true); |
1039 } | 1039 } |
1040 | 1040 |
1041 bool timeout_occurred = false; | 1041 bool timeout_occurred = false; |
1042 | 1042 |
1043 void TimeoutCallback() { | 1043 void TimeoutCallback() { |
1044 timeout_occurred = true; | 1044 timeout_occurred = true; |
1045 } | 1045 } |
1046 | 1046 |
1047 class DoneEventRaceServer : public Worker { | 1047 class DoneEventRaceServer : public Worker { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 std::vector<Worker*> workers; | 1328 std::vector<Worker*> workers; |
1329 workers.push_back(new NonRestrictedDispatchServer); | 1329 workers.push_back(new NonRestrictedDispatchServer); |
1330 workers.push_back(server); | 1330 workers.push_back(server); |
1331 workers.push_back( | 1331 workers.push_back( |
1332 new RestrictedDispatchClient(&sent_ping_event, server, &success)); | 1332 new RestrictedDispatchClient(&sent_ping_event, server, &success)); |
1333 RunTest(workers); | 1333 RunTest(workers); |
1334 EXPECT_EQ(3, success); | 1334 EXPECT_EQ(3, success); |
1335 } | 1335 } |
1336 | 1336 |
1337 } // namespace IPC | 1337 } // namespace IPC |
OLD | NEW |