| 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/quic_crypto_server_config.h" | 10 #include "net/quic/crypto/quic_crypto_server_config.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 int CryptoTestUtils::HandshakeWithFakeClient( | 163 int CryptoTestUtils::HandshakeWithFakeClient( |
| 164 PacketSavingConnection* server_conn, | 164 PacketSavingConnection* server_conn, |
| 165 QuicCryptoServerStream* server, | 165 QuicCryptoServerStream* server, |
| 166 const FakeClientOptions& options) { | 166 const FakeClientOptions& options) { |
| 167 PacketSavingConnection* client_conn = new PacketSavingConnection(false); | 167 PacketSavingConnection* client_conn = new PacketSavingConnection(false); |
| 168 TestClientSession client_session(client_conn, DefaultQuicConfig()); | 168 TestClientSession client_session(client_conn, DefaultQuicConfig()); |
| 169 QuicCryptoClientConfig crypto_config; | 169 QuicCryptoClientConfig crypto_config; |
| 170 | 170 |
| 171 client_session.config()->SetDefaults(); | 171 client_session.config()->SetDefaults(); |
| 172 crypto_config.SetDefaults(); | 172 crypto_config.SetDefaults(); |
| 173 // TODO(rtenneti): Enable testing of ProofVerifier. | 173 if (!options.dont_verify_certs) { |
| 174 // if (!options.dont_verify_certs) { | 174 // TODO(wtc): replace this with ProofVerifierForTesting() when we have |
| 175 // crypto_config.SetProofVerifier(ProofVerifierForTesting()); | 175 // a working ProofSourceForTesting(). |
| 176 // } | 176 crypto_config.SetProofVerifier(FakeProofVerifierForTesting()); |
| 177 } |
| 178 bool is_https = false; |
| 177 if (options.channel_id_enabled) { | 179 if (options.channel_id_enabled) { |
| 180 is_https = true; |
| 178 crypto_config.SetChannelIDSource(ChannelIDSourceForTesting()); | 181 crypto_config.SetChannelIDSource(ChannelIDSourceForTesting()); |
| 179 } | 182 } |
| 180 QuicServerId server_id(kServerHostname, kServerPort, false, | 183 QuicServerId server_id(kServerHostname, kServerPort, is_https, |
| 181 PRIVACY_MODE_DISABLED); | 184 PRIVACY_MODE_DISABLED); |
| 182 QuicCryptoClientStream client(server_id, &client_session, NULL, | 185 QuicCryptoClientStream client(server_id, &client_session, |
| 186 ProofVerifyContextForTesting(), |
| 183 &crypto_config); | 187 &crypto_config); |
| 184 client_session.SetCryptoStream(&client); | 188 client_session.SetCryptoStream(&client); |
| 185 | 189 |
| 186 CHECK(client.CryptoConnect()); | 190 CHECK(client.CryptoConnect()); |
| 187 CHECK_EQ(1u, client_conn->packets_.size()); | 191 CHECK_EQ(1u, client_conn->packets_.size()); |
| 188 | 192 |
| 189 CommunicateHandshakeMessages(client_conn, &client, server_conn, server); | 193 CommunicateHandshakeMessages(client_conn, &client, server_conn, server); |
| 190 | 194 |
| 191 CompareClientAndServerKeys(&client, server); | 195 CompareClientAndServerKeys(&client, server); |
| 192 | 196 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); | 525 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); |
| 522 scoped_ptr<CryptoHandshakeMessage> parsed( | 526 scoped_ptr<CryptoHandshakeMessage> parsed( |
| 523 CryptoFramer::ParseMessage(bytes->AsStringPiece())); | 527 CryptoFramer::ParseMessage(bytes->AsStringPiece())); |
| 524 CHECK(parsed.get()); | 528 CHECK(parsed.get()); |
| 525 | 529 |
| 526 return *parsed; | 530 return *parsed; |
| 527 } | 531 } |
| 528 | 532 |
| 529 } // namespace test | 533 } // namespace test |
| 530 } // namespace net | 534 } // namespace net |
| OLD | NEW |