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/tools/quic/quic_server.h" | 5 #include "net/tools/quic/quic_server.h" |
6 | 6 |
7 #include "net/quic/crypto/quic_random.h" | 7 #include "net/quic/crypto/quic_random.h" |
8 #include "net/quic/quic_utils.h" | 8 #include "net/quic/quic_utils.h" |
9 #include "net/quic/test_tools/crypto_test_utils.h" | 9 #include "net/quic/test_tools/crypto_test_utils.h" |
10 #include "net/quic/test_tools/mock_quic_dispatcher.h" | 10 #include "net/quic/test_tools/mock_quic_dispatcher.h" |
| 11 #include "net/tools/quic/quic_epoll_alarm_factory.h" |
11 #include "net/tools/quic/quic_epoll_connection_helper.h" | 12 #include "net/tools/quic/quic_epoll_connection_helper.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 using ::testing::_; | 15 using ::testing::_; |
15 using net::test::CryptoTestUtils; | 16 using net::test::CryptoTestUtils; |
16 using net::test::MockQuicDispatcher; | 17 using net::test::MockQuicDispatcher; |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 namespace test { | 20 namespace test { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 class QuicServerDispatchPacketTest : public ::testing::Test { | 24 class QuicServerDispatchPacketTest : public ::testing::Test { |
24 public: | 25 public: |
25 QuicServerDispatchPacketTest() | 26 QuicServerDispatchPacketTest() |
26 : crypto_config_("blah", | 27 : crypto_config_("blah", |
27 QuicRandom::GetInstance(), | 28 QuicRandom::GetInstance(), |
28 CryptoTestUtils::ProofSourceForTesting()), | 29 CryptoTestUtils::ProofSourceForTesting()), |
29 dispatcher_( | 30 dispatcher_( |
30 config_, | 31 config_, |
31 &crypto_config_, | 32 &crypto_config_, |
32 new QuicEpollConnectionHelper(&eps_, QuicAllocator::BUFFER_POOL)) { | 33 std::unique_ptr<QuicEpollConnectionHelper>( |
| 34 new QuicEpollConnectionHelper(&eps_, |
| 35 QuicAllocator::BUFFER_POOL)), |
| 36 std::unique_ptr<QuicEpollAlarmFactory>( |
| 37 new QuicEpollAlarmFactory(&eps_))) { |
33 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1234)); | 38 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1234)); |
34 } | 39 } |
35 | 40 |
36 void DispatchPacket(const QuicReceivedPacket& packet) { | 41 void DispatchPacket(const QuicReceivedPacket& packet) { |
37 IPEndPoint client_addr, server_addr; | 42 IPEndPoint client_addr, server_addr; |
38 dispatcher_.ProcessPacket(server_addr, client_addr, packet); | 43 dispatcher_.ProcessPacket(server_addr, client_addr, packet); |
39 } | 44 } |
40 | 45 |
41 protected: | 46 protected: |
42 QuicConfig config_; | 47 QuicConfig config_; |
(...skipping 21 matching lines...) Expand all Loading... |
64 arraysize(valid_packet), | 69 arraysize(valid_packet), |
65 QuicTime::Zero(), false); | 70 QuicTime::Zero(), false); |
66 | 71 |
67 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); | 72 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); |
68 DispatchPacket(encrypted_valid_packet); | 73 DispatchPacket(encrypted_valid_packet); |
69 } | 74 } |
70 | 75 |
71 } // namespace | 76 } // namespace |
72 } // namespace test | 77 } // namespace test |
73 } // namespace net | 78 } // namespace net |
OLD | NEW |