Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: net/quic/test_tools/crypto_test_utils.h

Issue 15937012: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small bug fixes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <stdarg.h> 8 #include <stdarg.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "net/quic/crypto/crypto_framer.h" 14 #include "net/quic/crypto/crypto_framer.h"
15 #include "net/quic/quic_framer.h" 15 #include "net/quic/quic_framer.h"
16 #include "net/quic/quic_protocol.h" 16 #include "net/quic/quic_protocol.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 class ChannelIDSigner;
20 class CommonCertSets; 21 class CommonCertSets;
21 class ProofSource; 22 class ProofSource;
22 class ProofVerifier; 23 class ProofVerifier;
23 class QuicClock; 24 class QuicClock;
24 class QuicConfig; 25 class QuicConfig;
25 class QuicCryptoClientStream; 26 class QuicCryptoClientStream;
26 class QuicCryptoServerConfig; 27 class QuicCryptoServerConfig;
27 class QuicCryptoServerStream; 28 class QuicCryptoServerStream;
28 class QuicCryptoStream; 29 class QuicCryptoStream;
29 class QuicRandom; 30 class QuicRandom;
30 31
31 namespace test { 32 namespace test {
32 33
33 class PacketSavingConnection; 34 class PacketSavingConnection;
34 35
35 class CryptoTestUtils { 36 class CryptoTestUtils {
36 public: 37 public:
37 // FakeClientOptions bundles together a number of options for configuring 38 // FakeClientOptions bundles together a number of options for configuring
38 // HandshakeWithFakeClient. 39 // HandshakeWithFakeClient.
39 struct FakeClientOptions { 40 struct FakeClientOptions {
40 FakeClientOptions(); 41 FakeClientOptions();
41 42
42 // If dont_verify_certs is true then no ProofVerifier is set on the client. 43 // If dont_verify_certs is true then no ProofVerifier is set on the client.
43 // Thus no certificates will be requested or checked. 44 // Thus no certificates will be requested or checked.
44 bool dont_verify_certs; 45 bool dont_verify_certs;
46
47 // If channel_id_enabled is true then the client will attempt to send a
48 // ChannelID. The key will be the same as is returned by
49 // |ChannelIDKeyForHostname|.
50 bool channel_id_enabled;
45 }; 51 };
46 52
47 // returns: the number of client hellos that the client sent. 53 // returns: the number of client hellos that the client sent.
48 static int HandshakeWithFakeServer(PacketSavingConnection* client_conn, 54 static int HandshakeWithFakeServer(PacketSavingConnection* client_conn,
49 QuicCryptoClientStream* client); 55 QuicCryptoClientStream* client);
50 56
51 // returns: the number of client hellos that the client sent. 57 // returns: the number of client hellos that the client sent.
52 static int HandshakeWithFakeClient(PacketSavingConnection* server_conn, 58 static int HandshakeWithFakeClient(PacketSavingConnection* server_conn,
53 QuicCryptoServerStream* server, 59 QuicCryptoServerStream* server,
54 const FakeClientOptions& options); 60 const FakeClientOptions& options);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // NULL); 109 // NULL);
104 static CryptoHandshakeMessage Message(const char* message_tag, ...); 110 static CryptoHandshakeMessage Message(const char* message_tag, ...);
105 111
106 // BuildMessage is the same as |Message|, but takes the variable arguments 112 // BuildMessage is the same as |Message|, but takes the variable arguments
107 // explicitly. TODO(rtenneti): Investigate whether it'd be better for 113 // explicitly. TODO(rtenneti): Investigate whether it'd be better for
108 // Message() and BuildMessage() to return a CryptoHandshakeMessage* pointer 114 // Message() and BuildMessage() to return a CryptoHandshakeMessage* pointer
109 // instead, to avoid copying the return value. 115 // instead, to avoid copying the return value.
110 static CryptoHandshakeMessage BuildMessage(const char* message_tag, 116 static CryptoHandshakeMessage BuildMessage(const char* message_tag,
111 va_list ap); 117 va_list ap);
112 118
119 // ChannelIDSignerForTesting returns a ChannelIDSigner that generates keys
120 // deterministically based on the hostname given in the Sign call.
121 static ChannelIDSigner* ChannelIDSignerForTesting();
122
123 // ChannelIDKeyForHostname returns the ChannelID key that
124 // |ChannelIDSignerForTesting| will use for the given hostname.
125 static std::string ChannelIDKeyForHostname(const std::string& hostname);
126
113 private: 127 private:
114 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, 128 static void CompareClientAndServerKeys(QuicCryptoClientStream* client,
115 QuicCryptoServerStream* server); 129 QuicCryptoServerStream* server);
116 }; 130 };
117 131
118 } // namespace test 132 } // namespace test
119 133
120 } // namespace net 134 } // namespace net
121 135
122 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ 136 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698