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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 const QuicServerId& server_id, | 38 const QuicServerId& server_id, |
39 const QuicVersionVector& supported_versions, | 39 const QuicVersionVector& supported_versions, |
40 EpollServer* epoll_server); | 40 EpollServer* epoll_server); |
41 | 41 |
42 MockableQuicClient(IPEndPoint server_address, | 42 MockableQuicClient(IPEndPoint server_address, |
43 const QuicServerId& server_id, | 43 const QuicServerId& server_id, |
44 const QuicConfig& config, | 44 const QuicConfig& config, |
45 const QuicVersionVector& supported_versions, | 45 const QuicVersionVector& supported_versions, |
46 EpollServer* epoll_server); | 46 EpollServer* epoll_server); |
47 | 47 |
48 virtual ~MockableQuicClient() OVERRIDE; | 48 virtual ~MockableQuicClient() override; |
49 virtual QuicPacketWriter* CreateQuicPacketWriter() OVERRIDE; | 49 virtual QuicPacketWriter* CreateQuicPacketWriter() override; |
50 virtual QuicConnectionId GenerateConnectionId() OVERRIDE; | 50 virtual QuicConnectionId GenerateConnectionId() override; |
51 void UseWriter(QuicPacketWriterWrapper* writer); | 51 void UseWriter(QuicPacketWriterWrapper* writer); |
52 void UseConnectionId(QuicConnectionId connection_id); | 52 void UseConnectionId(QuicConnectionId connection_id); |
53 | 53 |
54 private: | 54 private: |
55 QuicConnectionId override_connection_id_; // ConnectionId to use, if nonzero | 55 QuicConnectionId override_connection_id_; // ConnectionId to use, if nonzero |
56 QuicPacketWriterWrapper* test_writer_; | 56 QuicPacketWriterWrapper* test_writer_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(MockableQuicClient); | 58 DISALLOW_COPY_AND_ASSIGN(MockableQuicClient); |
59 }; | 59 }; |
60 | 60 |
(...skipping 23 matching lines...) Expand all Loading... |
84 | 84 |
85 // Sets the |user_agent_id| of the |client_|. | 85 // Sets the |user_agent_id| of the |client_|. |
86 void SetUserAgentID(const string& user_agent_id); | 86 void SetUserAgentID(const string& user_agent_id); |
87 | 87 |
88 // Wraps data in a quic packet and sends it. | 88 // Wraps data in a quic packet and sends it. |
89 ssize_t SendData(string data, bool last_data); | 89 ssize_t SendData(string data, bool last_data); |
90 | 90 |
91 // From SimpleClient | 91 // From SimpleClient |
92 // Clears any outstanding state and sends a simple GET of 'uri' to the | 92 // Clears any outstanding state and sends a simple GET of 'uri' to the |
93 // server. Returns 0 if the request failed and no bytes were written. | 93 // server. Returns 0 if the request failed and no bytes were written. |
94 virtual ssize_t SendRequest(const string& uri) OVERRIDE; | 94 virtual ssize_t SendRequest(const string& uri) override; |
95 virtual ssize_t SendMessage(const HTTPMessage& message) OVERRIDE; | 95 virtual ssize_t SendMessage(const HTTPMessage& message) override; |
96 virtual string SendCustomSynchronousRequest( | 96 virtual string SendCustomSynchronousRequest( |
97 const HTTPMessage& message) OVERRIDE; | 97 const HTTPMessage& message) override; |
98 virtual string SendSynchronousRequest(const string& uri) OVERRIDE; | 98 virtual string SendSynchronousRequest(const string& uri) override; |
99 virtual void Connect() OVERRIDE; | 99 virtual void Connect() override; |
100 virtual void ResetConnection() OVERRIDE; | 100 virtual void ResetConnection() override; |
101 virtual void Disconnect() OVERRIDE; | 101 virtual void Disconnect() override; |
102 virtual IPEndPoint LocalSocketAddress() const OVERRIDE; | 102 virtual IPEndPoint LocalSocketAddress() const override; |
103 virtual void ClearPerRequestState() OVERRIDE; | 103 virtual void ClearPerRequestState() override; |
104 virtual void WaitForResponseForMs(int timeout_ms) OVERRIDE; | 104 virtual void WaitForResponseForMs(int timeout_ms) override; |
105 virtual void WaitForInitialResponseForMs(int timeout_ms) OVERRIDE; | 105 virtual void WaitForInitialResponseForMs(int timeout_ms) override; |
106 virtual ssize_t Send(const void *buffer, size_t size) OVERRIDE; | 106 virtual ssize_t Send(const void *buffer, size_t size) override; |
107 virtual bool response_complete() const OVERRIDE; | 107 virtual bool response_complete() const override; |
108 virtual bool response_headers_complete() const OVERRIDE; | 108 virtual bool response_headers_complete() const override; |
109 virtual const BalsaHeaders* response_headers() const OVERRIDE; | 109 virtual const BalsaHeaders* response_headers() const override; |
110 virtual int64 response_size() const OVERRIDE; | 110 virtual int64 response_size() const override; |
111 virtual int response_header_size() const OVERRIDE; | 111 virtual int response_header_size() const override; |
112 virtual int64 response_body_size() const OVERRIDE; | 112 virtual int64 response_body_size() const override; |
113 virtual size_t bytes_read() const OVERRIDE; | 113 virtual size_t bytes_read() const override; |
114 virtual size_t bytes_written() const OVERRIDE; | 114 virtual size_t bytes_written() const override; |
115 virtual bool buffer_body() const OVERRIDE; | 115 virtual bool buffer_body() const override; |
116 virtual void set_buffer_body(bool buffer_body) OVERRIDE; | 116 virtual void set_buffer_body(bool buffer_body) override; |
117 virtual bool ServerInLameDuckMode() const OVERRIDE; | 117 virtual bool ServerInLameDuckMode() const override; |
118 virtual const string& response_body() OVERRIDE; | 118 virtual const string& response_body() override; |
119 virtual bool connected() const OVERRIDE; | 119 virtual bool connected() const override; |
120 // These functions are all unimplemented functions from SimpleClient, and log | 120 // These functions are all unimplemented functions from SimpleClient, and log |
121 // DFATAL if called by users of SimpleClient. | 121 // DFATAL if called by users of SimpleClient. |
122 virtual ssize_t SendAndWaitForResponse(const void *buffer, | 122 virtual ssize_t SendAndWaitForResponse(const void *buffer, |
123 size_t size) OVERRIDE; | 123 size_t size) override; |
124 virtual void Bind(IPEndPoint* local_address) OVERRIDE; | 124 virtual void Bind(IPEndPoint* local_address) override; |
125 virtual string SerializeMessage(const HTTPMessage& message) OVERRIDE; | 125 virtual string SerializeMessage(const HTTPMessage& message) override; |
126 virtual IPAddressNumber bind_to_address() const OVERRIDE; | 126 virtual IPAddressNumber bind_to_address() const override; |
127 virtual void set_bind_to_address(IPAddressNumber address) OVERRIDE; | 127 virtual void set_bind_to_address(IPAddressNumber address) override; |
128 virtual const IPEndPoint& address() const OVERRIDE; | 128 virtual const IPEndPoint& address() const override; |
129 virtual size_t requests_sent() const OVERRIDE; | 129 virtual size_t requests_sent() const override; |
130 | 130 |
131 // From QuicDataStream::Visitor | 131 // From QuicDataStream::Visitor |
132 virtual void OnClose(QuicDataStream* stream) OVERRIDE; | 132 virtual void OnClose(QuicDataStream* stream) override; |
133 | 133 |
134 // Configures client_ to take ownership of and use the writer. | 134 // Configures client_ to take ownership of and use the writer. |
135 // Must be called before initial connect. | 135 // Must be called before initial connect. |
136 void UseWriter(QuicPacketWriterWrapper* writer); | 136 void UseWriter(QuicPacketWriterWrapper* writer); |
137 // If the given ConnectionId is nonzero, configures client_ to use a specific | 137 // If the given ConnectionId is nonzero, configures client_ to use a specific |
138 // ConnectionId instead of a random one. | 138 // ConnectionId instead of a random one. |
139 void UseConnectionId(QuicConnectionId connection_id); | 139 void UseConnectionId(QuicConnectionId connection_id); |
140 | 140 |
141 // Returns nullptr if the maximum number of streams have already been created. | 141 // Returns nullptr if the maximum number of streams have already been created. |
142 QuicSpdyClientStream* GetOrCreateStream(); | 142 QuicSpdyClientStream* GetOrCreateStream(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); | 208 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); |
209 }; | 209 }; |
210 | 210 |
211 } // namespace test | 211 } // namespace test |
212 | 212 |
213 } // namespace tools | 213 } // namespace tools |
214 } // namespace net | 214 } // namespace net |
215 | 215 |
216 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ | 216 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
OLD | NEW |