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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 return client->num_sent_client_hellos(); | 208 return client->num_sent_client_hellos(); |
209 } | 209 } |
210 | 210 |
211 // static | 211 // static |
212 int CryptoTestUtils::HandshakeWithFakeClient( | 212 int CryptoTestUtils::HandshakeWithFakeClient( |
213 PacketSavingConnection* server_conn, | 213 PacketSavingConnection* server_conn, |
214 QuicCryptoServerStream* server, | 214 QuicCryptoServerStream* server, |
215 const FakeClientOptions& options) { | 215 const FakeClientOptions& options) { |
216 PacketSavingConnection* client_conn = new PacketSavingConnection(false); | 216 PacketSavingConnection* client_conn = new PacketSavingConnection(false); |
| 217 // Advance the time, because timers do not like uninitialized times. |
| 218 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
217 TestClientSession client_session(client_conn, DefaultQuicConfig()); | 219 TestClientSession client_session(client_conn, DefaultQuicConfig()); |
218 QuicCryptoClientConfig crypto_config; | 220 QuicCryptoClientConfig crypto_config; |
219 | 221 |
220 if (!options.dont_verify_certs) { | 222 if (!options.dont_verify_certs) { |
221 // TODO(wtc): replace this with ProofVerifierForTesting() when we have | 223 // TODO(wtc): replace this with ProofVerifierForTesting() when we have |
222 // a working ProofSourceForTesting(). | 224 // a working ProofSourceForTesting(). |
223 crypto_config.SetProofVerifier(FakeProofVerifierForTesting()); | 225 crypto_config.SetProofVerifier(FakeProofVerifierForTesting()); |
224 } | 226 } |
225 bool is_https = false; | 227 bool is_https = false; |
226 AsyncTestChannelIDSource* async_channel_id_source = nullptr; | 228 AsyncTestChannelIDSource* async_channel_id_source = nullptr; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); | 624 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); |
623 scoped_ptr<CryptoHandshakeMessage> parsed( | 625 scoped_ptr<CryptoHandshakeMessage> parsed( |
624 CryptoFramer::ParseMessage(bytes->AsStringPiece())); | 626 CryptoFramer::ParseMessage(bytes->AsStringPiece())); |
625 CHECK(parsed.get()); | 627 CHECK(parsed.get()); |
626 | 628 |
627 return *parsed; | 629 return *parsed; |
628 } | 630 } |
629 | 631 |
630 } // namespace test | 632 } // namespace test |
631 } // namespace net | 633 } // namespace net |
OLD | NEW |