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 |