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 c81c6b7fcefae84ccea53c055ddcdaddcb3f6bf2..b839536d928604390a9f9cc2307c0f5faa16d368 100644 |
--- a/net/quic/core/quic_crypto_client_stream_test.cc |
+++ b/net/quic/core/quic_crypto_client_stream_test.cc |
@@ -10,7 +10,7 @@ |
#include "net/quic/core/crypto/quic_decrypter.h" |
#include "net/quic/core/crypto/quic_encrypter.h" |
#include "net/quic/core/quic_flags.h" |
-#include "net/quic/core/quic_protocol.h" |
+#include "net/quic/core/quic_packets.h" |
#include "net/quic/core/quic_server_id.h" |
#include "net/quic/core/quic_utils.h" |
#include "net/quic/test_tools/crypto_test_utils.h" |
@@ -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_, |