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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void set_allow_bidirectional_data(bool value) { | 195 void set_allow_bidirectional_data(bool value) { |
196 allow_bidirectional_data_ = value; | 196 allow_bidirectional_data_ = value; |
197 } | 197 } |
198 | 198 |
199 bool allow_bidirectional_data() const { return allow_bidirectional_data_; } | 199 bool allow_bidirectional_data() const { return allow_bidirectional_data_; } |
200 | 200 |
201 size_t num_requests() const { return num_requests_; } | 201 size_t num_requests() const { return num_requests_; } |
202 | 202 |
203 size_t num_responses() const { return num_responses_; } | 203 size_t num_responses() const { return num_responses_; } |
204 | 204 |
| 205 // Explicitly set the SNI value for this client, overriding the default |
| 206 // behavior which extracts the SNI value from the request URL. |
| 207 void OverrideSni(const std::string& sni) { |
| 208 override_sni_set_ = true; |
| 209 override_sni_ = sni; |
| 210 } |
| 211 |
205 protected: | 212 protected: |
206 QuicTestClient(); | 213 QuicTestClient(); |
207 | 214 |
208 void Initialize(); | 215 void Initialize(); |
209 | 216 |
210 void set_client(MockableQuicClient* client) { client_.reset(client); } | 217 void set_client(MockableQuicClient* client) { client_.reset(client); } |
211 | 218 |
212 private: | 219 private: |
213 class TestClientDataToResend : public QuicClient::QuicDataToResend { | 220 class TestClientDataToResend : public QuicClient::QuicDataToResend { |
214 public: | 221 public: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // When true allows the sending of a request to continue while the response is | 274 // When true allows the sending of a request to continue while the response is |
268 // arriving. | 275 // arriving. |
269 bool allow_bidirectional_data_; | 276 bool allow_bidirectional_data_; |
270 // For async push promise rendezvous, validation may fail in which | 277 // For async push promise rendezvous, validation may fail in which |
271 // case the request should be retried. | 278 // case the request should be retried. |
272 std::unique_ptr<TestClientDataToResend> push_promise_data_to_resend_; | 279 std::unique_ptr<TestClientDataToResend> push_promise_data_to_resend_; |
273 // Number of requests/responses this client has sent/received. | 280 // Number of requests/responses this client has sent/received. |
274 size_t num_requests_; | 281 size_t num_requests_; |
275 size_t num_responses_; | 282 size_t num_responses_; |
276 | 283 |
| 284 // If set, this value is used for the connection SNI, overriding the usual |
| 285 // logic which extracts the SNI from the request URL. |
| 286 bool override_sni_set_ = false; |
| 287 std::string override_sni_; |
| 288 |
277 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); | 289 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); |
278 }; | 290 }; |
279 | 291 |
280 } // namespace test | 292 } // namespace test |
281 | 293 |
282 } // namespace net | 294 } // namespace net |
283 | 295 |
284 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ | 296 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ |
OLD | NEW |