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 "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
8 #include "base/timer/mock_timer.h" | 8 #include "base/timer/mock_timer.h" |
9 #include "extensions/browser/api/cast_channel/cast_test_util.h" | 9 #include "extensions/browser/api/cast_channel/cast_test_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using testing::_; | 14 using testing::_; |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 namespace core_api { | 17 namespace api { |
18 namespace cast_channel { | 18 namespace cast_channel { |
19 namespace { | 19 namespace { |
20 | 20 |
21 const int64 kTestPingTimeoutMillis = 1000; | 21 const int64 kTestPingTimeoutMillis = 1000; |
22 const int64 kTestLivenessTimeoutMillis = 10000; | 22 const int64 kTestLivenessTimeoutMillis = 10000; |
23 | 23 |
24 // Extends MockTimer with a mockable method ResetTriggered() which permits | 24 // Extends MockTimer with a mockable method ResetTriggered() which permits |
25 // test code to set GMock expectations for Timer::Reset(). | 25 // test code to set GMock expectations for Timer::Reset(). |
26 class MockTimerWithMonitoredReset : public base::MockTimer { | 26 class MockTimerWithMonitoredReset : public base::MockTimer { |
27 public: | 27 public: |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 EXPECT_CALL(*inner_delegate_, Start()); | 141 EXPECT_CALL(*inner_delegate_, Start()); |
142 EXPECT_CALL(*ping_timer_, ResetTriggered()).Times(2); | 142 EXPECT_CALL(*ping_timer_, ResetTriggered()).Times(2); |
143 EXPECT_CALL(*liveness_timer_, ResetTriggered()).Times(2); | 143 EXPECT_CALL(*liveness_timer_, ResetTriggered()).Times(2); |
144 | 144 |
145 keep_alive_->Start(); | 145 keep_alive_->Start(); |
146 keep_alive_->OnMessage(other_message); | 146 keep_alive_->OnMessage(other_message); |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 } // namespace cast_channel | 150 } // namespace cast_channel |
151 } // namespace core_api | 151 } // namespace api |
152 } // namespace extensions | 152 } // namespace extensions |
OLD | NEW |