Change CryptoServerConfigForTesting to return a unique_ptr instead of an object because CryptoServerConfigForTesting has now copy constructor. gfe-relnote: n/a - Test only PiperOrigin-RevId: 280245335 Change-Id: Ie66e8c170211f291e1ff146c6b156dfd6b7685e9
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc index 200024f..9ab462d 100644 --- a/quic/core/http/quic_spdy_client_session_test.cc +++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -166,11 +166,11 @@ config.SetMaxIncomingBidirectionalStreamsToSend( server_max_incoming_streams); } - QuicCryptoServerConfig crypto_config = + std::unique_ptr<QuicCryptoServerConfig> crypto_config = crypto_test_utils::CryptoServerConfigForTesting(); crypto_test_utils::HandshakeWithFakeServer( - &config, &crypto_config, &helper_, &alarm_factory_, connection_, stream, - AlpnForVersion(connection_->version())); + &config, crypto_config.get(), &helper_, &alarm_factory_, connection_, + stream, AlpnForVersion(connection_->version())); } QuicCryptoClientConfig crypto_config_;
diff --git a/quic/core/quic_crypto_client_stream_test.cc b/quic/core/quic_crypto_client_stream_test.cc index 4fd338f..9e957e4 100644 --- a/quic/core/quic_crypto_client_stream_test.cc +++ b/quic/core/quic_crypto_client_stream_test.cc
@@ -82,7 +82,7 @@ stream()->CryptoConnect(); QuicConfig config; crypto_test_utils::HandshakeWithFakeServer( - &config, &server_crypto_config_, &server_helper_, &alarm_factory_, + &config, server_crypto_config_.get(), &server_helper_, &alarm_factory_, connection_, stream(), AlpnForVersion(connection_->version())); } @@ -99,7 +99,7 @@ QuicServerId server_id_; CryptoHandshakeMessage message_; QuicCryptoClientConfig crypto_config_; - QuicCryptoServerConfig server_crypto_config_; + std::unique_ptr<QuicCryptoServerConfig> server_crypto_config_; }; TEST_F(QuicCryptoClientStreamTest, NotInitiallyConected) { @@ -133,7 +133,7 @@ stream()->CryptoConnect(); QuicConfig config; crypto_test_utils::HandshakeWithFakeServer( - &config, &server_crypto_config_, &server_helper_, &alarm_factory_, + &config, server_crypto_config_.get(), &server_helper_, &alarm_factory_, connection_, stream(), AlpnForVersion(connection_->version())); EXPECT_EQ(PROTOCOL_TLS1_3, stream()->handshake_protocol()); EXPECT_TRUE(stream()->encryption_established()); @@ -143,7 +143,7 @@ TEST_F(QuicCryptoClientStreamTest, TlsResumption) { UseTlsHandshake(); // Enable resumption on the server: - SSL_CTX_clear_options(server_crypto_config_.ssl_ctx(), SSL_OP_NO_TICKET); + SSL_CTX_clear_options(server_crypto_config_->ssl_ctx(), SSL_OP_NO_TICKET); CreateConnection(); // Finish establishing the first connection:
diff --git a/quic/quic_transport/quic_transport_client_session_test.cc b/quic/quic_transport/quic_transport_client_session_test.cc index 91aecdb..53213a4 100644 --- a/quic/quic_transport/quic_transport_client_session_test.cc +++ b/quic/quic_transport/quic_transport_client_session_test.cc
@@ -76,11 +76,11 @@ void Connect() { session_->CryptoConnect(); QuicConfig server_config = DefaultQuicConfig(); - QuicCryptoServerConfig crypto_config = - crypto_test_utils::CryptoServerConfigForTesting(); + std::unique_ptr<QuicCryptoServerConfig> crypto_config( + crypto_test_utils::CryptoServerConfigForTesting()); crypto_test_utils::HandshakeWithFakeServer( - &server_config, &crypto_config, &helper_, &alarm_factory_, &connection_, - crypto_stream_, QuicTransportAlpn()); + &server_config, crypto_config.get(), &helper_, &alarm_factory_, + &connection_, crypto_stream_, QuicTransportAlpn()); } MockAlarmFactory alarm_factory_;
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc index e2dc56c..732399c 100644 --- a/quic/test_tools/crypto_test_utils.cc +++ b/quic/test_tools/crypto_test_utils.cc
@@ -209,8 +209,8 @@ } // namespace -QuicCryptoServerConfig CryptoServerConfigForTesting() { - return QuicCryptoServerConfig( +std::unique_ptr<QuicCryptoServerConfig> CryptoServerConfigForTesting() { + return std::make_unique<QuicCryptoServerConfig>( QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance(), ProofSourceForTesting(), KeyExchangeSource::Default()); }
diff --git a/quic/test_tools/crypto_test_utils.h b/quic/test_tools/crypto_test_utils.h index 2071614..327eb67 100644 --- a/quic/test_tools/crypto_test_utils.h +++ b/quic/test_tools/crypto_test_utils.h
@@ -66,7 +66,7 @@ // Returns a QuicCryptoServerConfig that is in a reasonable configuration to // pass into HandshakeWithFakeServer. -QuicCryptoServerConfig CryptoServerConfigForTesting(); +std::unique_ptr<QuicCryptoServerConfig> CryptoServerConfigForTesting(); // returns: the number of client hellos that the client sent. int HandshakeWithFakeServer(QuicConfig* server_quic_config,