| 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 "net/quic/crypto/channel_id.h" | 7 #include "net/quic/crypto/channel_id.h" |
| 8 #include "net/quic/crypto/common_cert_set.h" | 8 #include "net/quic/crypto/common_cert_set.h" |
| 9 #include "net/quic/crypto/crypto_handshake.h" | 9 #include "net/quic/crypto/crypto_handshake.h" |
| 10 #include "net/quic/crypto/crypto_server_config.h" | 10 #include "net/quic/crypto/crypto_server_config.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // static | 129 // static |
| 130 int CryptoTestUtils::HandshakeWithFakeServer( | 130 int CryptoTestUtils::HandshakeWithFakeServer( |
| 131 PacketSavingConnection* client_conn, | 131 PacketSavingConnection* client_conn, |
| 132 QuicCryptoClientStream* client) { | 132 QuicCryptoClientStream* client) { |
| 133 QuicGuid guid(1); | 133 QuicGuid guid(1); |
| 134 IPAddressNumber ip; | 134 IPAddressNumber ip; |
| 135 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); | 135 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); |
| 136 IPEndPoint addr = IPEndPoint(ip, 1); | 136 IPEndPoint addr = IPEndPoint(ip, 1); |
| 137 PacketSavingConnection* server_conn = | 137 PacketSavingConnection* server_conn = |
| 138 new PacketSavingConnection(guid, addr, true); | 138 new PacketSavingConnection(guid, addr, true); |
| 139 TestSession server_session(server_conn, QuicConfig(), true); | 139 TestSession server_session(server_conn, DefaultQuicConfig(), true); |
| 140 | 140 |
| 141 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, | 141 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, |
| 142 QuicRandom::GetInstance()); | 142 QuicRandom::GetInstance()); |
| 143 SetupCryptoServerConfigForTest( | 143 SetupCryptoServerConfigForTest( |
| 144 server_session.connection()->clock(), | 144 server_session.connection()->clock(), |
| 145 server_session.connection()->random_generator(), | 145 server_session.connection()->random_generator(), |
| 146 server_session.config(), &crypto_config); | 146 server_session.config(), &crypto_config); |
| 147 | 147 |
| 148 QuicCryptoServerStream server(crypto_config, &server_session); | 148 QuicCryptoServerStream server(crypto_config, &server_session); |
| 149 server_session.SetCryptoStream(&server); | 149 server_session.SetCryptoStream(&server); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 162 int CryptoTestUtils::HandshakeWithFakeClient( | 162 int CryptoTestUtils::HandshakeWithFakeClient( |
| 163 PacketSavingConnection* server_conn, | 163 PacketSavingConnection* server_conn, |
| 164 QuicCryptoServerStream* server, | 164 QuicCryptoServerStream* server, |
| 165 const FakeClientOptions& options) { | 165 const FakeClientOptions& options) { |
| 166 QuicGuid guid(1); | 166 QuicGuid guid(1); |
| 167 IPAddressNumber ip; | 167 IPAddressNumber ip; |
| 168 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); | 168 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); |
| 169 IPEndPoint addr = IPEndPoint(ip, 1); | 169 IPEndPoint addr = IPEndPoint(ip, 1); |
| 170 PacketSavingConnection* client_conn = | 170 PacketSavingConnection* client_conn = |
| 171 new PacketSavingConnection(guid, addr, false); | 171 new PacketSavingConnection(guid, addr, false); |
| 172 TestSession client_session(client_conn, QuicConfig(), false); | 172 TestSession client_session(client_conn, DefaultQuicConfig(), false); |
| 173 QuicCryptoClientConfig crypto_config; | 173 QuicCryptoClientConfig crypto_config; |
| 174 | 174 |
| 175 client_session.config()->SetDefaults(); | 175 client_session.config()->SetDefaults(); |
| 176 crypto_config.SetDefaults(); | 176 crypto_config.SetDefaults(); |
| 177 // TODO(rtenneti): Enable testing of ProofVerifier. | 177 // TODO(rtenneti): Enable testing of ProofVerifier. |
| 178 // if (!options.dont_verify_certs) { | 178 // if (!options.dont_verify_certs) { |
| 179 // crypto_config.SetProofVerifier(ProofVerifierForTesting()); | 179 // crypto_config.SetProofVerifier(ProofVerifierForTesting()); |
| 180 // } | 180 // } |
| 181 if (options.channel_id_enabled) { | 181 if (options.channel_id_enabled) { |
| 182 crypto_config.SetChannelIDSigner(ChannelIDSignerForTesting()); | 182 crypto_config.SetChannelIDSigner(ChannelIDSignerForTesting()); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); | 496 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); |
| 497 scoped_ptr<CryptoHandshakeMessage> parsed( | 497 scoped_ptr<CryptoHandshakeMessage> parsed( |
| 498 CryptoFramer::ParseMessage(bytes->AsStringPiece())); | 498 CryptoFramer::ParseMessage(bytes->AsStringPiece())); |
| 499 CHECK(parsed.get()); | 499 CHECK(parsed.get()); |
| 500 | 500 |
| 501 return *parsed; | 501 return *parsed; |
| 502 } | 502 } |
| 503 | 503 |
| 504 } // namespace test | 504 } // namespace test |
| 505 } // namespace net | 505 } // namespace net |
| OLD | NEW |