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