| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "net/tools/quic/quic_epoll_alarm_factory.h" | 5 #include "net/tools/quic/quic_epoll_alarm_factory.h" |
| 6 | 6 |
| 7 #include "net/quic/platform/api/quic_test.h" |
| 7 #include "net/tools/quic/platform/impl/quic_epoll_clock.h" | 8 #include "net/tools/quic/platform/impl/quic_epoll_clock.h" |
| 8 #include "net/tools/quic/test_tools/mock_epoll_server.h" | 9 #include "net/tools/quic/test_tools/mock_epoll_server.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 namespace test { | 12 namespace test { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class TestDelegate : public QuicAlarm::Delegate { | 15 class TestDelegate : public QuicAlarm::Delegate { |
| 16 public: | 16 public: |
| 17 TestDelegate() : fired_(false) {} | 17 TestDelegate() : fired_(false) {} |
| 18 | 18 |
| 19 void OnAlarm() override { fired_ = true; } | 19 void OnAlarm() override { fired_ = true; } |
| 20 | 20 |
| 21 bool fired() const { return fired_; } | 21 bool fired() const { return fired_; } |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 bool fired_; | 24 bool fired_; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // The boolean parameter denotes whether or not to use an arena. | 27 // The boolean parameter denotes whether or not to use an arena. |
| 28 class QuicEpollAlarmFactoryTest : public ::testing::TestWithParam<bool> { | 28 class QuicEpollAlarmFactoryTest : public QuicTestWithParam<bool> { |
| 29 protected: | 29 protected: |
| 30 QuicEpollAlarmFactoryTest() | 30 QuicEpollAlarmFactoryTest() |
| 31 : clock_(&epoll_server_), alarm_factory_(&epoll_server_) {} | 31 : clock_(&epoll_server_), alarm_factory_(&epoll_server_) {} |
| 32 | 32 |
| 33 QuicConnectionArena* GetArenaParam() { | 33 QuicConnectionArena* GetArenaParam() { |
| 34 return GetParam() ? &arena_ : nullptr; | 34 return GetParam() ? &arena_ : nullptr; |
| 35 } | 35 } |
| 36 | 36 |
| 37 const QuicEpollClock clock_; | 37 const QuicEpollClock clock_; |
| 38 QuicEpollAlarmFactory alarm_factory_; | 38 QuicEpollAlarmFactory alarm_factory_; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 EXPECT_TRUE(alarm->IsSet()); | 127 EXPECT_TRUE(alarm->IsSet()); |
| 128 | 128 |
| 129 // Update it with an uninitialized time and ensure it's cancelled. | 129 // Update it with an uninitialized time and ensure it's cancelled. |
| 130 alarm->Update(QuicTime::Zero(), QuicTime::Delta::FromMicroseconds(1)); | 130 alarm->Update(QuicTime::Zero(), QuicTime::Delta::FromMicroseconds(1)); |
| 131 EXPECT_FALSE(alarm->IsSet()); | 131 EXPECT_FALSE(alarm->IsSet()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace | 134 } // namespace |
| 135 } // namespace test | 135 } // namespace test |
| 136 } // namespace net | 136 } // namespace net |
| OLD | NEW |