| 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_CLIENT_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_QUIC_CLIENT_H_ |
| 6 #define NET_QUIC_TEST_TOOLS_QUIC_CLIENT_H_ | 6 #define NET_QUIC_TEST_TOOLS_QUIC_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "net/quic/quic_framer.h" | 11 #include "net/quic/quic_framer.h" |
| 12 #include "net/quic/quic_packet_creator.h" | 12 #include "net/quic/quic_packet_creator.h" |
| 13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
| 14 #include "net/tools/quic/quic_client.h" | 14 #include "net/tools/quic/quic_client.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 class ProofVerifier; | 18 class ProofVerifier; |
| 19 | 19 |
| 20 namespace tools { | 20 namespace tools { |
| 21 | 21 |
| 22 namespace test { | 22 namespace test { |
| 23 | 23 |
| 24 class HTTPMessage; | 24 class HTTPMessage; |
| 25 | 25 |
| 26 // A toy QUIC client used for testing. | 26 // A toy QUIC client used for testing. |
| 27 class QuicTestClient : public ReliableQuicStream::Visitor { | 27 class QuicTestClient : public ReliableQuicStream::Visitor { |
| 28 public: | 28 public: |
| 29 QuicTestClient(IPEndPoint server_address, const string& server_hostname); | 29 QuicTestClient(IPEndPoint server_address, const string& server_hostname, |
| 30 const QuicVersion version); |
| 30 QuicTestClient(IPEndPoint server_address, | 31 QuicTestClient(IPEndPoint server_address, |
| 31 const string& server_hostname, | 32 const string& server_hostname, |
| 32 bool secure); | 33 bool secure, |
| 34 const QuicVersion version); |
| 33 QuicTestClient(IPEndPoint server_address, | 35 QuicTestClient(IPEndPoint server_address, |
| 34 const string& server_hostname, | 36 const string& server_hostname, |
| 35 const QuicConfig& config); | 37 const QuicConfig& config, |
| 38 const QuicVersion version); |
| 36 | 39 |
| 37 virtual ~QuicTestClient(); | 40 virtual ~QuicTestClient(); |
| 38 | 41 |
| 39 // ExpectCertificates controls whether the server is expected to provide | 42 // ExpectCertificates controls whether the server is expected to provide |
| 40 // certificates. The certificates, if any, are not verified, but the common | 43 // certificates. The certificates, if any, are not verified, but the common |
| 41 // name is recorded and available with |cert_common_name()|. | 44 // name is recorded and available with |cert_common_name()|. |
| 42 void ExpectCertificates(bool on); | 45 void ExpectCertificates(bool on); |
| 43 | 46 |
| 44 // Clears any outstanding state and sends a simple GET of 'uri' to the | 47 // Clears any outstanding state and sends a simple GET of 'uri' to the |
| 45 // server. Returns 0 if the request failed and no bytes were written. | 48 // server. Returns 0 if the request failed and no bytes were written. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 uint64 bytes_read_; | 110 uint64 bytes_read_; |
| 108 uint64 bytes_written_; | 111 uint64 bytes_written_; |
| 109 // True if the client has never connected before. The client will | 112 // True if the client has never connected before. The client will |
| 110 // auto-connect exactly once before sending data. If something causes a | 113 // auto-connect exactly once before sending data. If something causes a |
| 111 // connection reset, it will not automatically reconnect. | 114 // connection reset, it will not automatically reconnect. |
| 112 bool never_connected_; | 115 bool never_connected_; |
| 113 bool secure_; | 116 bool secure_; |
| 114 // If true, the client will always reconnect if necessary before creating a | 117 // If true, the client will always reconnect if necessary before creating a |
| 115 // stream. | 118 // stream. |
| 116 bool auto_reconnect_; | 119 bool auto_reconnect_; |
| 120 |
| 117 // proof_verifier_ points to a RecordingProofVerifier that is owned by | 121 // proof_verifier_ points to a RecordingProofVerifier that is owned by |
| 118 // client_. | 122 // client_. |
| 119 ProofVerifier* proof_verifier_; | 123 ProofVerifier* proof_verifier_; |
| 120 }; | 124 }; |
| 121 | 125 |
| 122 } // namespace test | 126 } // namespace test |
| 123 | 127 |
| 124 } // namespace tools | 128 } // namespace tools |
| 125 } // namespace net | 129 } // namespace net |
| 126 | 130 |
| 127 #endif // NET_QUIC_TEST_TOOLS_QUIC_CLIENT_H_ | 131 #endif // NET_QUIC_TEST_TOOLS_QUIC_CLIENT_H_ |
| OLD | NEW |