| 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 #include "net/tools/quic/test_tools/quic_test_client.h" | 5 #include "net/tools/quic/test_tools/quic_test_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 QuicTestClient::QuicTestClient(QuicSocketAddress server_address, | 208 QuicTestClient::QuicTestClient(QuicSocketAddress server_address, |
| 209 const string& server_hostname, | 209 const string& server_hostname, |
| 210 const QuicConfig& config, | 210 const QuicConfig& config, |
| 211 const QuicVersionVector& supported_versions) | 211 const QuicVersionVector& supported_versions) |
| 212 : client_(new MockableQuicClient(server_address, | 212 : client_(new MockableQuicClient(server_address, |
| 213 QuicServerId(server_hostname, | 213 QuicServerId(server_hostname, |
| 214 server_address.port(), | 214 server_address.port(), |
| 215 PRIVACY_MODE_DISABLED), | 215 PRIVACY_MODE_DISABLED), |
| 216 config, | 216 config, |
| 217 supported_versions, | 217 supported_versions, |
| 218 &epoll_server_)), | 218 &epoll_server_)) { |
| 219 allow_bidirectional_data_(false) { | |
| 220 Initialize(); | 219 Initialize(); |
| 221 } | 220 } |
| 222 | 221 |
| 223 QuicTestClient::QuicTestClient(QuicSocketAddress server_address, | 222 QuicTestClient::QuicTestClient(QuicSocketAddress server_address, |
| 224 const string& server_hostname, | 223 const string& server_hostname, |
| 225 const QuicConfig& config, | 224 const QuicConfig& config, |
| 226 const QuicVersionVector& supported_versions, | 225 const QuicVersionVector& supported_versions, |
| 227 std::unique_ptr<ProofVerifier> proof_verifier) | 226 std::unique_ptr<ProofVerifier> proof_verifier) |
| 228 : client_(new MockableQuicClient(server_address, | 227 : client_(new MockableQuicClient(server_address, |
| 229 QuicServerId(server_hostname, | 228 QuicServerId(server_hostname, |
| 230 server_address.port(), | 229 server_address.port(), |
| 231 PRIVACY_MODE_DISABLED), | 230 PRIVACY_MODE_DISABLED), |
| 232 config, | 231 config, |
| 233 supported_versions, | 232 supported_versions, |
| 234 &epoll_server_, | 233 &epoll_server_, |
| 235 std::move(proof_verifier))), | 234 std::move(proof_verifier))) { |
| 236 allow_bidirectional_data_(false) { | |
| 237 Initialize(); | 235 Initialize(); |
| 238 } | 236 } |
| 239 | 237 |
| 240 QuicTestClient::QuicTestClient() : allow_bidirectional_data_(false) {} | 238 QuicTestClient::QuicTestClient() {} |
| 241 | 239 |
| 242 QuicTestClient::~QuicTestClient() { | 240 QuicTestClient::~QuicTestClient() { |
| 243 for (std::pair<QuicStreamId, QuicSpdyClientStream*> stream : open_streams_) { | 241 for (std::pair<QuicStreamId, QuicSpdyClientStream*> stream : open_streams_) { |
| 244 stream.second->set_visitor(nullptr); | 242 stream.second->set_visitor(nullptr); |
| 245 } | 243 } |
| 246 } | 244 } |
| 247 | 245 |
| 248 void QuicTestClient::Initialize() { | 246 void QuicTestClient::Initialize() { |
| 249 priority_ = 3; | 247 priority_ = 3; |
| 250 connect_attempted_ = false; | 248 connect_attempted_ = false; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 return nullptr; | 431 return nullptr; |
| 434 } | 432 } |
| 435 } | 433 } |
| 436 if (open_streams_.empty()) { | 434 if (open_streams_.empty()) { |
| 437 ClearPerConnectionState(); | 435 ClearPerConnectionState(); |
| 438 } | 436 } |
| 439 if (!latest_created_stream_) { | 437 if (!latest_created_stream_) { |
| 440 SetLatestCreatedStream(client_->CreateClientStream()); | 438 SetLatestCreatedStream(client_->CreateClientStream()); |
| 441 if (latest_created_stream_) { | 439 if (latest_created_stream_) { |
| 442 latest_created_stream_->SetPriority(priority_); | 440 latest_created_stream_->SetPriority(priority_); |
| 443 latest_created_stream_->set_allow_bidirectional_data( | |
| 444 allow_bidirectional_data_); | |
| 445 } | 441 } |
| 446 } | 442 } |
| 447 | 443 |
| 448 return latest_created_stream_; | 444 return latest_created_stream_; |
| 449 } | 445 } |
| 450 | 446 |
| 451 QuicErrorCode QuicTestClient::connection_error() { | 447 QuicErrorCode QuicTestClient::connection_error() { |
| 452 return client()->connection_error(); | 448 return client()->connection_error(); |
| 453 } | 449 } |
| 454 | 450 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 | 787 |
| 792 void QuicTestClient::ClearPerConnectionState() { | 788 void QuicTestClient::ClearPerConnectionState() { |
| 793 ClearPerRequestState(); | 789 ClearPerRequestState(); |
| 794 open_streams_.clear(); | 790 open_streams_.clear(); |
| 795 closed_stream_states_.clear(); | 791 closed_stream_states_.clear(); |
| 796 latest_created_stream_ = nullptr; | 792 latest_created_stream_ = nullptr; |
| 797 } | 793 } |
| 798 | 794 |
| 799 } // namespace test | 795 } // namespace test |
| 800 } // namespace net | 796 } // namespace net |
| OLD | NEW |