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 "extensions/browser/api/cast_channel/keep_alive_delegate.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
9 #include "base/test/simple_test_clock.h" | 12 #include "base/test/simple_test_clock.h" |
10 #include "base/timer/mock_timer.h" | 13 #include "base/timer/mock_timer.h" |
11 #include "extensions/browser/api/cast_channel/cast_test_util.h" | 14 #include "extensions/browser/api/cast_channel/cast_test_util.h" |
12 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
15 | 18 |
16 using testing::_; | 19 using testing::_; |
17 | 20 |
18 namespace extensions { | 21 namespace extensions { |
19 namespace api { | 22 namespace api { |
20 namespace cast_channel { | 23 namespace cast_channel { |
21 namespace { | 24 namespace { |
22 | 25 |
23 const int64 kTestPingTimeoutMillis = 1000; | 26 const int64_t kTestPingTimeoutMillis = 1000; |
24 const int64 kTestLivenessTimeoutMillis = 10000; | 27 const int64_t kTestLivenessTimeoutMillis = 10000; |
25 | 28 |
26 // Extends MockTimer with a mockable method ResetTriggered() which permits | 29 // Extends MockTimer with a mockable method ResetTriggered() which permits |
27 // test code to set GMock expectations for Timer::Reset(). | 30 // test code to set GMock expectations for Timer::Reset(). |
28 class MockTimerWithMonitoredReset : public base::MockTimer { | 31 class MockTimerWithMonitoredReset : public base::MockTimer { |
29 public: | 32 public: |
30 MockTimerWithMonitoredReset(bool retain_user_task, bool is_repeating) | 33 MockTimerWithMonitoredReset(bool retain_user_task, bool is_repeating) |
31 : base::MockTimer(retain_user_task, is_repeating) {} | 34 : base::MockTimer(retain_user_task, is_repeating) {} |
32 ~MockTimerWithMonitoredReset() override {} | 35 ~MockTimerWithMonitoredReset() override {} |
33 | 36 |
34 // Instrumentation point for determining how many times Reset() was called. | 37 // Instrumentation point for determining how many times Reset() was called. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 160 |
158 keep_alive_->Start(); | 161 keep_alive_->Start(); |
159 keep_alive_->OnMessage(other_message); | 162 keep_alive_->OnMessage(other_message); |
160 RunPendingTasks(); | 163 RunPendingTasks(); |
161 } | 164 } |
162 | 165 |
163 } // namespace | 166 } // namespace |
164 } // namespace cast_channel | 167 } // namespace cast_channel |
165 } // namespace api | 168 } // namespace api |
166 } // namespace extensions | 169 } // namespace extensions |
OLD | NEW |