| 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/quic/test_tools/quic_test_writer.h" | 15 #include "net/quic/test_tools/quic_test_writer.h" |
| 16 #include "net/tools/quic/quic_client.h" | 16 #include "net/tools/quic/quic_client.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class ProofVerifier; | 20 class ProofVerifier; |
| 21 | 21 |
| 22 namespace tools { | 22 namespace tools { |
| 23 | 23 |
| 24 namespace test { | 24 namespace test { |
| 25 | 25 |
| 26 class HTTPMessage; | 26 class HTTPMessage; |
| 27 | 27 |
| 28 // A toy QUIC client used for testing. | 28 // A toy QUIC client used for testing. |
| 29 class QuicTestClient : public ReliableQuicStream::Visitor { | 29 class QuicTestClient : public QuicDataStream::Visitor { |
| 30 public: | 30 public: |
| 31 QuicTestClient(IPEndPoint server_address, const string& server_hostname, | 31 QuicTestClient(IPEndPoint server_address, const string& server_hostname, |
| 32 const QuicVersionVector& supported_versions); | 32 const QuicVersionVector& supported_versions); |
| 33 QuicTestClient(IPEndPoint server_address, | 33 QuicTestClient(IPEndPoint server_address, |
| 34 const string& server_hostname, | 34 const string& server_hostname, |
| 35 bool secure, | 35 bool secure, |
| 36 const QuicVersionVector& supported_versions); | 36 const QuicVersionVector& supported_versions); |
| 37 QuicTestClient(IPEndPoint server_address, | 37 QuicTestClient(IPEndPoint server_address, |
| 38 const string& server_hostname, | 38 const string& server_hostname, |
| 39 bool secure, | 39 bool secure, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool response_headers_complete() const; | 74 bool response_headers_complete() const; |
| 75 const BalsaHeaders* response_headers() const; | 75 const BalsaHeaders* response_headers() const; |
| 76 int response_size() const; | 76 int response_size() const; |
| 77 int response_header_size() const { return response_header_size_; } | 77 int response_header_size() const { return response_header_size_; } |
| 78 int response_body_size() const { return response_body_size_; } | 78 int response_body_size() const { return response_body_size_; } |
| 79 size_t bytes_read() const; | 79 size_t bytes_read() const; |
| 80 size_t bytes_written() const; | 80 size_t bytes_written() const; |
| 81 bool buffer_body() const { return buffer_body_; } | 81 bool buffer_body() const { return buffer_body_; } |
| 82 void set_buffer_body(bool buffer_body) { buffer_body_ = buffer_body; } | 82 void set_buffer_body(bool buffer_body) { buffer_body_ = buffer_body; } |
| 83 | 83 |
| 84 // From ReliableQuicStream::Visitor | 84 // From QuicDataStream::Visitor |
| 85 virtual void OnClose(ReliableQuicStream* stream) OVERRIDE; | 85 virtual void OnClose(QuicDataStream* stream) OVERRIDE; |
| 86 | 86 |
| 87 // Configures client_ to take ownership of and use the writer. | 87 // Configures client_ to take ownership of and use the writer. |
| 88 // Must be called before initial connect. | 88 // Must be called before initial connect. |
| 89 void UseWriter(net::test::QuicTestWriter* writer); | 89 void UseWriter(net::test::QuicTestWriter* writer); |
| 90 // If the given GUID is nonzero, configures client_ to use a specific GUID | 90 // If the given GUID is nonzero, configures client_ to use a specific GUID |
| 91 // instead of a random one. | 91 // instead of a random one. |
| 92 void UseGuid(QuicGuid guid); | 92 void UseGuid(QuicGuid guid); |
| 93 | 93 |
| 94 // Returns NULL if the maximum number of streams have already been created. | 94 // Returns NULL if the maximum number of streams have already been created. |
| 95 QuicSpdyClientStream* GetOrCreateStream(); | 95 QuicSpdyClientStream* GetOrCreateStream(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // client_. | 147 // client_. |
| 148 ProofVerifier* proof_verifier_; | 148 ProofVerifier* proof_verifier_; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace test | 151 } // namespace test |
| 152 | 152 |
| 153 } // namespace tools | 153 } // namespace tools |
| 154 } // namespace net | 154 } // namespace net |
| 155 | 155 |
| 156 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ | 156 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
| OLD | NEW |