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/tools/quic/test_tools/mock_quic_dispatcher.h" | 9 #include "net/tools/quic/test_tools/mock_quic_dispatcher.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using ::testing::_; | 12 using ::testing::_; |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 namespace tools { | 15 namespace tools { |
16 namespace test { | 16 namespace test { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class QuicServerDispatchPacketTest : public ::testing::Test { | 20 class QuicServerDispatchPacketTest : public ::testing::Test { |
21 public: | 21 public: |
22 QuicServerDispatchPacketTest() | 22 QuicServerDispatchPacketTest() |
23 : crypto_config_("blah", QuicRandom::GetInstance()), | 23 : crypto_config_("blah", QuicRandom::GetInstance()), |
24 dispatcher_(config_, crypto_config_, 1234, &eps_) {} | 24 dispatcher_(config_, crypto_config_, &eps_) { |
| 25 dispatcher_.Initialize(1234); |
| 26 } |
25 | 27 |
26 void DispatchPacket(const QuicEncryptedPacket& packet) { | 28 void DispatchPacket(const QuicEncryptedPacket& packet) { |
27 IPEndPoint client_addr, server_addr; | 29 IPEndPoint client_addr, server_addr; |
28 dispatcher_.ProcessPacket(server_addr, client_addr, packet); | 30 dispatcher_.ProcessPacket(server_addr, client_addr, packet); |
29 } | 31 } |
30 | 32 |
31 protected: | 33 protected: |
32 QuicConfig config_; | 34 QuicConfig config_; |
33 QuicCryptoServerConfig crypto_config_; | 35 QuicCryptoServerConfig crypto_config_; |
34 EpollServer eps_; | 36 EpollServer eps_; |
(...skipping 16 matching lines...) Expand all Loading... |
51 arraysize(valid_packet), false); | 53 arraysize(valid_packet), false); |
52 | 54 |
53 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); | 55 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); |
54 DispatchPacket(encrypted_valid_packet); | 56 DispatchPacket(encrypted_valid_packet); |
55 } | 57 } |
56 | 58 |
57 } // namespace | 59 } // namespace |
58 } // namespace test | 60 } // namespace test |
59 } // namespace tools | 61 } // namespace tools |
60 } // namespace net | 62 } // namespace net |
OLD | NEW |