| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/crypto/quic_crypto_client_config.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/proof_verifier.h" | 7 #include "net/quic/crypto/proof_verifier.h" |
| 8 #include "net/quic/quic_server_id.h" | 8 #include "net/quic/quic_server_id.h" |
| 9 #include "net/quic/test_tools/mock_random.h" | 9 #include "net/quic/test_tools/mock_random.h" |
| 10 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 TEST(QuicCryptoClientConfigTest, CachedState_GenerationCounter) { | 41 TEST(QuicCryptoClientConfigTest, CachedState_GenerationCounter) { |
| 42 QuicCryptoClientConfig::CachedState state; | 42 QuicCryptoClientConfig::CachedState state; |
| 43 EXPECT_EQ(0u, state.generation_counter()); | 43 EXPECT_EQ(0u, state.generation_counter()); |
| 44 state.SetProofInvalid(); | 44 state.SetProofInvalid(); |
| 45 EXPECT_EQ(1u, state.generation_counter()); | 45 EXPECT_EQ(1u, state.generation_counter()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 TEST(QuicCryptoClientConfigTest, CachedState_SetProofVerifyDetails) { | 48 TEST(QuicCryptoClientConfigTest, CachedState_SetProofVerifyDetails) { |
| 49 QuicCryptoClientConfig::CachedState state; | 49 QuicCryptoClientConfig::CachedState state; |
| 50 EXPECT_TRUE(state.proof_verify_details() == NULL); | 50 EXPECT_TRUE(state.proof_verify_details() == nullptr); |
| 51 ProofVerifyDetails* details = new TestProofVerifyDetails; | 51 ProofVerifyDetails* details = new TestProofVerifyDetails; |
| 52 state.SetProofVerifyDetails(details); | 52 state.SetProofVerifyDetails(details); |
| 53 EXPECT_EQ(details, state.proof_verify_details()); | 53 EXPECT_EQ(details, state.proof_verify_details()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TEST(QuicCryptoClientConfigTest, CachedState_InitializeFrom) { | 56 TEST(QuicCryptoClientConfigTest, CachedState_InitializeFrom) { |
| 57 QuicCryptoClientConfig::CachedState state; | 57 QuicCryptoClientConfig::CachedState state; |
| 58 QuicCryptoClientConfig::CachedState other; | 58 QuicCryptoClientConfig::CachedState other; |
| 59 state.set_source_address_token("TOKEN"); | 59 state.set_source_address_token("TOKEN"); |
| 60 // TODO(rch): Populate other fields of |state|. | 60 // TODO(rch): Populate other fields of |state|. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 string error_details; | 125 string error_details; |
| 126 MockRandom rand; | 126 MockRandom rand; |
| 127 CryptoHandshakeMessage chlo; | 127 CryptoHandshakeMessage chlo; |
| 128 QuicServerId server_id("www.google.com", 80, false, PRIVACY_MODE_DISABLED); | 128 QuicServerId server_id("www.google.com", 80, false, PRIVACY_MODE_DISABLED); |
| 129 config.FillClientHello(server_id, | 129 config.FillClientHello(server_id, |
| 130 kConnectionId, | 130 kConnectionId, |
| 131 QuicVersionMax(), | 131 QuicVersionMax(), |
| 132 &state, | 132 &state, |
| 133 QuicWallTime::Zero(), | 133 QuicWallTime::Zero(), |
| 134 &rand, | 134 &rand, |
| 135 NULL, // channel_id_key | 135 nullptr, // channel_id_key |
| 136 ¶ms, | 136 ¶ms, |
| 137 &chlo, | 137 &chlo, |
| 138 &error_details); | 138 &error_details); |
| 139 | 139 |
| 140 // Verify that certain QuicTags have been set correctly in the CHLO. | 140 // Verify that certain QuicTags have been set correctly in the CHLO. |
| 141 QuicTag cver; | 141 QuicTag cver; |
| 142 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kVER, &cver)); | 142 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kVER, &cver)); |
| 143 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); | 143 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); |
| 144 } | 144 } |
| 145 | 145 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 EXPECT_EQ(state, cleared_cache); | 262 EXPECT_EQ(state, cleared_cache); |
| 263 EXPECT_FALSE(cleared_cache->proof_valid()); | 263 EXPECT_FALSE(cleared_cache->proof_valid()); |
| 264 EXPECT_TRUE(cleared_cache->server_config().empty()); | 264 EXPECT_TRUE(cleared_cache->server_config().empty()); |
| 265 EXPECT_TRUE(cleared_cache->certs().empty()); | 265 EXPECT_TRUE(cleared_cache->certs().empty()); |
| 266 EXPECT_TRUE(cleared_cache->signature().empty()); | 266 EXPECT_TRUE(cleared_cache->signature().empty()); |
| 267 EXPECT_EQ(2u, cleared_cache->generation_counter()); | 267 EXPECT_EQ(2u, cleared_cache->generation_counter()); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace test | 270 } // namespace test |
| 271 } // namespace net | 271 } // namespace net |
| OLD | NEW |