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

Side by Side Diff: net/tools/quic/test_tools/quic_test_client.h

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ 6 #define NET_TOOLS_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"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 DISALLOW_COPY_AND_ASSIGN(MockableQuicClient); 64 DISALLOW_COPY_AND_ASSIGN(MockableQuicClient);
65 }; 65 };
66 66
67 // A toy QUIC client used for testing, mostly following the SimpleClient APIs. 67 // A toy QUIC client used for testing, mostly following the SimpleClient APIs.
68 class QuicTestClient : public SimpleClient, 68 class QuicTestClient : public SimpleClient,
69 public QuicDataStream::Visitor { 69 public QuicDataStream::Visitor {
70 public: 70 public:
71 QuicTestClient(IPEndPoint server_address, 71 QuicTestClient(IPEndPoint server_address,
72 const std::string& server_hostname, 72 const std::string& server_hostname,
73 bool secure,
74 const QuicVersionVector& supported_versions); 73 const QuicVersionVector& supported_versions);
75 QuicTestClient(IPEndPoint server_address, 74 QuicTestClient(IPEndPoint server_address,
76 const std::string& server_hostname, 75 const std::string& server_hostname,
77 bool secure,
78 const QuicConfig& config, 76 const QuicConfig& config,
79 const QuicVersionVector& supported_versions); 77 const QuicVersionVector& supported_versions);
80 78
81 ~QuicTestClient() override; 79 ~QuicTestClient() override;
82 80
83 // ExpectCertificates controls whether the server is expected to provide
84 // certificates. The certificates, if any, are not verified, but the common
85 // name is recorded and available with |cert_common_name()|.
86 void ExpectCertificates(bool on);
87
88 // Sets the |user_agent_id| of the |client_|. 81 // Sets the |user_agent_id| of the |client_|.
89 void SetUserAgentID(const std::string& user_agent_id); 82 void SetUserAgentID(const std::string& user_agent_id);
90 83
91 // Wraps data in a quic packet and sends it. 84 // Wraps data in a quic packet and sends it.
92 ssize_t SendData(const std::string& data, bool last_data); 85 ssize_t SendData(const std::string& data, bool last_data);
93 // As above, but |delegate| will be notified when |data| is ACKed. 86 // As above, but |delegate| will be notified when |data| is ACKed.
94 ssize_t SendData(const std::string& data, 87 ssize_t SendData(const std::string& data,
95 bool last_data, 88 bool last_data,
96 QuicAckListenerInterface* delegate); 89 QuicAckListenerInterface* delegate);
97 90
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 179
187 void set_allow_bidirectional_data(bool value) { 180 void set_allow_bidirectional_data(bool value) {
188 allow_bidirectional_data_ = value; 181 allow_bidirectional_data_ = value;
189 } 182 }
190 183
191 bool allow_bidirectional_data() const { return allow_bidirectional_data_; } 184 bool allow_bidirectional_data() const { return allow_bidirectional_data_; }
192 185
193 protected: 186 protected:
194 QuicTestClient(); 187 QuicTestClient();
195 188
196 void Initialize(bool secure); 189 void Initialize();
197 190
198 void set_client(MockableQuicClient* client) { client_.reset(client); } 191 void set_client(MockableQuicClient* client) { client_.reset(client); }
199 192
200 private: 193 private:
201 class TestClientDataToResend : public QuicClient::QuicDataToResend { 194 class TestClientDataToResend : public QuicClient::QuicDataToResend {
202 public: 195 public:
203 TestClientDataToResend(BalsaHeaders* headers, 196 TestClientDataToResend(BalsaHeaders* headers,
204 StringPiece body, 197 StringPiece body,
205 bool fin, 198 bool fin,
206 QuicTestClient* test_client, 199 QuicTestClient* test_client,
(...skipping 26 matching lines...) Expand all
233 QuicPriority priority_; 226 QuicPriority priority_;
234 std::string response_; 227 std::string response_;
235 uint64 bytes_read_; 228 uint64 bytes_read_;
236 uint64 bytes_written_; 229 uint64 bytes_written_;
237 // The number of uncompressed HTTP header bytes received. 230 // The number of uncompressed HTTP header bytes received.
238 int response_header_size_; 231 int response_header_size_;
239 // The number of HTTP body bytes received. 232 // The number of HTTP body bytes received.
240 int64 response_body_size_; 233 int64 response_body_size_;
241 // True if we tried to connect already since the last call to Disconnect(). 234 // True if we tried to connect already since the last call to Disconnect().
242 bool connect_attempted_; 235 bool connect_attempted_;
243 bool secure_;
244 // The client will auto-connect exactly once before sending data. If 236 // The client will auto-connect exactly once before sending data. If
245 // something causes a connection reset, it will not automatically reconnect 237 // something causes a connection reset, it will not automatically reconnect
246 // unless auto_reconnect_ is true. 238 // unless auto_reconnect_ is true.
247 bool auto_reconnect_; 239 bool auto_reconnect_;
248 // Should we buffer the response body? Defaults to true. 240 // Should we buffer the response body? Defaults to true.
249 bool buffer_body_; 241 bool buffer_body_;
250 // FEC policy for data sent by this client. 242 // FEC policy for data sent by this client.
251 FecPolicy fec_policy_; 243 FecPolicy fec_policy_;
252 // When true allows the sending of a request to continue while the response is 244 // When true allows the sending of a request to continue while the response is
253 // arriving. 245 // arriving.
254 bool allow_bidirectional_data_; 246 bool allow_bidirectional_data_;
255 // proof_verifier_ points to a RecordingProofVerifier that is owned by
256 // client_.
257 ProofVerifier* proof_verifier_;
258 247
259 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); 248 DISALLOW_COPY_AND_ASSIGN(QuicTestClient);
260 }; 249 };
261 250
262 } // namespace test 251 } // namespace test
263 252
264 } // namespace tools 253 } // namespace tools
265 } // namespace net 254 } // namespace net
266 255
267 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ 256 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698