| Index: net/quic/core/quic_crypto_server_stream_test.cc
|
| diff --git a/net/quic/core/quic_crypto_server_stream_test.cc b/net/quic/core/quic_crypto_server_stream_test.cc
|
| index 87e9d6daa72c52f5aa60d882b9477fd7a5512c73..dadcaee3d0107edaff3bcc9989b0bcc4b5620d2d 100644
|
| --- a/net/quic/core/quic_crypto_server_stream_test.cc
|
| +++ b/net/quic/core/quic_crypto_server_stream_test.cc
|
| @@ -58,9 +58,12 @@ const uint16_t kServerPort = 443;
|
| class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> {
|
| public:
|
| QuicCryptoServerStreamTest()
|
| + : QuicCryptoServerStreamTest(CryptoTestUtils::ProofSourceForTesting()) {}
|
| +
|
| + explicit QuicCryptoServerStreamTest(std::unique_ptr<ProofSource> proof_source)
|
| : server_crypto_config_(QuicCryptoServerConfig::TESTING,
|
| QuicRandom::GetInstance(),
|
| - CryptoTestUtils::ProofSourceForTesting()),
|
| + std::move(proof_source)),
|
| server_compressed_certs_cache_(
|
| QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
|
| server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED),
|
| @@ -575,6 +578,51 @@ TEST_P(QuicCryptoServerStreamTest, CancelRPCBeforeVerificationCompletes) {
|
| strike_register_client_->RunPendingVerifications();
|
| }
|
|
|
| +class FailingProofSource : public ProofSource {
|
| + public:
|
| + bool GetProof(const IPAddress& server_ip,
|
| + const string& hostname,
|
| + const string& server_config,
|
| + QuicVersion quic_version,
|
| + StringPiece chlo_hash,
|
| + scoped_refptr<ProofSource::Chain>* out_chain,
|
| + string* out_signature,
|
| + string* out_leaf_cert_sct) override {
|
| + return false;
|
| + }
|
| +
|
| + void GetProof(const IPAddress& server_ip,
|
| + const string& hostname,
|
| + const string& server_config,
|
| + QuicVersion quic_version,
|
| + StringPiece chlo_hash,
|
| + std::unique_ptr<Callback> callback) override {
|
| + callback->Run(false, nullptr, "", "", nullptr);
|
| + }
|
| +};
|
| +
|
| +class QuicCryptoServerStreamTestWithFailingProofSource
|
| + : public QuicCryptoServerStreamTest {
|
| + public:
|
| + QuicCryptoServerStreamTestWithFailingProofSource()
|
| + : QuicCryptoServerStreamTest(
|
| + std::unique_ptr<FailingProofSource>(new FailingProofSource)) {}
|
| +};
|
| +
|
| +INSTANTIATE_TEST_CASE_P(MoreTests,
|
| + QuicCryptoServerStreamTestWithFailingProofSource,
|
| + testing::Bool());
|
| +
|
| +TEST_P(QuicCryptoServerStreamTestWithFailingProofSource, Test) {
|
| + Initialize();
|
| + InitializeFakeClient(/* supports_stateless_rejects= */ false);
|
| +
|
| + // Regression test for b/31521252, in which a crash would happen here.
|
| + AdvanceHandshakeWithFakeClient();
|
| + EXPECT_FALSE(server_stream()->encryption_established());
|
| + EXPECT_FALSE(server_stream()->handshake_confirmed());
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace test
|
|
|