| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 QuicHttpResponseCache* response_cache_; // Owned by QuicServerSessionBaseTest | 115 QuicHttpResponseCache* response_cache_; // Owned by QuicServerSessionBaseTest |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 const size_t kMaxStreamsForTest = 10; | 118 const size_t kMaxStreamsForTest = 10; |
| 119 | 119 |
| 120 class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> { | 120 class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> { |
| 121 protected: | 121 protected: |
| 122 QuicServerSessionBaseTest() | 122 QuicServerSessionBaseTest() |
| 123 : QuicServerSessionBaseTest(CryptoTestUtils::ProofSourceForTesting()) {} | 123 : QuicServerSessionBaseTest(crypto_test_utils::ProofSourceForTesting()) {} |
| 124 | 124 |
| 125 explicit QuicServerSessionBaseTest(std::unique_ptr<ProofSource> proof_source) | 125 explicit QuicServerSessionBaseTest(std::unique_ptr<ProofSource> proof_source) |
| 126 : crypto_config_(QuicCryptoServerConfig::TESTING, | 126 : crypto_config_(QuicCryptoServerConfig::TESTING, |
| 127 QuicRandom::GetInstance(), | 127 QuicRandom::GetInstance(), |
| 128 std::move(proof_source)), | 128 std::move(proof_source)), |
| 129 compressed_certs_cache_( | 129 compressed_certs_cache_( |
| 130 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { | 130 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { |
| 131 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 131 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
| 132 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); | 132 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); |
| 133 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, | 133 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 }; | 595 }; |
| 596 | 596 |
| 597 INSTANTIATE_TEST_CASE_P(StreamMemberLifetimeTests, | 597 INSTANTIATE_TEST_CASE_P(StreamMemberLifetimeTests, |
| 598 StreamMemberLifetimeTest, | 598 StreamMemberLifetimeTest, |
| 599 ::testing::ValuesIn(AllSupportedVersions())); | 599 ::testing::ValuesIn(AllSupportedVersions())); |
| 600 | 600 |
| 601 // Trigger an operation which causes an async invocation of | 601 // Trigger an operation which causes an async invocation of |
| 602 // ProofSource::GetProof. Delay the completion of the operation until after the | 602 // ProofSource::GetProof. Delay the completion of the operation until after the |
| 603 // stream has been destroyed, and verify that there are no memory bugs. | 603 // stream has been destroyed, and verify that there are no memory bugs. |
| 604 TEST_P(StreamMemberLifetimeTest, Basic) { | 604 TEST_P(StreamMemberLifetimeTest, Basic) { |
| 605 FLAGS_quic_reloadable_flag_enable_async_get_proof = true; | |
| 606 FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; | 605 FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; |
| 607 FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; | 606 FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; |
| 608 FLAGS_quic_reloadable_flag_quic_create_session_after_insertion = true; | 607 FLAGS_quic_reloadable_flag_quic_create_session_after_insertion = true; |
| 609 | 608 |
| 610 const QuicClock* clock = helper_.GetClock(); | 609 const QuicClock* clock = helper_.GetClock(); |
| 611 QuicVersion version = AllSupportedVersions().front(); | 610 QuicVersion version = AllSupportedVersions().front(); |
| 612 CryptoHandshakeMessage chlo = CryptoTestUtils::GenerateDefaultInchoateCHLO( | 611 CryptoHandshakeMessage chlo = crypto_test_utils::GenerateDefaultInchoateCHLO( |
| 613 clock, version, &crypto_config_); | 612 clock, version, &crypto_config_); |
| 614 chlo.SetVector(kCOPT, QuicTagVector{kSREJ}); | 613 chlo.SetVector(kCOPT, QuicTagVector{kSREJ}); |
| 615 std::vector<QuicVersion> packet_version_list = {version}; | 614 std::vector<QuicVersion> packet_version_list = {version}; |
| 616 std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( | 615 std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( |
| 617 1, true, false, false, kDefaultPathId, 1, | 616 1, true, false, false, kDefaultPathId, 1, |
| 618 chlo.GetSerialized().AsStringPiece().as_string(), | 617 chlo.GetSerialized().AsStringPiece().as_string(), |
| 619 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, | 618 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, |
| 620 &packet_version_list)); | 619 &packet_version_list)); |
| 621 | 620 |
| 622 EXPECT_CALL(stream_helper_, CanAcceptClientHello(_, _, _)) | 621 EXPECT_CALL(stream_helper_, CanAcceptClientHello(_, _, _)) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 643 | 642 |
| 644 // Allow the async ProofSource::GetProof call to complete. Verify (under | 643 // Allow the async ProofSource::GetProof call to complete. Verify (under |
| 645 // asan) that this does not result in accesses to any freed memory from the | 644 // asan) that this does not result in accesses to any freed memory from the |
| 646 // session or its subobjects. | 645 // session or its subobjects. |
| 647 GetFakeProofSource()->InvokePendingCallback(0); | 646 GetFakeProofSource()->InvokePendingCallback(0); |
| 648 } | 647 } |
| 649 | 648 |
| 650 } // namespace | 649 } // namespace |
| 651 } // namespace test | 650 } // namespace test |
| 652 } // namespace net | 651 } // namespace net |
| OLD | NEW |