Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: net/quic/core/quic_crypto_server_stream_test.cc

Issue 2397513002: Conversion of a QUIC method to an async signature and resulting fallout. No functional change inten… (Closed)
Patch Set: Add NET_EXPORT_PRIVATE Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_crypto_server_stream.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/quic/core/quic_crypto_server_stream.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698