OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "extensions/browser/api/cast_channel/keep_alive_delegate.h" | 5 #include "components/cast_channel/keep_alive_delegate.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/timer/mock_timer.h" | 13 #include "base/timer/mock_timer.h" |
14 #include "extensions/browser/api/cast_channel/cast_test_util.h" | 14 #include "components/cast_channel/cast_test_util.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 using testing::_; | 19 using testing::_; |
20 using testing::Sequence; | 20 using testing::Sequence; |
21 | 21 |
22 namespace extensions { | |
23 namespace api { | |
24 namespace cast_channel { | 22 namespace cast_channel { |
25 namespace { | 23 namespace { |
26 | 24 |
27 const int64_t kTestPingTimeoutMillis = 1000; | 25 const int64_t kTestPingTimeoutMillis = 1000; |
28 const int64_t kTestLivenessTimeoutMillis = 10000; | 26 const int64_t kTestLivenessTimeoutMillis = 10000; |
29 | 27 |
30 // Extends MockTimer with a mockable method ResetTriggered() which permits | 28 // Extends MockTimer with a mockable method ResetTriggered() which permits |
31 // test code to set GMock expectations for Timer::Reset(). | 29 // test code to set GMock expectations for Timer::Reset(). |
32 class MockTimerWithMonitoredReset : public base::MockTimer { | 30 class MockTimerWithMonitoredReset : public base::MockTimer { |
33 public: | 31 public: |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 keep_alive_->OnMessage(message_after_error); | 206 keep_alive_->OnMessage(message_after_error); |
209 RunPendingTasks(); | 207 RunPendingTasks(); |
210 | 208 |
211 // Process a late-arriving PING/PONG message, which should have no effect. | 209 // Process a late-arriving PING/PONG message, which should have no effect. |
212 keep_alive_->OnMessage(late_ping_message); | 210 keep_alive_->OnMessage(late_ping_message); |
213 RunPendingTasks(); | 211 RunPendingTasks(); |
214 } | 212 } |
215 | 213 |
216 } // namespace | 214 } // namespace |
217 } // namespace cast_channel | 215 } // namespace cast_channel |
218 } // namespace api | |
219 } // namespace extensions | |
OLD | NEW |