QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/third_party/quiche/src/quic/core/quic_epoll_connection_helper.h" |
| 6 | |
| 7 | #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" |
| 8 | #include "net/third_party/quiche/src/quic/platform/api/quic_epoll_test_tools.h" |
| 9 | #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" |
| 10 | |
| 11 | namespace quic { |
| 12 | namespace test { |
| 13 | namespace { |
| 14 | |
| 15 | class QuicEpollConnectionHelperTest : public QuicTest { |
| 16 | protected: |
| 17 | QuicEpollConnectionHelperTest() |
| 18 | : helper_(&epoll_server_, QuicAllocator::BUFFER_POOL) {} |
| 19 | |
| 20 | QuicFakeEpollServer epoll_server_; |
| 21 | QuicEpollConnectionHelper helper_; |
| 22 | }; |
| 23 | |
| 24 | TEST_F(QuicEpollConnectionHelperTest, GetClock) { |
| 25 | const QuicClock* clock = helper_.GetClock(); |
| 26 | QuicTime start = clock->Now(); |
| 27 | |
| 28 | QuicTime::Delta delta = QuicTime::Delta::FromMilliseconds(5); |
| 29 | epoll_server_.AdvanceBy(delta.ToMicroseconds()); |
| 30 | |
| 31 | EXPECT_EQ(start + delta, clock->Now()); |
| 32 | } |
| 33 | |
| 34 | TEST_F(QuicEpollConnectionHelperTest, GetRandomGenerator) { |
| 35 | QuicRandom* random = helper_.GetRandomGenerator(); |
| 36 | EXPECT_EQ(QuicRandom::GetInstance(), random); |
| 37 | } |
| 38 | |
| 39 | } // namespace |
| 40 | } // namespace test |
| 41 | } // namespace quic |