OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 | 1046 |
1047 class DoneEventRaceServer : public Worker { | 1047 class DoneEventRaceServer : public Worker { |
1048 public: | 1048 public: |
1049 DoneEventRaceServer() | 1049 DoneEventRaceServer() |
1050 : Worker(Channel::MODE_SERVER, "done_event_race_server") { } | 1050 : Worker(Channel::MODE_SERVER, "done_event_race_server") { } |
1051 | 1051 |
1052 void Run() { | 1052 void Run() { |
1053 MessageLoop::current()->PostTask(FROM_HERE, | 1053 MessageLoop::current()->PostTask(FROM_HERE, |
1054 base::Bind(&NestedCallback, this)); | 1054 base::Bind(&NestedCallback, this)); |
1055 MessageLoop::current()->PostDelayedTask( | 1055 MessageLoop::current()->PostDelayedTask( |
1056 FROM_HERE, base::Bind(&TimeoutCallback), 9000); | 1056 FROM_HERE, |
| 1057 base::Bind(&TimeoutCallback), |
| 1058 base::TimeDelta::FromSeconds(9)); |
1057 // Even though we have a timeout on the Send, it will succeed since for this | 1059 // Even though we have a timeout on the Send, it will succeed since for this |
1058 // bug, the reply message comes back and is deserialized, however the done | 1060 // bug, the reply message comes back and is deserialized, however the done |
1059 // event wasn't set. So we indirectly use the timeout task to notice if a | 1061 // event wasn't set. So we indirectly use the timeout task to notice if a |
1060 // timeout occurred. | 1062 // timeout occurred. |
1061 SendAnswerToLife(true, 10000, true); | 1063 SendAnswerToLife(true, 10000, true); |
1062 DCHECK(!timeout_occurred); | 1064 DCHECK(!timeout_occurred); |
1063 Done(); | 1065 Done(); |
1064 } | 1066 } |
1065 }; | 1067 }; |
1066 | 1068 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 workers.push_back(server1); | 1588 workers.push_back(server1); |
1587 | 1589 |
1588 client1 = new RestrictedDispatchDeadlockClient1(server1, client2, | 1590 client1 = new RestrictedDispatchDeadlockClient1(server1, client2, |
1589 &server1_ready, events); | 1591 &server1_ready, events); |
1590 workers.push_back(client1); | 1592 workers.push_back(client1); |
1591 | 1593 |
1592 RunTest(workers); | 1594 RunTest(workers); |
1593 } | 1595 } |
1594 | 1596 |
1595 } // namespace IPC | 1597 } // namespace IPC |
OLD | NEW |