| 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/core/crypto/quic_random.h" | 7 #include "net/quic/core/crypto/quic_random.h" |
| 8 #include "net/quic/core/quic_utils.h" | 8 #include "net/quic/core/quic_utils.h" |
| 9 #include "net/quic/platform/api/quic_logging.h" | 9 #include "net/quic/platform/api/quic_logging.h" |
| 10 #include "net/quic/platform/api/quic_socket_address.h" | 10 #include "net/quic/platform/api/quic_socket_address.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 MOCK_METHOD0(OnCanWrite, void()); | 45 MOCK_METHOD0(OnCanWrite, void()); |
| 46 MOCK_CONST_METHOD0(HasPendingWrites, bool()); | 46 MOCK_CONST_METHOD0(HasPendingWrites, bool()); |
| 47 MOCK_CONST_METHOD0(HasChlosBuffered, bool()); | 47 MOCK_CONST_METHOD0(HasChlosBuffered, bool()); |
| 48 MOCK_METHOD1(ProcessBufferedChlos, void(size_t)); | 48 MOCK_METHOD1(ProcessBufferedChlos, void(size_t)); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class TestQuicServer : public QuicServer { | 51 class TestQuicServer : public QuicServer { |
| 52 public: | 52 public: |
| 53 TestQuicServer() | 53 TestQuicServer() |
| 54 : QuicServer(CryptoTestUtils::ProofSourceForTesting(), &response_cache_) { | 54 : QuicServer(crypto_test_utils::ProofSourceForTesting(), |
| 55 } | 55 &response_cache_) {} |
| 56 | 56 |
| 57 ~TestQuicServer() override {} | 57 ~TestQuicServer() override {} |
| 58 | 58 |
| 59 MockQuicSimpleDispatcher* mock_dispatcher() { return mock_dispatcher_; } | 59 MockQuicSimpleDispatcher* mock_dispatcher() { return mock_dispatcher_; } |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 QuicDispatcher* CreateQuicDispatcher() override { | 62 QuicDispatcher* CreateQuicDispatcher() override { |
| 63 mock_dispatcher_ = new MockQuicSimpleDispatcher( | 63 mock_dispatcher_ = new MockQuicSimpleDispatcher( |
| 64 config(), &crypto_config(), version_manager(), | 64 config(), &crypto_config(), version_manager(), |
| 65 std::unique_ptr<QuicEpollConnectionHelper>( | 65 std::unique_ptr<QuicEpollConnectionHelper>( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 while (more_chlos) { | 140 while (more_chlos) { |
| 141 server_.WaitForEvents(); | 141 server_.WaitForEvents(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 class QuicServerDispatchPacketTest : public ::testing::Test { | 145 class QuicServerDispatchPacketTest : public ::testing::Test { |
| 146 public: | 146 public: |
| 147 QuicServerDispatchPacketTest() | 147 QuicServerDispatchPacketTest() |
| 148 : crypto_config_("blah", | 148 : crypto_config_("blah", |
| 149 QuicRandom::GetInstance(), | 149 QuicRandom::GetInstance(), |
| 150 CryptoTestUtils::ProofSourceForTesting()), | 150 crypto_test_utils::ProofSourceForTesting()), |
| 151 version_manager_(AllSupportedVersions()), | 151 version_manager_(AllSupportedVersions()), |
| 152 dispatcher_( | 152 dispatcher_( |
| 153 config_, | 153 config_, |
| 154 &crypto_config_, | 154 &crypto_config_, |
| 155 &version_manager_, | 155 &version_manager_, |
| 156 std::unique_ptr<QuicEpollConnectionHelper>( | 156 std::unique_ptr<QuicEpollConnectionHelper>( |
| 157 new QuicEpollConnectionHelper(&eps_, | 157 new QuicEpollConnectionHelper(&eps_, |
| 158 QuicAllocator::BUFFER_POOL)), | 158 QuicAllocator::BUFFER_POOL)), |
| 159 std::unique_ptr<QuicCryptoServerStream::Helper>( | 159 std::unique_ptr<QuicCryptoServerStream::Helper>( |
| 160 new QuicSimpleCryptoServerStreamHelper( | 160 new QuicSimpleCryptoServerStreamHelper( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 reinterpret_cast<char*>(valid_packet), arraysize(valid_packet), | 198 reinterpret_cast<char*>(valid_packet), arraysize(valid_packet), |
| 199 QuicTime::Zero(), false); | 199 QuicTime::Zero(), false); |
| 200 | 200 |
| 201 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); | 201 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); |
| 202 DispatchPacket(encrypted_valid_packet); | 202 DispatchPacket(encrypted_valid_packet); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace | 205 } // namespace |
| 206 } // namespace test | 206 } // namespace test |
| 207 } // namespace net | 207 } // namespace net |
| OLD | NEW |