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

Side by Side Diff: net/tools/quic/quic_epoll_connection_helper_test.cc

Issue 1918953003: Landing Recent QUIC changes until 4/22/2016 14:55 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deleted SpdyFramerTests missed while mergeing 120451808 Created 4 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
« no previous file with comments | « net/tools/quic/quic_epoll_alarm_factory_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_connection_helper.h" 5 #include "net/tools/quic/quic_epoll_connection_helper.h"
6 6
7 #include "net/quic/crypto/quic_random.h" 7 #include "net/quic/crypto/quic_random.h"
8 #include "net/tools/quic/test_tools/mock_epoll_server.h" 8 #include "net/tools/quic/test_tools/mock_epoll_server.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using net::test::MockEpollServer; 11 using net::test::MockEpollServer;
12 12
13 namespace net { 13 namespace net {
14 namespace test { 14 namespace test {
15 namespace { 15 namespace {
16 16
17 class TestDelegate : public QuicAlarm::Delegate {
18 public:
19 TestDelegate() : fired_(false) {}
20
21 void OnAlarm() override { fired_ = true; }
22
23 bool fired() const { return fired_; }
24
25 private:
26 bool fired_;
27 };
28
29 class QuicEpollConnectionHelperTest : public ::testing::Test { 17 class QuicEpollConnectionHelperTest : public ::testing::Test {
30 protected: 18 protected:
31 QuicEpollConnectionHelperTest() 19 QuicEpollConnectionHelperTest()
32 : helper_(&epoll_server_, QuicAllocator::BUFFER_POOL) {} 20 : helper_(&epoll_server_, QuicAllocator::BUFFER_POOL) {}
33 21
34 MockEpollServer epoll_server_; 22 MockEpollServer epoll_server_;
35 QuicEpollConnectionHelper helper_; 23 QuicEpollConnectionHelper helper_;
36 }; 24 };
37 25
38 TEST_F(QuicEpollConnectionHelperTest, GetClock) { 26 TEST_F(QuicEpollConnectionHelperTest, GetClock) {
39 const QuicClock* clock = helper_.GetClock(); 27 const QuicClock* clock = helper_.GetClock();
40 QuicTime start = clock->Now(); 28 QuicTime start = clock->Now();
41 29
42 QuicTime::Delta delta = QuicTime::Delta::FromMilliseconds(5); 30 QuicTime::Delta delta = QuicTime::Delta::FromMilliseconds(5);
43 epoll_server_.AdvanceBy(delta.ToMicroseconds()); 31 epoll_server_.AdvanceBy(delta.ToMicroseconds());
44 32
45 EXPECT_EQ(start.Add(delta), clock->Now()); 33 EXPECT_EQ(start.Add(delta), clock->Now());
46 } 34 }
47 35
48 TEST_F(QuicEpollConnectionHelperTest, GetRandomGenerator) { 36 TEST_F(QuicEpollConnectionHelperTest, GetRandomGenerator) {
49 QuicRandom* random = helper_.GetRandomGenerator(); 37 QuicRandom* random = helper_.GetRandomGenerator();
50 EXPECT_EQ(QuicRandom::GetInstance(), random); 38 EXPECT_EQ(QuicRandom::GetInstance(), random);
51 } 39 }
52 40
53 } // namespace 41 } // namespace
54 } // namespace test 42 } // namespace test
55 } // namespace net 43 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_epoll_alarm_factory_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698