OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic/quic_alarm.h" | 5 #include "net/quic/quic_alarm.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {} | 25 explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {} |
26 | 26 |
27 bool scheduled() const { return scheduled_; } | 27 bool scheduled() const { return scheduled_; } |
28 | 28 |
29 void FireAlarm() { | 29 void FireAlarm() { |
30 scheduled_ = false; | 30 scheduled_ = false; |
31 Fire(); | 31 Fire(); |
32 } | 32 } |
33 | 33 |
34 protected: | 34 protected: |
35 virtual void SetImpl() OVERRIDE { | 35 virtual void SetImpl() override { |
36 DCHECK(deadline().IsInitialized()); | 36 DCHECK(deadline().IsInitialized()); |
37 scheduled_ = true; | 37 scheduled_ = true; |
38 } | 38 } |
39 | 39 |
40 virtual void CancelImpl() OVERRIDE { | 40 virtual void CancelImpl() override { |
41 DCHECK(!deadline().IsInitialized()); | 41 DCHECK(!deadline().IsInitialized()); |
42 scheduled_ = false; | 42 scheduled_ = false; |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 bool scheduled_; | 46 bool scheduled_; |
47 }; | 47 }; |
48 | 48 |
49 class QuicAlarmTest : public ::testing::Test { | 49 class QuicAlarmTest : public ::testing::Test { |
50 public: | 50 public: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Return(QuicTime::Zero()))); | 134 Return(QuicTime::Zero()))); |
135 alarm_.FireAlarm(); | 135 alarm_.FireAlarm(); |
136 EXPECT_TRUE(alarm_.IsSet()); | 136 EXPECT_TRUE(alarm_.IsSet()); |
137 EXPECT_TRUE(alarm_.scheduled()); | 137 EXPECT_TRUE(alarm_.scheduled()); |
138 EXPECT_EQ(deadline2_, alarm_.deadline()); | 138 EXPECT_EQ(deadline2_, alarm_.deadline()); |
139 } | 139 } |
140 | 140 |
141 } // namespace | 141 } // namespace |
142 } // namespace test | 142 } // namespace test |
143 } // namespace net | 143 } // namespace net |
OLD | NEW |