Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: net/quic/quic_alarm_test.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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:
51 QuicAlarmTest() 51 QuicAlarmTest()
52 : delegate_(new MockDelegate()), 52 : delegate_(new MockDelegate()),
53 alarm_(delegate_), 53 alarm_(delegate_),
54 deadline_(QuicTime::Zero().Add(QuicTime::Delta::FromSeconds(7))), 54 deadline_(QuicTime::Zero().Add(QuicTime::Delta::FromSeconds(7))),
55 deadline2_(QuicTime::Zero().Add(QuicTime::Delta::FromSeconds(14))), 55 deadline2_(QuicTime::Zero().Add(QuicTime::Delta::FromSeconds(14))),
56 new_deadline_(QuicTime::Zero()) { 56 new_deadline_(QuicTime::Zero()) {}
57 }
58 57
59 void ResetAlarm() { 58 void ResetAlarm() { alarm_.Set(new_deadline_); }
60 alarm_.Set(new_deadline_);
61 }
62 59
63 MockDelegate* delegate_; // not owned 60 MockDelegate* delegate_; // not owned
64 TestAlarm alarm_; 61 TestAlarm alarm_;
65 QuicTime deadline_; 62 QuicTime deadline_;
66 QuicTime deadline2_; 63 QuicTime deadline2_;
67 QuicTime new_deadline_; 64 QuicTime new_deadline_;
68 }; 65 };
69 66
70 TEST_F(QuicAlarmTest, IsSet) { 67 TEST_F(QuicAlarmTest, IsSet) {
71 EXPECT_FALSE(alarm_.IsSet()); 68 EXPECT_FALSE(alarm_.IsSet());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 alarm_.FireAlarm(); 101 alarm_.FireAlarm();
105 EXPECT_TRUE(alarm_.IsSet()); 102 EXPECT_TRUE(alarm_.IsSet());
106 EXPECT_TRUE(alarm_.scheduled()); 103 EXPECT_TRUE(alarm_.scheduled());
107 EXPECT_EQ(deadline2_, alarm_.deadline()); 104 EXPECT_EQ(deadline2_, alarm_.deadline());
108 } 105 }
109 106
110 TEST_F(QuicAlarmTest, FireAndResetViaSet) { 107 TEST_F(QuicAlarmTest, FireAndResetViaSet) {
111 alarm_.Set(deadline_); 108 alarm_.Set(deadline_);
112 new_deadline_ = deadline2_; 109 new_deadline_ = deadline2_;
113 EXPECT_CALL(*delegate_, OnAlarm()).WillOnce(DoAll( 110 EXPECT_CALL(*delegate_, OnAlarm()).WillOnce(DoAll(
114 Invoke(this, &QuicAlarmTest::ResetAlarm), 111 Invoke(this, &QuicAlarmTest::ResetAlarm), Return(QuicTime::Zero())));
115 Return(QuicTime::Zero())));
116 alarm_.FireAlarm(); 112 alarm_.FireAlarm();
117 EXPECT_TRUE(alarm_.IsSet()); 113 EXPECT_TRUE(alarm_.IsSet());
118 EXPECT_TRUE(alarm_.scheduled()); 114 EXPECT_TRUE(alarm_.scheduled());
119 EXPECT_EQ(deadline2_, alarm_.deadline()); 115 EXPECT_EQ(deadline2_, alarm_.deadline());
120 } 116 }
121 117
122 } // namespace 118 } // namespace
123 } // namespace test 119 } // namespace test
124 } // namespace net 120 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698