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

Unified Diff: net/quic/core/crypto/crypto_server_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/crypto_handshake.h ('k') | net/quic/core/crypto/quic_crypto_client_config.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/crypto_server_test.cc
diff --git a/net/quic/core/crypto/crypto_server_test.cc b/net/quic/core/crypto/crypto_server_test.cc
index 5952cc6d452a4c49cc5bf110c4dd5f97ac158252..2d567b20b8920e4badc30056d0f089d4c4d8f3a1 100644
--- a/net/quic/core/crypto/crypto_server_test.cc
+++ b/net/quic/core/crypto/crypto_server_test.cc
@@ -112,6 +112,8 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
CryptoTestUtils::ProofSourceForTesting()),
compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
+ params_(new QuicCryptoNegotiatedParameters),
+ crypto_proof_(new QuicCryptoProof),
chlo_packet_size_(kDefaultMaxPacketSize) {
supported_versions_ = GetParam().supported_versions;
config_.set_enable_serving_sct(true);
@@ -182,8 +184,8 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
ASSERT_TRUE(server_config_->GetStringPiece(kSCID, &scid));
scid_hex_ = "#" + QuicUtils::HexEncode(scid);
- crypto_proof_ = QuicCryptoProof();
- DCHECK(crypto_proof_.chain.get() == nullptr);
+ crypto_proof_ = scoped_refptr<QuicCryptoProof>(new QuicCryptoProof());
+ DCHECK(crypto_proof_->chain.get() == nullptr);
}
// Helper used to accept the result of ValidateClientHello and pass
@@ -247,7 +249,7 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
IPAddress server_ip;
config_.ValidateClientHello(
message, client_address_.address(), server_ip,
- supported_versions_.front(), &clock_, &crypto_proof_,
+ supported_versions_.front(), &clock_, crypto_proof_,
std::unique_ptr<ValidateCallback>(
new ValidateCallback(this, true, "", &called)));
EXPECT_TRUE(called);
@@ -266,7 +268,7 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
IPAddress server_ip;
config_.ValidateClientHello(
message, client_address_.address(), server_ip,
- supported_versions_.front(), &clock_, &crypto_proof_,
+ supported_versions_.front(), &clock_, crypto_proof_,
std::unique_ptr<ValidateCallback>(
new ValidateCallback(this, false, error_substr, called)));
}
@@ -327,7 +329,7 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
result, /*reject_only=*/false, /*connection_id=*/1, server_ip,
client_address_, supported_versions_.front(), supported_versions_,
use_stateless_rejects_, server_designated_connection_id, &clock_, rand_,
- &compressed_certs_cache_, &params_, &crypto_proof_,
+ &compressed_certs_cache_, params_, crypto_proof_,
/*total_framing_overhead=*/50, chlo_packet_size_,
std::unique_ptr<ProcessCallback>(new ProcessCallback(
result, should_succeed, error_substr, &called, &out_)));
@@ -407,8 +409,8 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
QuicCryptoServerConfig config_;
QuicCompressedCertsCache compressed_certs_cache_;
QuicCryptoServerConfig::ConfigOptions config_options_;
- QuicCryptoNegotiatedParameters params_;
- QuicCryptoProof crypto_proof_;
+ scoped_refptr<QuicCryptoNegotiatedParameters> params_;
+ scoped_refptr<QuicCryptoProof> crypto_proof_;
CryptoHandshakeMessage out_;
uint8_t orbit_[kOrbitSize];
bool use_stateless_rejects_;
@@ -1217,8 +1219,8 @@ TEST_P(AsyncStrikeServerVerificationTest, AsyncReplayProtection) {
IPAddress server_ip;
config_.ValidateClientHello(
msg, client_address_.address(), server_ip, client_version_, &clock_,
- &crypto_proof_, std::unique_ptr<ValidateCallback>(
- new ValidateCallback(this, true, "", &called)));
+ crypto_proof_, std::unique_ptr<ValidateCallback>(
+ new ValidateCallback(this, true, "", &called)));
// The verification request was queued.
ASSERT_FALSE(called);
EXPECT_EQ(0u, out_.tag());
@@ -1234,8 +1236,8 @@ TEST_P(AsyncStrikeServerVerificationTest, AsyncReplayProtection) {
// Rejected if replayed.
config_.ValidateClientHello(
msg, client_address_.address(), server_ip, client_version_, &clock_,
- &crypto_proof_, std::unique_ptr<ValidateCallback>(
- new ValidateCallback(this, true, "", &called)));
+ crypto_proof_, std::unique_ptr<ValidateCallback>(
+ new ValidateCallback(this, true, "", &called)));
// The verification request was queued.
ASSERT_FALSE(called);
EXPECT_EQ(1, strike_register_client_->PendingVerifications());
« no previous file with comments | « net/quic/core/crypto/crypto_handshake.h ('k') | net/quic/core/crypto/quic_crypto_client_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698