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_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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 std::string SendSynchronousRequest(const std::string& uri); | 134 std::string SendSynchronousRequest(const std::string& uri); |
135 void Connect(); | 135 void Connect(); |
136 void ResetConnection(); | 136 void ResetConnection(); |
137 void Disconnect(); | 137 void Disconnect(); |
138 IPEndPoint local_address() const; | 138 IPEndPoint local_address() const; |
139 void ClearPerRequestState(); | 139 void ClearPerRequestState(); |
140 bool WaitUntil(int timeout_ms, std::function<bool()> trigger); | 140 bool WaitUntil(int timeout_ms, std::function<bool()> trigger); |
141 ssize_t Send(const void* buffer, size_t size); | 141 ssize_t Send(const void* buffer, size_t size); |
142 bool response_complete() const; | 142 bool response_complete() const; |
143 bool response_headers_complete() const; | 143 bool response_headers_complete() const; |
144 const BalsaHeaders* response_headers() const; | 144 const SpdyHeaderBlock* response_headers() const; |
145 int64_t response_size() const; | 145 int64_t response_size() const; |
146 int response_header_size() const; | |
147 int64_t response_body_size() const; | 146 int64_t response_body_size() const; |
148 size_t bytes_read() const; | 147 size_t bytes_read() const; |
149 size_t bytes_written() const; | 148 size_t bytes_written() const; |
150 bool buffer_body() const; | 149 bool buffer_body() const; |
151 void set_buffer_body(bool buffer_body); | 150 void set_buffer_body(bool buffer_body); |
152 const std::string& response_body(); | 151 const std::string& response_body(); |
153 bool connected() const; | 152 bool connected() const; |
154 | 153 |
155 // Returns once a complete response or a connection close has been received | 154 // Returns once a complete response or a connection close has been received |
156 // from the server. | 155 // from the server. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 bool HaveActiveStream(); | 290 bool HaveActiveStream(); |
292 | 291 |
293 EpollServer epoll_server_; | 292 EpollServer epoll_server_; |
294 std::unique_ptr<MockableQuicClient> client_; // The actual client | 293 std::unique_ptr<MockableQuicClient> client_; // The actual client |
295 QuicSpdyClientStream* stream_; | 294 QuicSpdyClientStream* stream_; |
296 | 295 |
297 QuicRstStreamErrorCode stream_error_; | 296 QuicRstStreamErrorCode stream_error_; |
298 | 297 |
299 bool response_complete_; | 298 bool response_complete_; |
300 bool response_headers_complete_; | 299 bool response_headers_complete_; |
301 mutable BalsaHeaders response_headers_; | 300 mutable SpdyHeaderBlock response_headers_; |
302 | 301 |
303 // Parsed response trailers (if present), copied from the stream in OnClose. | 302 // Parsed response trailers (if present), copied from the stream in OnClose. |
304 SpdyHeaderBlock response_trailers_; | 303 SpdyHeaderBlock response_trailers_; |
305 | 304 |
306 SpdyPriority priority_; | 305 SpdyPriority priority_; |
307 std::string response_; | 306 std::string response_; |
308 // bytes_read_ and bytes_written_ are updated only when stream_ is released; | 307 // bytes_read_ and bytes_written_ are updated only when stream_ is released; |
309 // prefer bytes_read() and bytes_written() member functions. | 308 // prefer bytes_read() and bytes_written() member functions. |
310 uint64_t bytes_read_; | 309 uint64_t bytes_read_; |
311 uint64_t bytes_written_; | 310 uint64_t bytes_written_; |
312 // The number of uncompressed HTTP header bytes received. | |
313 int response_header_size_; | |
314 // The number of HTTP body bytes received. | 311 // The number of HTTP body bytes received. |
315 int64_t response_body_size_; | 312 int64_t response_body_size_; |
316 // True if we tried to connect already since the last call to Disconnect(). | 313 // True if we tried to connect already since the last call to Disconnect(). |
317 bool connect_attempted_; | 314 bool connect_attempted_; |
318 // The client will auto-connect exactly once before sending data. If | 315 // The client will auto-connect exactly once before sending data. If |
319 // something causes a connection reset, it will not automatically reconnect | 316 // something causes a connection reset, it will not automatically reconnect |
320 // unless auto_reconnect_ is true. | 317 // unless auto_reconnect_ is true. |
321 bool auto_reconnect_; | 318 bool auto_reconnect_; |
322 // Should we buffer the response body? Defaults to true. | 319 // Should we buffer the response body? Defaults to true. |
323 bool buffer_body_; | 320 bool buffer_body_; |
(...skipping 13 matching lines...) Expand all Loading... |
337 std::string override_sni_; | 334 std::string override_sni_; |
338 | 335 |
339 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); | 336 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); |
340 }; | 337 }; |
341 | 338 |
342 } // namespace test | 339 } // namespace test |
343 | 340 |
344 } // namespace net | 341 } // namespace net |
345 | 342 |
346 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ | 343 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
OLD | NEW |