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

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

Issue 2541163005: [m56 merge] Make QuicCryptoClientConfig only cache server configs for 1 week. (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/crypto/quic_crypto_client_config.cc ('k') | net/quic/core/quic_time.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 77423ba700f63d48c147b4dc51246fe405f13da1..cd8f332aba104c43e4ceec316bbb35507df23499 100644
--- a/net/quic/core/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -6,6 +6,7 @@
#include "net/quic/core/crypto/proof_verifier.h"
#include "net/quic/core/quic_server_id.h"
+#include "net/quic/core/quic_time.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/mock_random.h"
#include "net/quic/test_tools/quic_test_utils.h"
@@ -477,6 +478,31 @@ TEST(QuicCryptoClientConfigTest, ProcessReject) {
EXPECT_FALSE(cached.has_server_nonce());
}
+TEST(QuicCryptoClientConfigTest, ProcessRejectWithLongTTL) {
+ CryptoHandshakeMessage rej;
+ CryptoTestUtils::FillInDummyReject(&rej, /* stateless */ false);
+ QuicTime::Delta one_week = QuicTime::Delta::FromSeconds(kNumSecondsPerWeek);
+ int64_t long_ttl = 3 * one_week.ToSeconds();
+ rej.SetValue(kSTTL, long_ttl);
+
+ // Now process the rejection.
+ QuicCryptoClientConfig::CachedState cached;
+ 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));
+ cached.SetProofValid();
+ EXPECT_FALSE(cached.IsComplete(QuicWallTime::FromUNIXSeconds(long_ttl)));
+ EXPECT_FALSE(
+ cached.IsComplete(QuicWallTime::FromUNIXSeconds(one_week.ToSeconds())));
+ EXPECT_TRUE(cached.IsComplete(
+ QuicWallTime::FromUNIXSeconds(one_week.ToSeconds() - 1)));
+}
+
TEST(QuicCryptoClientConfigTest, ProcessStatelessReject) {
// Create a dummy reject message and mark it as stateless.
CryptoHandshakeMessage rej;
« no previous file with comments | « net/quic/core/crypto/quic_crypto_client_config.cc ('k') | net/quic/core/quic_time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698