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_QUIC_TEST_CLIENT_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
6 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ | 6 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/quic/quic_framer.h" | 12 #include "net/quic/quic_framer.h" |
13 #include "net/quic/quic_packet_creator.h" | 13 #include "net/quic/quic_packet_creator.h" |
14 #include "net/quic/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
15 #include "net/tools/quic/quic_client.h" | 15 #include "net/tools/quic/quic_client.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class ProofVerifier; | 19 class ProofVerifier; |
| 20 class QuicSessionKey; |
20 | 21 |
21 namespace tools { | 22 namespace tools { |
22 | 23 |
23 class QuicPacketWriterWrapper; | 24 class QuicPacketWriterWrapper; |
24 | 25 |
25 namespace test { | 26 namespace test { |
26 | 27 |
27 class HTTPMessage; | 28 class HTTPMessage; |
28 class MockableQuicClient; | 29 class MockableQuicClient; |
29 | 30 |
30 // A toy QUIC client used for testing. | 31 // A toy QUIC client used for testing. |
31 class QuicTestClient : public QuicDataStream::Visitor { | 32 class QuicTestClient : public QuicDataStream::Visitor { |
32 public: | 33 public: |
33 QuicTestClient(IPEndPoint server_address, const string& server_hostname, | 34 QuicTestClient(IPEndPoint server_address, |
| 35 const QuicSessionKey& server_key, |
34 const QuicVersionVector& supported_versions); | 36 const QuicVersionVector& supported_versions); |
35 QuicTestClient(IPEndPoint server_address, | 37 QuicTestClient(IPEndPoint server_address, |
36 const string& server_hostname, | 38 const QuicSessionKey& server_key, |
37 bool secure, | 39 bool secure, |
38 const QuicVersionVector& supported_versions); | 40 const QuicVersionVector& supported_versions); |
39 QuicTestClient(IPEndPoint server_address, | 41 QuicTestClient(IPEndPoint server_address, |
40 const string& server_hostname, | 42 const QuicSessionKey& server_key, |
41 bool secure, | 43 bool secure, |
42 const QuicConfig& config, | 44 const QuicConfig& config, |
43 const QuicVersionVector& supported_versions); | 45 const QuicVersionVector& supported_versions); |
44 | 46 |
45 virtual ~QuicTestClient(); | 47 virtual ~QuicTestClient(); |
46 | 48 |
47 // ExpectCertificates controls whether the server is expected to provide | 49 // ExpectCertificates controls whether the server is expected to provide |
48 // certificates. The certificates, if any, are not verified, but the common | 50 // certificates. The certificates, if any, are not verified, but the common |
49 // name is recorded and available with |cert_common_name()|. | 51 // name is recorded and available with |cert_common_name()|. |
50 void ExpectCertificates(bool on); | 52 void ExpectCertificates(bool on); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 const string& response_body() {return response_;} | 113 const string& response_body() {return response_;} |
112 bool connected() const; | 114 bool connected() const; |
113 | 115 |
114 void set_auto_reconnect(bool reconnect) { auto_reconnect_ = reconnect; } | 116 void set_auto_reconnect(bool reconnect) { auto_reconnect_ = reconnect; } |
115 | 117 |
116 void set_priority(QuicPriority priority) { priority_ = priority; } | 118 void set_priority(QuicPriority priority) { priority_ = priority; } |
117 | 119 |
118 void WaitForWriteToFlush(); | 120 void WaitForWriteToFlush(); |
119 | 121 |
120 private: | 122 private: |
121 void Initialize(IPEndPoint address, const string& hostname, bool secure); | 123 void Initialize(IPEndPoint address, |
| 124 const QuicSessionKey& server_key, |
| 125 bool secure); |
122 | 126 |
123 IPEndPoint server_address_; | 127 IPEndPoint server_address_; |
124 IPEndPoint client_address_; | 128 IPEndPoint client_address_; |
| 129 QuicSessionKey server_key_; |
125 scoped_ptr<MockableQuicClient> client_; // The actual client | 130 scoped_ptr<MockableQuicClient> client_; // The actual client |
126 QuicSpdyClientStream* stream_; | 131 QuicSpdyClientStream* stream_; |
127 | 132 |
128 QuicRstStreamErrorCode stream_error_; | 133 QuicRstStreamErrorCode stream_error_; |
129 | 134 |
130 bool response_complete_; | 135 bool response_complete_; |
131 bool response_headers_complete_; | 136 bool response_headers_complete_; |
132 BalsaHeaders headers_; | 137 BalsaHeaders headers_; |
133 QuicPriority priority_; | 138 QuicPriority priority_; |
134 string response_; | 139 string response_; |
(...skipping 17 matching lines...) Expand all Loading... |
152 // client_. | 157 // client_. |
153 ProofVerifier* proof_verifier_; | 158 ProofVerifier* proof_verifier_; |
154 }; | 159 }; |
155 | 160 |
156 } // namespace test | 161 } // namespace test |
157 | 162 |
158 } // namespace tools | 163 } // namespace tools |
159 } // namespace net | 164 } // namespace net |
160 | 165 |
161 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ | 166 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
OLD | NEW |