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

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: Fixed wtc's comments in Patch Set 2 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..92b1b0eb3374d055da8f737dc6270802dadcf89e 100644
--- a/net/quic/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/crypto/quic_crypto_client_config_test.cc
@@ -229,43 +229,35 @@ 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";
state->SetProof(certs, "signature");
state->set_source_address_token("TOKEN");
state->SetProofValid();
+ EXPECT_EQ(1u, state->generation_counter());
// Verify LookupOrCreate returns the same data.
- QuicServerId other_server_id("www.google.com", 80, false,
- PRIVACY_MODE_DISABLED);
+ QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(server_id);
- QuicCryptoClientConfig::CachedState* other =
- config.LookupOrCreate(other_server_id);
-
- EXPECT_TRUE(other->proof_valid());
- EXPECT_EQ(state->server_config(), other->server_config());
- EXPECT_EQ(state->signature(), other->signature());
- EXPECT_EQ(state->certs(), other->certs());
- EXPECT_EQ(state->source_address_token(), other->source_address_token());
+ EXPECT_EQ(state, other);
EXPECT_EQ(1u, other->generation_counter());
- // 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