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