| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); | 52 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
| 53 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); | 53 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 DISALLOW_COPY_AND_ASSIGN(TestServerSession); | 56 DISALLOW_COPY_AND_ASSIGN(TestServerSession); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class TestDispatcher : public QuicDispatcher { | 59 class TestDispatcher : public QuicDispatcher { |
| 60 public: | 60 public: |
| 61 explicit TestDispatcher(const QuicConfig& config, | 61 explicit TestDispatcher(const QuicConfig& config, |
| 62 const QuicCryptoServerConfig& crypto_config, | 62 const QuicCryptoServerConfig* crypto_config, |
| 63 EpollServer* eps) | 63 EpollServer* eps) |
| 64 : QuicDispatcher(config, | 64 : QuicDispatcher(config, |
| 65 crypto_config, | 65 crypto_config, |
| 66 QuicSupportedVersions(), | 66 QuicSupportedVersions(), |
| 67 new QuicDispatcher::DefaultPacketWriterFactory(), | 67 new QuicDispatcher::DefaultPacketWriterFactory(), |
| 68 new QuicEpollConnectionHelper(eps)) { | 68 new QuicEpollConnectionHelper(eps)) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 MOCK_METHOD3(CreateQuicSession, | 71 MOCK_METHOD3(CreateQuicSession, |
| 72 QuicServerSession*(QuicConnectionId connection_id, | 72 QuicServerSession*(QuicConnectionId connection_id, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 return *session; | 115 return *session; |
| 116 } | 116 } |
| 117 | 117 |
| 118 class QuicDispatcherTest : public ::testing::Test { | 118 class QuicDispatcherTest : public ::testing::Test { |
| 119 public: | 119 public: |
| 120 QuicDispatcherTest() | 120 QuicDispatcherTest() |
| 121 : helper_(&eps_), | 121 : helper_(&eps_), |
| 122 crypto_config_(QuicCryptoServerConfig::TESTING, | 122 crypto_config_(QuicCryptoServerConfig::TESTING, |
| 123 QuicRandom::GetInstance()), | 123 QuicRandom::GetInstance()), |
| 124 dispatcher_(config_, crypto_config_, &eps_), | 124 dispatcher_(config_, &crypto_config_, &eps_), |
| 125 time_wait_list_manager_(nullptr), | 125 time_wait_list_manager_(nullptr), |
| 126 session1_(nullptr), | 126 session1_(nullptr), |
| 127 session2_(nullptr) { | 127 session2_(nullptr) { |
| 128 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1)); | 128 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 ~QuicDispatcherTest() override {} | 131 ~QuicDispatcherTest() override {} |
| 132 | 132 |
| 133 MockConnection* connection1() { | 133 MockConnection* connection1() { |
| 134 return reinterpret_cast<MockConnection*>(session1_->connection()); | 134 return reinterpret_cast<MockConnection*>(session1_->connection()); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // And we'll resume where we left off when we get another call. | 489 // And we'll resume where we left off when we get another call. |
| 490 EXPECT_CALL(*connection2(), OnCanWrite()); | 490 EXPECT_CALL(*connection2(), OnCanWrite()); |
| 491 dispatcher_.OnCanWrite(); | 491 dispatcher_.OnCanWrite(); |
| 492 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 492 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace | 495 } // namespace |
| 496 } // namespace test | 496 } // namespace test |
| 497 } // namespace tools | 497 } // namespace tools |
| 498 } // namespace net | 498 } // namespace net |
| OLD | NEW |