| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 ~TestQuicSpdyServerSession() override{}; | 56 ~TestQuicSpdyServerSession() override{}; |
| 57 | 57 |
| 58 MOCK_METHOD2(OnConnectionClosed, | 58 MOCK_METHOD2(OnConnectionClosed, |
| 59 void(QuicErrorCode error, ConnectionCloseSource source)); | 59 void(QuicErrorCode error, ConnectionCloseSource source)); |
| 60 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); | 60 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); |
| 61 MOCK_METHOD1(CreateOutgoingDynamicStream, | 61 MOCK_METHOD1(CreateOutgoingDynamicStream, |
| 62 QuicSpdyStream*(SpdyPriority priority)); | 62 QuicSpdyStream*(SpdyPriority priority)); |
| 63 | 63 |
| 64 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( | 64 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( |
| 65 const QuicCryptoServerConfig* crypto_config) override { | 65 const QuicCryptoServerConfig* crypto_config) override { |
| 66 return new QuicCryptoServerStream(crypto_config, this); | 66 return new QuicCryptoServerStream( |
| 67 crypto_config, FLAGS_enable_quic_stateless_reject_support, this); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void SetCryptoStream(QuicCryptoServerStream* crypto_stream) { | 70 void SetCryptoStream(QuicCryptoServerStream* crypto_stream) { |
| 70 crypto_stream_ = crypto_stream; | 71 crypto_stream_ = crypto_stream; |
| 71 } | 72 } |
| 72 | 73 |
| 73 QuicCryptoServerStreamBase* GetCryptoStream() override { | 74 QuicCryptoServerStreamBase* GetCryptoStream() override { |
| 74 return crypto_stream_; | 75 return crypto_stream_; |
| 75 } | 76 } |
| 76 | 77 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 377 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
| 377 .Times(1); | 378 .Times(1); |
| 378 ProcessPacket(client_address, connection_id, false, false, "data"); | 379 ProcessPacket(client_address, connection_id, false, false, "data"); |
| 379 } | 380 } |
| 380 | 381 |
| 381 // Enables mocking of the handshake-confirmation for stateless rejects. | 382 // Enables mocking of the handshake-confirmation for stateless rejects. |
| 382 class MockQuicCryptoServerStream : public QuicCryptoServerStream { | 383 class MockQuicCryptoServerStream : public QuicCryptoServerStream { |
| 383 public: | 384 public: |
| 384 MockQuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, | 385 MockQuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, |
| 385 QuicSession* session) | 386 QuicSession* session) |
| 386 : QuicCryptoServerStream(&crypto_config, session) {} | 387 : QuicCryptoServerStream(&crypto_config, |
| 388 FLAGS_enable_quic_stateless_reject_support, |
| 389 session) {} |
| 387 void set_handshake_confirmed_for_testing(bool handshake_confirmed) { | 390 void set_handshake_confirmed_for_testing(bool handshake_confirmed) { |
| 388 handshake_confirmed_ = handshake_confirmed; | 391 handshake_confirmed_ = handshake_confirmed; |
| 389 } | 392 } |
| 390 | 393 |
| 391 private: | 394 private: |
| 392 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); | 395 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); |
| 393 }; | 396 }; |
| 394 | 397 |
| 395 struct StatelessRejectTestParams { | 398 struct StatelessRejectTestParams { |
| 396 StatelessRejectTestParams(bool enable_stateless_rejects_via_flag, | 399 StatelessRejectTestParams(bool enable_stateless_rejects_via_flag, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 815 |
| 813 // And we'll resume where we left off when we get another call. | 816 // And we'll resume where we left off when we get another call. |
| 814 EXPECT_CALL(*connection2(), OnCanWrite()); | 817 EXPECT_CALL(*connection2(), OnCanWrite()); |
| 815 dispatcher_.OnCanWrite(); | 818 dispatcher_.OnCanWrite(); |
| 816 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 819 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
| 817 } | 820 } |
| 818 | 821 |
| 819 } // namespace | 822 } // namespace |
| 820 } // namespace test | 823 } // namespace test |
| 821 } // namespace net | 824 } // namespace net |
| OLD | NEW |