| 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" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 virtual void OnClose(ReliableQuicStream* stream) OVERRIDE; | 85 virtual void OnClose(ReliableQuicStream* 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 QuicReliableClientStream* GetOrCreateStream(); | 95 QuicSpdyClientStream* GetOrCreateStream(); |
| 96 | 96 |
| 97 QuicRstStreamErrorCode stream_error() { return stream_error_; } | 97 QuicRstStreamErrorCode stream_error() { return stream_error_; } |
| 98 QuicErrorCode connection_error() { return client()->session()->error(); } | 98 QuicErrorCode connection_error() { return client()->session()->error(); } |
| 99 | 99 |
| 100 QuicClient* client() { return client_.get(); } | 100 QuicClient* client() { return client_.get(); } |
| 101 | 101 |
| 102 // cert_common_name returns the common name value of the server's certificate, | 102 // cert_common_name returns the common name value of the server's certificate, |
| 103 // or the empty string if no certificate was presented. | 103 // or the empty string if no certificate was presented. |
| 104 const string& cert_common_name() const; | 104 const string& cert_common_name() const; |
| 105 | 105 |
| 106 const string& response_body() {return response_;} | 106 const string& response_body() {return response_;} |
| 107 bool connected() const; | 107 bool connected() const; |
| 108 | 108 |
| 109 void set_auto_reconnect(bool reconnect) { auto_reconnect_ = reconnect; } | 109 void set_auto_reconnect(bool reconnect) { auto_reconnect_ = reconnect; } |
| 110 | 110 |
| 111 void set_priority(QuicPriority priority) { priority_ = priority; } | 111 void set_priority(QuicPriority priority) { priority_ = priority; } |
| 112 | 112 |
| 113 void WaitForWriteToFlush(); | 113 void WaitForWriteToFlush(); |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 void Initialize(IPEndPoint address, const string& hostname, bool secure); | 116 void Initialize(IPEndPoint address, const string& hostname, bool secure); |
| 117 | 117 |
| 118 IPEndPoint server_address_; | 118 IPEndPoint server_address_; |
| 119 IPEndPoint client_address_; | 119 IPEndPoint client_address_; |
| 120 scoped_ptr<QuicClient> client_; // The actual client | 120 scoped_ptr<QuicClient> client_; // The actual client |
| 121 QuicReliableClientStream* stream_; | 121 QuicSpdyClientStream* stream_; |
| 122 | 122 |
| 123 QuicRstStreamErrorCode stream_error_; | 123 QuicRstStreamErrorCode stream_error_; |
| 124 | 124 |
| 125 bool response_complete_; | 125 bool response_complete_; |
| 126 bool response_headers_complete_; | 126 bool response_headers_complete_; |
| 127 BalsaHeaders headers_; | 127 BalsaHeaders headers_; |
| 128 QuicPriority priority_; | 128 QuicPriority priority_; |
| 129 string response_; | 129 string response_; |
| 130 uint64 bytes_read_; | 130 uint64 bytes_read_; |
| 131 uint64 bytes_written_; | 131 uint64 bytes_written_; |
| (...skipping 15 matching lines...) Expand all 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 |