| 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/crypto_test_utils.h" | 9 #include "net/quic/test_tools/crypto_test_utils.h" |
| 10 #include "net/quic/test_tools/mock_random.h" | 10 #include "net/quic/test_tools/mock_random.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 TEST(QuicCryptoClientConfigTest, FillClientHello) { | 236 TEST(QuicCryptoClientConfigTest, FillClientHello) { |
| 237 QuicCryptoClientConfig::CachedState state; | 237 QuicCryptoClientConfig::CachedState state; |
| 238 QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting()); | 238 QuicCryptoClientConfig config(CryptoTestUtils::ProofVerifierForTesting()); |
| 239 QuicCryptoNegotiatedParameters params; | 239 QuicCryptoNegotiatedParameters params; |
| 240 QuicConnectionId kConnectionId = 1234; | 240 QuicConnectionId kConnectionId = 1234; |
| 241 string error_details; | 241 string error_details; |
| 242 MockRandom rand; | 242 MockRandom rand; |
| 243 CryptoHandshakeMessage chlo; | 243 CryptoHandshakeMessage chlo; |
| 244 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); | 244 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); |
| 245 config.FillClientHello(server_id, kConnectionId, QuicVersionMax(), &state, | 245 config.FillClientHello(server_id, kConnectionId, QuicVersionMax(), |
| 246 QuicWallTime::Zero(), &rand, | 246 QuicVersionMax(), &state, QuicWallTime::Zero(), &rand, |
| 247 nullptr, // channel_id_key | 247 nullptr, // channel_id_key |
| 248 ¶ms, &chlo, &error_details); | 248 ¶ms, &chlo, &error_details); |
| 249 | 249 |
| 250 // Verify that certain QuicTags have been set correctly in the CHLO. | 250 // Verify that certain QuicTags have been set correctly in the CHLO. |
| 251 QuicTag cver; | 251 QuicTag cver; |
| 252 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kVER, &cver)); | 252 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kVER, &cver)); |
| 253 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); | 253 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); |
| 254 } | 254 } |
| 255 | 255 |
| 256 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { | 256 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 QuicCryptoNegotiatedParameters out_params; | 474 QuicCryptoNegotiatedParameters out_params; |
| 475 string error_details; | 475 string error_details; |
| 476 EXPECT_EQ(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, | 476 EXPECT_EQ(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, |
| 477 config.ProcessServerHello(msg, 0, version, supported_versions, | 477 config.ProcessServerHello(msg, 0, version, supported_versions, |
| 478 &cached, &out_params, &error_details)); | 478 &cached, &out_params, &error_details)); |
| 479 EXPECT_EQ("server hello missing server nonce", error_details); | 479 EXPECT_EQ("server hello missing server nonce", error_details); |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace test | 482 } // namespace test |
| 483 } // namespace net | 483 } // namespace net |
| OLD | NEW |