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" |
11 #include "net/quic/crypto/crypto_framer.h" | 11 #include "net/quic/crypto/crypto_framer.h" |
12 #include "net/quic/quic_framer.h" | 12 #include "net/quic/quic_framer.h" |
13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
| 17 class QuicClock; |
| 18 class QuicConfig; |
17 class QuicCryptoClientStream; | 19 class QuicCryptoClientStream; |
| 20 class QuicCryptoServerConfig; |
18 class QuicCryptoServerStream; | 21 class QuicCryptoServerStream; |
| 22 class QuicRandom; |
19 | 23 |
20 namespace test { | 24 namespace test { |
21 | 25 |
22 class PacketSavingConnection; | 26 class PacketSavingConnection; |
23 | 27 |
24 class CryptoTestUtils { | 28 class CryptoTestUtils { |
25 public: | 29 public: |
26 static void HandshakeWithFakeServer(PacketSavingConnection* client_conn, | 30 static void HandshakeWithFakeServer(PacketSavingConnection* client_conn, |
27 QuicCryptoClientStream* client); | 31 QuicCryptoClientStream* client); |
28 | 32 |
29 static void HandshakeWithFakeClient(PacketSavingConnection* server_conn, | 33 static void HandshakeWithFakeClient(PacketSavingConnection* server_conn, |
30 QuicCryptoServerStream* server); | 34 QuicCryptoServerStream* server); |
31 | 35 |
| 36 // SetupCryptoServerConfigForTest configures |config| and |crypto_config| |
| 37 // with sensible defaults for testing. |
| 38 static void SetupCryptoServerConfigForTest( |
| 39 const QuicClock* clock, |
| 40 QuicRandom* rand, |
| 41 QuicConfig* config, |
| 42 QuicCryptoServerConfig* crypto_config); |
| 43 |
32 // Returns the value for the tag |tag| in the tag value map of |message|. | 44 // Returns the value for the tag |tag| in the tag value map of |message|. |
33 static std::string GetValueForTag(const CryptoHandshakeMessage& message, | 45 static std::string GetValueForTag(const CryptoHandshakeMessage& message, |
34 CryptoTag tag); | 46 CryptoTag tag); |
35 | 47 |
36 private: | 48 private: |
37 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, | 49 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, |
38 QuicCryptoServerStream* server); | 50 QuicCryptoServerStream* server); |
39 }; | 51 }; |
40 | 52 |
41 } // namespace test | 53 } // namespace test |
42 | 54 |
43 } // namespace net | 55 } // namespace net |
44 | 56 |
45 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 57 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
OLD | NEW |