| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test_tools/crypto_test_utils.h" | 5 #include "net/quic/test_tools/crypto_test_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "crypto/openssl_util.h" | 10 #include "crypto/openssl_util.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 new PacketSavingConnection(helper, alarm_factory, Perspective::IS_SERVER, | 394 new PacketSavingConnection(helper, alarm_factory, Perspective::IS_SERVER, |
| 395 client_conn->supported_versions()); | 395 client_conn->supported_versions()); |
| 396 | 396 |
| 397 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, | 397 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, |
| 398 QuicRandom::GetInstance(), | 398 QuicRandom::GetInstance(), |
| 399 ProofSourceForTesting()); | 399 ProofSourceForTesting()); |
| 400 QuicCompressedCertsCache compressed_certs_cache( | 400 QuicCompressedCertsCache compressed_certs_cache( |
| 401 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize); | 401 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize); |
| 402 SetupCryptoServerConfigForTest(server_conn->clock(), | 402 SetupCryptoServerConfigForTest(server_conn->clock(), |
| 403 server_conn->random_generator(), | 403 server_conn->random_generator(), |
| 404 server_quic_config, &crypto_config, options); | 404 &crypto_config, options); |
| 405 | 405 |
| 406 TestQuicSpdyServerSession server_session(server_conn, *server_quic_config, | 406 TestQuicSpdyServerSession server_session(server_conn, *server_quic_config, |
| 407 &crypto_config, | 407 &crypto_config, |
| 408 &compressed_certs_cache); | 408 &compressed_certs_cache); |
| 409 | 409 |
| 410 // The client's handshake must have been started already. | 410 // The client's handshake must have been started already. |
| 411 CHECK_NE(0u, client_conn->encrypted_packets_.size()); | 411 CHECK_NE(0u, client_conn->encrypted_packets_.size()); |
| 412 | 412 |
| 413 CommunicateHandshakeMessages(client_conn, client, server_conn, | 413 CommunicateHandshakeMessages(client_conn, client, server_conn, |
| 414 server_session.GetCryptoStream()); | 414 server_session.GetCryptoStream()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 | 474 |
| 475 return client_session.GetCryptoStream()->num_sent_client_hellos(); | 475 return client_session.GetCryptoStream()->num_sent_client_hellos(); |
| 476 } | 476 } |
| 477 | 477 |
| 478 // static | 478 // static |
| 479 void CryptoTestUtils::SetupCryptoServerConfigForTest( | 479 void CryptoTestUtils::SetupCryptoServerConfigForTest( |
| 480 const QuicClock* clock, | 480 const QuicClock* clock, |
| 481 QuicRandom* rand, | 481 QuicRandom* rand, |
| 482 QuicConfig* config, | |
| 483 QuicCryptoServerConfig* crypto_config, | 482 QuicCryptoServerConfig* crypto_config, |
| 484 const FakeServerOptions& fake_options) { | 483 const FakeServerOptions& fake_options) { |
| 485 QuicCryptoServerConfig::ConfigOptions options; | 484 QuicCryptoServerConfig::ConfigOptions options; |
| 486 options.channel_id_enabled = true; | 485 options.channel_id_enabled = true; |
| 487 options.token_binding_params = fake_options.token_binding_params; | 486 options.token_binding_params = fake_options.token_binding_params; |
| 488 std::unique_ptr<CryptoHandshakeMessage> scfg( | 487 std::unique_ptr<CryptoHandshakeMessage> scfg( |
| 489 crypto_config->AddDefaultConfig(rand, clock, options)); | 488 crypto_config->AddDefaultConfig(rand, clock, options)); |
| 490 } | 489 } |
| 491 | 490 |
| 492 // static | 491 // static |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 // Pass a inchoate CHLO. | 1011 // Pass a inchoate CHLO. |
| 1013 FullChloGenerator generator(crypto_config, server_ip, client_addr, clock, | 1012 FullChloGenerator generator(crypto_config, server_ip, client_addr, clock, |
| 1014 proof, compressed_certs_cache, out); | 1013 proof, compressed_certs_cache, out); |
| 1015 crypto_config->ValidateClientHello( | 1014 crypto_config->ValidateClientHello( |
| 1016 inchoate_chlo, client_addr.address(), server_ip, version, clock, proof, | 1015 inchoate_chlo, client_addr.address(), server_ip, version, clock, proof, |
| 1017 generator.GetValidateClientHelloCallback()); | 1016 generator.GetValidateClientHelloCallback()); |
| 1018 } | 1017 } |
| 1019 | 1018 |
| 1020 } // namespace test | 1019 } // namespace test |
| 1021 } // namespace net | 1020 } // namespace net |
| OLD | NEW |