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

Unified Diff: net/quic/core/crypto/quic_crypto_client_config_test.cc

Issue 2453113002: Fix object-lifetime issues in async GetProof callpaths (Closed)
Patch Set: Updated patchset dependency 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/crypto/quic_crypto_client_config.cc ('k') | net/quic/core/crypto/quic_crypto_server_config.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/quic_crypto_client_config_test.cc
diff --git a/net/quic/core/crypto/quic_crypto_client_config_test.cc b/net/quic/core/crypto/quic_crypto_client_config_test.cc
index 072f8657abee9baf6d0789c98ef66bd24a52cfca..0de1e1cf4eea47a8d7fd686803b6c854d8c69707 100644
--- a/net/quic/core/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -170,12 +170,13 @@ TEST(QuicCryptoClientConfigTest, CachedState_InitializeFrom) {
TEST(QuicCryptoClientConfigTest, InchoateChlo) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
- QuicCryptoNegotiatedParameters params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> params(
+ new QuicCryptoNegotiatedParameters);
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
MockRandom rand;
config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
- /* demand_x509_proof= */ true, &params, &msg);
+ /* demand_x509_proof= */ true, params, &msg);
QuicTag cver;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver));
@@ -196,12 +197,13 @@ TEST(QuicCryptoClientConfigTest, PreferAesGcm) {
TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
- QuicCryptoNegotiatedParameters params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> params(
+ new QuicCryptoNegotiatedParameters);
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
MockRandom rand;
config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
- /* demand_x509_proof= */ true, &params, &msg);
+ /* demand_x509_proof= */ true, params, &msg);
QuicTag pdmd;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
@@ -224,12 +226,13 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCIDNoEXPY) {
&details);
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
- QuicCryptoNegotiatedParameters params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> params(
+ new QuicCryptoNegotiatedParameters);
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
MockRandom rand;
config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
- /* demand_x509_proof= */ true, &params, &msg);
+ /* demand_x509_proof= */ true, params, &msg);
StringPiece scid;
EXPECT_TRUE(msg.GetStringPiece(kSCID, &scid));
@@ -249,12 +252,13 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCID) {
QuicWallTime::FromUNIXSeconds(0), &details);
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
- QuicCryptoNegotiatedParameters params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> params(
+ new QuicCryptoNegotiatedParameters);
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
MockRandom rand;
config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
- /* demand_x509_proof= */ true, &params, &msg);
+ /* demand_x509_proof= */ true, params, &msg);
StringPiece scid;
EXPECT_TRUE(msg.GetStringPiece(kSCID, &scid));
@@ -264,7 +268,8 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCID) {
TEST(QuicCryptoClientConfigTest, FillClientHello) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
- QuicCryptoNegotiatedParameters params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> params(
+ new QuicCryptoNegotiatedParameters);
QuicConnectionId kConnectionId = 1234;
string error_details;
MockRandom rand;
@@ -273,7 +278,7 @@ TEST(QuicCryptoClientConfigTest, FillClientHello) {
config.FillClientHello(server_id, kConnectionId, QuicVersionMax(),
QuicVersionMax(), &state, QuicWallTime::Zero(), &rand,
nullptr, // channel_id_key
- &params, &chlo, &error_details);
+ params, &chlo, &error_details);
// Verify that certain QuicTags have been set correctly in the CHLO.
QuicTag cver;
@@ -297,12 +302,13 @@ TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
msg.SetVector(kVER, supported_version_tags);
QuicCryptoClientConfig::CachedState cached;
- QuicCryptoNegotiatedParameters out_params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> out_params(
+ new QuicCryptoNegotiatedParameters);
string error;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH,
config.ProcessServerHello(msg, 0, supported_versions.front(),
- supported_versions, &cached, &out_params,
+ supported_versions, &cached, out_params,
&error));
EXPECT_EQ("Downgrade attack detected", error);
}
@@ -460,13 +466,14 @@ TEST(QuicCryptoClientConfigTest, ProcessReject) {
// Now process the rejection.
QuicCryptoClientConfig::CachedState cached;
- QuicCryptoNegotiatedParameters out_params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> out_params(
+ new QuicCryptoNegotiatedParameters);
string error;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
EXPECT_EQ(QUIC_NO_ERROR,
config.ProcessRejection(rej, QuicWallTime::FromUNIXSeconds(0),
AllSupportedVersions().front(), "", &cached,
- &out_params, &error));
+ out_params, &error));
EXPECT_FALSE(cached.has_server_designated_connection_id());
EXPECT_FALSE(cached.has_server_nonce());
}
@@ -482,13 +489,14 @@ TEST(QuicCryptoClientConfigTest, ProcessStatelessReject) {
// Now process the rejection.
QuicCryptoClientConfig::CachedState cached;
- QuicCryptoNegotiatedParameters out_params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> out_params(
+ new QuicCryptoNegotiatedParameters);
string error;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
EXPECT_EQ(QUIC_NO_ERROR,
config.ProcessRejection(rej, QuicWallTime::FromUNIXSeconds(0),
AllSupportedVersions().front(), "", &cached,
- &out_params, &error));
+ out_params, &error));
EXPECT_TRUE(cached.has_server_designated_connection_id());
EXPECT_EQ(kConnectionId, cached.GetNextServerDesignatedConnectionId());
EXPECT_EQ(server_nonce, cached.GetNextServerNonce());
@@ -502,13 +510,14 @@ TEST(QuicCryptoClientConfigTest, BadlyFormattedStatelessReject) {
// Now process the rejection.
QuicCryptoClientConfig::CachedState cached;
- QuicCryptoNegotiatedParameters out_params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> out_params(
+ new QuicCryptoNegotiatedParameters);
string error;
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND,
config.ProcessRejection(rej, QuicWallTime::FromUNIXSeconds(0),
AllSupportedVersions().front(), "", &cached,
- &out_params, &error));
+ out_params, &error));
EXPECT_FALSE(cached.has_server_designated_connection_id());
EXPECT_EQ("Missing kRCID", error);
}
@@ -527,11 +536,12 @@ TEST(QuicCryptoClientConfigTest, ServerNonceinSHLO) {
QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting());
QuicCryptoClientConfig::CachedState cached;
- QuicCryptoNegotiatedParameters out_params;
+ scoped_refptr<QuicCryptoNegotiatedParameters> out_params(
+ new QuicCryptoNegotiatedParameters);
string error_details;
EXPECT_EQ(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER,
config.ProcessServerHello(msg, 0, version, supported_versions,
- &cached, &out_params, &error_details));
+ &cached, out_params, &error_details));
EXPECT_EQ("server hello missing server nonce", error_details);
}
« no previous file with comments | « net/quic/core/crypto/quic_crypto_client_config.cc ('k') | net/quic/core/crypto/quic_crypto_server_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698