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

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

Issue 2538923003: Write a regression test demonstrating that a QuicCryptoClientStream can receive and use a server co… (Closed)
Patch Set: Created 4 years 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_client_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_crypto_client_stream_test.cc
diff --git a/net/quic/core/quic_crypto_client_stream_test.cc b/net/quic/core/quic_crypto_client_stream_test.cc
index b43884b9cfdc61143e7cf39f3acc3f7f83ac4d68..b839536d928604390a9f9cc2307c0f5faa16d368 100644
--- a/net/quic/core/quic_crypto_client_stream_test.cc
+++ b/net/quic/core/quic_crypto_client_stream_test.cc
@@ -234,6 +234,41 @@ TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdate) {
QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
}
+TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateWithCert) {
+ // Test that the crypto client stream can receive and use server config
+ // updates with certificates after the connection has been established.
+ CompleteCryptoHandshake();
+
+ // Build a server config update message with certificates
+ QuicCryptoServerConfig crypto_config(
+ QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance(),
+ CryptoTestUtils::ProofSourceForTesting());
+ CryptoTestUtils::FakeServerOptions options;
+ CryptoTestUtils::SetupCryptoServerConfigForTest(
+ connection_->clock(), QuicRandom::GetInstance(), &crypto_config, options);
+ SourceAddressTokens tokens;
+ QuicCompressedCertsCache cache(1);
+ CachedNetworkParameters network_params;
+ CryptoHandshakeMessage server_config_update;
+ EXPECT_TRUE(crypto_config.BuildServerConfigUpdateMessage(
+ session_->connection()->version(), stream()->chlo_hash(), tokens,
+ QuicIpAddress::Loopback6(), QuicIpAddress::Loopback6(),
+ connection_->clock(), QuicRandom::GetInstance(), &cache,
+ stream()->crypto_negotiated_params(), &network_params, QuicTagVector(),
+ &server_config_update));
+
+ std::unique_ptr<QuicData> data(
+ CryptoFramer::ConstructHandshakeMessage(server_config_update));
+ stream()->OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false,
+ /*offset=*/0, data->AsStringPiece()));
+
+ // Recreate connection with the new config and verify a 0-RTT attempt.
+ CreateConnection();
+
+ stream()->CryptoConnect();
+ EXPECT_TRUE(session_->IsEncryptionEstablished());
+}
+
TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateBeforeHandshake) {
EXPECT_CALL(
*connection_,
« no previous file with comments | « net/quic/core/quic_crypto_client_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698