| 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_session_base.h" | 5 #include "net/tools/quic/quic_server_session_base.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "net/quic/crypto/quic_crypto_server_config.h" | 8 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 9 #include "net/quic/crypto/quic_random.h" | 9 #include "net/quic/crypto/quic_random.h" |
| 10 #include "net/quic/proto/cached_network_parameters.pb.h" | 10 #include "net/quic/proto/cached_network_parameters.pb.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 QuicSpdyStream* stream = | 96 QuicSpdyStream* stream = |
| 97 new QuicSimpleServerStream(GetNextOutgoingStreamId(), this); | 97 new QuicSimpleServerStream(GetNextOutgoingStreamId(), this); |
| 98 stream->SetPriority(priority); | 98 stream->SetPriority(priority); |
| 99 ActivateStream(stream); | 99 ActivateStream(stream); |
| 100 return stream; | 100 return stream; |
| 101 } | 101 } |
| 102 | 102 |
| 103 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( | 103 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( |
| 104 const QuicCryptoServerConfig* crypto_config) override { | 104 const QuicCryptoServerConfig* crypto_config) override { |
| 105 return new QuicCryptoServerStream(crypto_config, this); | 105 return new QuicCryptoServerStream( |
| 106 crypto_config, FLAGS_enable_quic_stateless_reject_support, this); |
| 106 } | 107 } |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 const size_t kMaxStreamsForTest = 10; | 110 const size_t kMaxStreamsForTest = 10; |
| 110 | 111 |
| 111 class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> { | 112 class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> { |
| 112 protected: | 113 protected: |
| 113 QuicServerSessionBaseTest() | 114 QuicServerSessionBaseTest() |
| 114 : crypto_config_(QuicCryptoServerConfig::TESTING, | 115 : crypto_config_(QuicCryptoServerConfig::TESTING, |
| 115 QuicRandom::GetInstance(), | 116 QuicRandom::GetInstance(), |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 EXPECT_DFATAL( | 326 EXPECT_DFATAL( |
| 326 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5), | 327 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5), |
| 327 "ShouldCreateIncomingDynamicStream called when disconnected"); | 328 "ShouldCreateIncomingDynamicStream called when disconnected"); |
| 328 } | 329 } |
| 329 | 330 |
| 330 class MockQuicCryptoServerStream : public QuicCryptoServerStream { | 331 class MockQuicCryptoServerStream : public QuicCryptoServerStream { |
| 331 public: | 332 public: |
| 332 explicit MockQuicCryptoServerStream( | 333 explicit MockQuicCryptoServerStream( |
| 333 const QuicCryptoServerConfig* crypto_config, | 334 const QuicCryptoServerConfig* crypto_config, |
| 334 QuicSession* session) | 335 QuicSession* session) |
| 335 : QuicCryptoServerStream(crypto_config, session) {} | 336 : QuicCryptoServerStream(crypto_config, |
| 337 FLAGS_enable_quic_stateless_reject_support, |
| 338 session) {} |
| 336 ~MockQuicCryptoServerStream() override {} | 339 ~MockQuicCryptoServerStream() override {} |
| 337 | 340 |
| 338 MOCK_METHOD1(SendServerConfigUpdate, | 341 MOCK_METHOD1(SendServerConfigUpdate, |
| 339 void(const CachedNetworkParameters* cached_network_parameters)); | 342 void(const CachedNetworkParameters* cached_network_parameters)); |
| 340 | 343 |
| 341 void set_encryption_established(bool has_established) { | 344 void set_encryption_established(bool has_established) { |
| 342 encryption_established_ = has_established; | 345 encryption_established_ = has_established; |
| 343 } | 346 } |
| 344 | 347 |
| 345 private: | 348 private: |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 EXPECT_FALSE( | 512 EXPECT_FALSE( |
| 510 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 513 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 511 session_->OnConfigNegotiated(); | 514 session_->OnConfigNegotiated(); |
| 512 EXPECT_FALSE( | 515 EXPECT_FALSE( |
| 513 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 516 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 514 } | 517 } |
| 515 | 518 |
| 516 } // namespace | 519 } // namespace |
| 517 } // namespace test | 520 } // namespace test |
| 518 } // namespace net | 521 } // namespace net |
| OLD | NEW |