| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SIMPLE_CLIENT_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_SIMPLE_CLIENT_H_ |
| 6 #define NET_TOOLS_QUIC_TEST_TOOLS_SIMPLE_CLIENT_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_SIMPLE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "net/base/ip_endpoint.h" | 11 #include "net/base/ip_endpoint.h" |
| 12 #include "net/tools/balsa/balsa_frame.h" | 12 #include "net/tools/balsa/balsa_frame.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 namespace tools { | 15 namespace tools { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 class HTTPMessage; | 18 class HTTPMessage; |
| 19 | 19 |
| 20 class SimpleClient { | 20 class SimpleClient { |
| 21 public: | 21 public: |
| 22 virtual ~SimpleClient() {} | 22 virtual ~SimpleClient() {} |
| 23 | 23 |
| 24 // Clears any outstanding state and sends 'size' bytes from 'buffer' to the | 24 // Clears any outstanding state and sends 'size' bytes from 'buffer' to the |
| 25 // server, possibly with multiple send operations. Returns 'size' on success | 25 // server, possibly with multiple send operations. Returns 'size' on success |
| 26 // and -1 on error. Callers should assume that any return value other than | 26 // and -1 on error. Callers should assume that any return value other than |
| 27 // 'size' indicates failure. | 27 // 'size' indicates failure. |
| 28 virtual ssize_t Send(const void *buffer, size_t size) = 0; | 28 virtual ssize_t Send(const void* buffer, size_t size) = 0; |
| 29 | 29 |
| 30 // Serialize and send an HTTP request. | 30 // Serialize and send an HTTP request. |
| 31 virtual ssize_t SendMessage(const HTTPMessage& message) = 0; | 31 virtual ssize_t SendMessage(const HTTPMessage& message) = 0; |
| 32 | 32 |
| 33 // Clears any outstanding state, sends 'size' bytes from 'buffer' and waits | 33 // Clears any outstanding state, sends 'size' bytes from 'buffer' and waits |
| 34 // for a response or an error. | 34 // for a response or an error. |
| 35 virtual ssize_t SendAndWaitForResponse(const void *buffer, size_t size) = 0; | 35 virtual ssize_t SendAndWaitForResponse(const void* buffer, size_t size) = 0; |
| 36 | 36 |
| 37 // Clears any outstanding state and sends a simple GET of 'uri' to the | 37 // Clears any outstanding state and sends a simple GET of 'uri' to the |
| 38 // server. | 38 // server. |
| 39 virtual ssize_t SendRequest(const std::string& uri) = 0; | 39 virtual ssize_t SendRequest(const std::string& uri) = 0; |
| 40 | 40 |
| 41 // The response body is returned as a string. | 41 // The response body is returned as a string. |
| 42 virtual std::string SendCustomSynchronousRequest( | 42 virtual std::string SendCustomSynchronousRequest( |
| 43 const HTTPMessage& message) = 0; | 43 const HTTPMessage& message) = 0; |
| 44 virtual std::string SendSynchronousRequest(const std::string& url) = 0; | 44 virtual std::string SendSynchronousRequest(const std::string& url) = 0; |
| 45 | 45 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Instructs the client to populate response_body(). | 150 // Instructs the client to populate response_body(). |
| 151 virtual bool buffer_body() const = 0; | 151 virtual bool buffer_body() const = 0; |
| 152 virtual void set_buffer_body(bool buffer_body) = 0; | 152 virtual void set_buffer_body(bool buffer_body) = 0; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace test | 155 } // namespace test |
| 156 } // namespace tools | 156 } // namespace tools |
| 157 } // namespace net | 157 } // namespace net |
| 158 | 158 |
| 159 #endif // NET_TOOLS_QUIC_TEST_TOOLS_SIMPLE_CLIENT_H_ | 159 #endif // NET_TOOLS_QUIC_TEST_TOOLS_SIMPLE_CLIENT_H_ |
| OLD | NEW |