| 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/quic/core/quic_server_session_base.h" | 5 #include "net/quic/core/quic_server_session_base.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const size_t kMaxStreamsForTest = 10; | 122 const size_t kMaxStreamsForTest = 10; |
| 123 | 123 |
| 124 class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> { | 124 class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> { |
| 125 protected: | 125 protected: |
| 126 QuicServerSessionBaseTest() | 126 QuicServerSessionBaseTest() |
| 127 : crypto_config_(QuicCryptoServerConfig::TESTING, | 127 : crypto_config_(QuicCryptoServerConfig::TESTING, |
| 128 QuicRandom::GetInstance(), | 128 QuicRandom::GetInstance(), |
| 129 CryptoTestUtils::ProofSourceForTesting()), | 129 CryptoTestUtils::ProofSourceForTesting()), |
| 130 compressed_certs_cache_( | 130 compressed_certs_cache_( |
| 131 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { | 131 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { |
| 132 FLAGS_quic_always_log_bugs_for_tests = true; | |
| 133 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 132 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
| 134 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); | 133 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); |
| 135 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, | 134 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, |
| 136 kMaxStreamsForTest); | 135 kMaxStreamsForTest); |
| 137 config_.SetInitialStreamFlowControlWindowToSend( | 136 config_.SetInitialStreamFlowControlWindowToSend( |
| 138 kInitialStreamFlowControlWindowForTest); | 137 kInitialStreamFlowControlWindowForTest); |
| 139 config_.SetInitialSessionFlowControlWindowToSend( | 138 config_.SetInitialSessionFlowControlWindowToSend( |
| 140 kInitialSessionFlowControlWindowForTest); | 139 kInitialSessionFlowControlWindowForTest); |
| 141 | 140 |
| 142 connection_ = new StrictMock<MockQuicConnection>( | 141 connection_ = new StrictMock<MockQuicConnection>( |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 TEST_P(QuicServerSessionBaseTest, GetEvenIncomingError) { | 355 TEST_P(QuicServerSessionBaseTest, GetEvenIncomingError) { |
| 357 // Incoming streams on the server session must be odd. | 356 // Incoming streams on the server session must be odd. |
| 358 EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_STREAM_ID, _, _)); | 357 EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_STREAM_ID, _, _)); |
| 359 EXPECT_EQ(nullptr, QuicServerSessionBasePeer::GetOrCreateDynamicStream( | 358 EXPECT_EQ(nullptr, QuicServerSessionBasePeer::GetOrCreateDynamicStream( |
| 360 session_.get(), 4)); | 359 session_.get(), 4)); |
| 361 } | 360 } |
| 362 | 361 |
| 363 TEST_P(QuicServerSessionBaseTest, GetStreamDisconnected) { | 362 TEST_P(QuicServerSessionBaseTest, GetStreamDisconnected) { |
| 364 // Don't create new streams if the connection is disconnected. | 363 // Don't create new streams if the connection is disconnected. |
| 365 QuicConnectionPeer::TearDownLocalConnectionState(connection_); | 364 QuicConnectionPeer::TearDownLocalConnectionState(connection_); |
| 366 EXPECT_DFATAL( | 365 EXPECT_QUIC_BUG( |
| 367 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5), | 366 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5), |
| 368 "ShouldCreateIncomingDynamicStream called when disconnected"); | 367 "ShouldCreateIncomingDynamicStream called when disconnected"); |
| 369 } | 368 } |
| 370 | 369 |
| 371 class MockQuicCryptoServerStream : public QuicCryptoServerStream { | 370 class MockQuicCryptoServerStream : public QuicCryptoServerStream { |
| 372 public: | 371 public: |
| 373 explicit MockQuicCryptoServerStream( | 372 explicit MockQuicCryptoServerStream( |
| 374 const QuicCryptoServerConfig* crypto_config, | 373 const QuicCryptoServerConfig* crypto_config, |
| 375 QuicCompressedCertsCache* compressed_certs_cache, | 374 QuicCompressedCertsCache* compressed_certs_cache, |
| 376 QuicServerSessionBase* session) | 375 QuicServerSessionBase* session) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 EXPECT_FALSE( | 556 EXPECT_FALSE( |
| 558 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 557 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 559 session_->OnConfigNegotiated(); | 558 session_->OnConfigNegotiated(); |
| 560 EXPECT_FALSE( | 559 EXPECT_FALSE( |
| 561 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 560 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 562 } | 561 } |
| 563 | 562 |
| 564 } // namespace | 563 } // namespace |
| 565 } // namespace test | 564 } // namespace test |
| 566 } // namespace net | 565 } // namespace net |
| OLD | NEW |