OLD | NEW |
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/core/crypto/quic_random.h" | 7 #include "net/quic/core/crypto/quic_random.h" |
| 8 #include "net/quic/platform/api/quic_test.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 QuicEpollConnectionHelperTest : public ::testing::Test { | 15 class QuicEpollConnectionHelperTest : public QuicTest { |
16 protected: | 16 protected: |
17 QuicEpollConnectionHelperTest() | 17 QuicEpollConnectionHelperTest() |
18 : helper_(&epoll_server_, QuicAllocator::BUFFER_POOL) {} | 18 : helper_(&epoll_server_, QuicAllocator::BUFFER_POOL) {} |
19 | 19 |
20 MockEpollServer epoll_server_; | 20 MockEpollServer epoll_server_; |
21 QuicEpollConnectionHelper helper_; | 21 QuicEpollConnectionHelper helper_; |
22 }; | 22 }; |
23 | 23 |
24 TEST_F(QuicEpollConnectionHelperTest, GetClock) { | 24 TEST_F(QuicEpollConnectionHelperTest, GetClock) { |
25 const QuicClock* clock = helper_.GetClock(); | 25 const QuicClock* clock = helper_.GetClock(); |
26 QuicTime start = clock->Now(); | 26 QuicTime start = clock->Now(); |
27 | 27 |
28 QuicTime::Delta delta = QuicTime::Delta::FromMilliseconds(5); | 28 QuicTime::Delta delta = QuicTime::Delta::FromMilliseconds(5); |
29 epoll_server_.AdvanceBy(delta.ToMicroseconds()); | 29 epoll_server_.AdvanceBy(delta.ToMicroseconds()); |
30 | 30 |
31 EXPECT_EQ(start + delta, clock->Now()); | 31 EXPECT_EQ(start + delta, clock->Now()); |
32 } | 32 } |
33 | 33 |
34 TEST_F(QuicEpollConnectionHelperTest, GetRandomGenerator) { | 34 TEST_F(QuicEpollConnectionHelperTest, GetRandomGenerator) { |
35 QuicRandom* random = helper_.GetRandomGenerator(); | 35 QuicRandom* random = helper_.GetRandomGenerator(); |
36 EXPECT_EQ(QuicRandom::GetInstance(), random); | 36 EXPECT_EQ(QuicRandom::GetInstance(), random); |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 } // namespace test | 40 } // namespace test |
41 } // namespace net | 41 } // namespace net |
OLD | NEW |