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 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
6 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 6 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class QuicCryptoServerStream; | 25 class QuicCryptoServerStream; |
26 class QuicCryptoStream; | 26 class QuicCryptoStream; |
27 class QuicRandom; | 27 class QuicRandom; |
28 | 28 |
29 namespace test { | 29 namespace test { |
30 | 30 |
31 class PacketSavingConnection; | 31 class PacketSavingConnection; |
32 | 32 |
33 class CryptoTestUtils { | 33 class CryptoTestUtils { |
34 public: | 34 public: |
| 35 // FakeClientOptions bundles together a number of options for configuring |
| 36 // HandshakeWithFakeClient. |
| 37 struct FakeClientOptions { |
| 38 FakeClientOptions(); |
| 39 |
| 40 // If dont_verify_certs is true then no ProofVerifier is set on the client. |
| 41 // Thus no certificates will be requested or checked. |
| 42 bool dont_verify_certs; |
| 43 }; |
| 44 |
35 // returns: the number of client hellos that the client sent. | 45 // returns: the number of client hellos that the client sent. |
36 static int HandshakeWithFakeServer(PacketSavingConnection* client_conn, | 46 static int HandshakeWithFakeServer(PacketSavingConnection* client_conn, |
37 QuicCryptoClientStream* client); | 47 QuicCryptoClientStream* client); |
38 | 48 |
39 // returns: the number of client hellos that the client sent. | 49 // returns: the number of client hellos that the client sent. |
40 static int HandshakeWithFakeClient(PacketSavingConnection* server_conn, | 50 static int HandshakeWithFakeClient(PacketSavingConnection* server_conn, |
41 QuicCryptoServerStream* server); | 51 QuicCryptoServerStream* server, |
| 52 const FakeClientOptions& options); |
42 | 53 |
43 // SetupCryptoServerConfigForTest configures |config| and |crypto_config| | 54 // SetupCryptoServerConfigForTest configures |config| and |crypto_config| |
44 // with sensible defaults for testing. | 55 // with sensible defaults for testing. |
45 static void SetupCryptoServerConfigForTest( | 56 static void SetupCryptoServerConfigForTest( |
46 const QuicClock* clock, | 57 const QuicClock* clock, |
47 QuicRandom* rand, | 58 QuicRandom* rand, |
48 QuicConfig* config, | 59 QuicConfig* config, |
49 QuicCryptoServerConfig* crypto_config); | 60 QuicCryptoServerConfig* crypto_config); |
50 | 61 |
51 // CommunicateHandshakeMessages moves messages from |a| to |b| and back until | 62 // CommunicateHandshakeMessages moves messages from |a| to |b| and back until |
(...skipping 22 matching lines...) Expand all Loading... |
74 private: | 85 private: |
75 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, | 86 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, |
76 QuicCryptoServerStream* server); | 87 QuicCryptoServerStream* server); |
77 }; | 88 }; |
78 | 89 |
79 } // namespace test | 90 } // namespace test |
80 | 91 |
81 } // namespace net | 92 } // namespace net |
82 | 93 |
83 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 94 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
OLD | NEW |