| 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 <ostream> | 7 #include <ostream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 ~TestQuicSpdyServerSession() override{}; | 57 ~TestQuicSpdyServerSession() override{}; |
| 58 | 58 |
| 59 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 59 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
| 60 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); | 60 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); |
| 61 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicSpdyStream*()); | 61 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicSpdyStream*()); |
| 62 | 62 |
| 63 void SetCryptoStream(QuicCryptoServerStream* crypto_stream) { | 63 void SetCryptoStream(QuicCryptoServerStream* crypto_stream) { |
| 64 crypto_stream_ = crypto_stream; | 64 crypto_stream_ = crypto_stream; |
| 65 } | 65 } |
| 66 | 66 |
| 67 QuicCryptoServerStream* GetCryptoStream() override { return crypto_stream_; } | 67 QuicCryptoServerStreamBase* GetCryptoStream() override { |
| 68 return crypto_stream_; |
| 69 } |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 QuicCryptoServerStream* crypto_stream_; | 72 QuicCryptoServerStreamBase* crypto_stream_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyServerSession); | 74 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyServerSession); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 class TestDispatcher : public QuicDispatcher { | 77 class TestDispatcher : public QuicDispatcher { |
| 76 public: | 78 public: |
| 77 TestDispatcher(const QuicConfig& config, | 79 TestDispatcher(const QuicConfig& config, |
| 78 const QuicCryptoServerConfig* crypto_config, | 80 const QuicCryptoServerConfig* crypto_config, |
| 79 EpollServer* eps) | 81 EpollServer* eps) |
| 80 : QuicDispatcher(config, | 82 : QuicDispatcher(config, |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 QuicServerSession* CreateSessionBasedOnTestParams( | 403 QuicServerSession* CreateSessionBasedOnTestParams( |
| 402 QuicConnectionId connection_id, | 404 QuicConnectionId connection_id, |
| 403 const IPEndPoint& client_address) { | 405 const IPEndPoint& client_address) { |
| 404 CreateSession(&dispatcher_, config_, connection_id, client_address, | 406 CreateSession(&dispatcher_, config_, connection_id, client_address, |
| 405 &mock_helper_, &crypto_config_, &session1_); | 407 &mock_helper_, &crypto_config_, &session1_); |
| 406 | 408 |
| 407 crypto_stream1_ = new MockQuicCryptoServerStream(crypto_config_, session1_); | 409 crypto_stream1_ = new MockQuicCryptoServerStream(crypto_config_, session1_); |
| 408 session1_->SetCryptoStream(crypto_stream1_); | 410 session1_->SetCryptoStream(crypto_stream1_); |
| 409 crypto_stream1_->set_handshake_confirmed_for_testing( | 411 crypto_stream1_->set_handshake_confirmed_for_testing( |
| 410 GetParam().crypto_handshake_successful); | 412 GetParam().crypto_handshake_successful); |
| 411 crypto_stream1_->set_peer_supports_stateless_rejects( | 413 crypto_stream1_->SetPeerSupportsStatelessRejects( |
| 412 GetParam().client_supports_statelesss_rejects); | 414 GetParam().client_supports_statelesss_rejects); |
| 413 return session1_; | 415 return session1_; |
| 414 } | 416 } |
| 415 | 417 |
| 416 MockQuicCryptoServerStream* crypto_stream1_; | 418 MockQuicCryptoServerStream* crypto_stream1_; |
| 417 }; | 419 }; |
| 418 | 420 |
| 419 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { | 421 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { |
| 420 CreateTimeWaitListManager(); | 422 CreateTimeWaitListManager(); |
| 421 | 423 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // And we'll resume where we left off when we get another call. | 743 // And we'll resume where we left off when we get another call. |
| 742 EXPECT_CALL(*connection2(), OnCanWrite()); | 744 EXPECT_CALL(*connection2(), OnCanWrite()); |
| 743 dispatcher_.OnCanWrite(); | 745 dispatcher_.OnCanWrite(); |
| 744 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 746 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
| 745 } | 747 } |
| 746 | 748 |
| 747 } // namespace | 749 } // namespace |
| 748 } // namespace test | 750 } // namespace test |
| 749 } // namespace tools | 751 } // namespace tools |
| 750 } // namespace net | 752 } // namespace net |
| OLD | NEW |