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 "components/proximity_auth/bluetooth_throttler_impl.h" | 5 #include "components/proximity_auth/bluetooth_throttler_impl.h" |
6 | 6 |
| 7 #include "base/macros.h" |
7 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
9 #include "components/proximity_auth/fake_connection.h" | 10 #include "components/proximity_auth/fake_connection.h" |
10 #include "components/proximity_auth/wire_message.h" | 11 #include "components/proximity_auth/wire_message.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 namespace proximity_auth { | 14 namespace proximity_auth { |
14 namespace { | 15 namespace { |
15 | 16 |
16 class TestBluetoothThrottler : public BluetoothThrottlerImpl { | 17 class TestBluetoothThrottler : public BluetoothThrottlerImpl { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 GetDelay_DelayedConnectionAfterInProgressDisconnectIsNotThrottled) { | 89 GetDelay_DelayedConnectionAfterInProgressDisconnectIsNotThrottled) { |
89 // Simulate an attempt to connect (in progress connection) followed by a | 90 // Simulate an attempt to connect (in progress connection) followed by a |
90 // disconnection, then allow the cooldown period to elapse. | 91 // disconnection, then allow the cooldown period to elapse. |
91 PerformConnectionStateTransition(Connection::IN_PROGRESS, | 92 PerformConnectionStateTransition(Connection::IN_PROGRESS, |
92 Connection::DISCONNECTED); | 93 Connection::DISCONNECTED); |
93 clock_->Advance(throttler_.GetCooldownTimeDelta()); | 94 clock_->Advance(throttler_.GetCooldownTimeDelta()); |
94 EXPECT_EQ(base::TimeDelta(), throttler_.GetDelay()); | 95 EXPECT_EQ(base::TimeDelta(), throttler_.GetDelay()); |
95 } | 96 } |
96 | 97 |
97 } // namespace proximity_auth | 98 } // namespace proximity_auth |
OLD | NEW |