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

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

Issue 255783002: QUIC - Minor clean up of QUIC Server Info memory cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor cleanup Created 6 years, 8 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/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_stream_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/quic_crypto_client_config_test.cc
diff --git a/net/quic/crypto/quic_crypto_client_config_test.cc b/net/quic/crypto/quic_crypto_client_config_test.cc
index 16e14dd224c45cab427e369ba1eedfd22ad4147e..af27e6f441e72e3cf0bf2afea479984f1a948c80 100644
--- a/net/quic/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/crypto/quic_crypto_client_config_test.cc
@@ -163,17 +163,15 @@ TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
TEST(QuicCryptoClientConfigTest, InitializeFrom) {
QuicCryptoClientConfig config;
- QuicServerId canonical_server_id("www.google.com", 80, false,
wtc 2014/04/25 18:17:28 Please undo the changes to this unit test. In this
ramant (doing other things) 2014/04/25 18:55:30 Done.
- PRIVACY_MODE_DISABLED);
- QuicCryptoClientConfig::CachedState* state =
- config.LookupOrCreate(canonical_server_id);
+ QuicServerId server_id("www.google.com", 80, false, PRIVACY_MODE_DISABLED);
+ QuicCryptoClientConfig::CachedState* state = config.LookupOrCreate(server_id);
// TODO(rch): Populate other fields of |state|.
state->set_source_address_token("TOKEN");
state->SetProofValid();
QuicServerId other_server_id("mail.google.com", 80, false,
PRIVACY_MODE_DISABLED);
- config.InitializeFrom(other_server_id, canonical_server_id, &config);
+ config.InitializeFrom(other_server_id, server_id, &config);
QuicCryptoClientConfig::CachedState* other =
config.LookupOrCreate(other_server_id);
@@ -229,10 +227,8 @@ TEST(QuicCryptoClientConfigTest, CanonicalNotUsedIfNotValid) {
TEST(QuicCryptoClientConfigTest, ClearCachedStates) {
QuicCryptoClientConfig config;
- QuicServerId canonical_server_id("www.google.com", 80, false,
- PRIVACY_MODE_DISABLED);
- QuicCryptoClientConfig::CachedState* state =
- config.LookupOrCreate(canonical_server_id);
+ QuicServerId server_id("www.google.com", 80, false, PRIVACY_MODE_DISABLED);
+ QuicCryptoClientConfig::CachedState* state = config.LookupOrCreate(server_id);
// TODO(rch): Populate other fields of |state|.
vector<string> certs(1);
certs[0] = "Hello Cert";
@@ -241,12 +237,9 @@ TEST(QuicCryptoClientConfigTest, ClearCachedStates) {
state->SetProofValid();
// Verify LookupOrCreate returns the same data.
- QuicServerId other_server_id("www.google.com", 80, false,
- PRIVACY_MODE_DISABLED);
-
- QuicCryptoClientConfig::CachedState* other =
- config.LookupOrCreate(other_server_id);
+ QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(server_id);
+ EXPECT_EQ(state, other);
EXPECT_TRUE(other->proof_valid());
EXPECT_EQ(state->server_config(), other->server_config());
EXPECT_EQ(state->signature(), other->signature());
@@ -254,18 +247,19 @@ TEST(QuicCryptoClientConfigTest, ClearCachedStates) {
EXPECT_EQ(state->source_address_token(), other->source_address_token());
EXPECT_EQ(1u, other->generation_counter());
wtc 2014/04/25 18:17:28 Once we verify |other| and |state| point to the sa
ramant (doing other things) 2014/04/25 18:55:30 Done.
- // Clear the cached state.
+ // Clear the cached states.
config.ClearCachedStates();
// Verify LookupOrCreate doesn't have any data.
QuicCryptoClientConfig::CachedState* cleared_cache =
- config.LookupOrCreate(other_server_id);
+ config.LookupOrCreate(server_id);
+ EXPECT_EQ(state, cleared_cache);
EXPECT_FALSE(cleared_cache->proof_valid());
EXPECT_TRUE(cleared_cache->server_config().empty());
EXPECT_TRUE(cleared_cache->certs().empty());
EXPECT_TRUE(cleared_cache->signature().empty());
- EXPECT_LT(1u, cleared_cache->generation_counter());
+ EXPECT_EQ(2u, cleared_cache->generation_counter());
}
} // namespace test
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_stream_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698