| 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 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const string& server_hostname, | 176 const string& server_hostname, |
| 177 const QuicConfig& config, | 177 const QuicConfig& config, |
| 178 const QuicVersionVector& supported_versions) | 178 const QuicVersionVector& supported_versions) |
| 179 : client_(new MockableQuicClient(server_address, | 179 : client_(new MockableQuicClient(server_address, |
| 180 QuicServerId(server_hostname, | 180 QuicServerId(server_hostname, |
| 181 server_address.port(), | 181 server_address.port(), |
| 182 PRIVACY_MODE_DISABLED), | 182 PRIVACY_MODE_DISABLED), |
| 183 config, | 183 config, |
| 184 supported_versions, | 184 supported_versions, |
| 185 &epoll_server_)), | 185 &epoll_server_)), |
| 186 allow_bidirectional_data_(false), | 186 allow_bidirectional_data_(false) { |
| 187 num_requests_(0), | |
| 188 num_responses_(0) { | |
| 189 Initialize(); | 187 Initialize(); |
| 190 } | 188 } |
| 191 | 189 |
| 192 QuicTestClient::QuicTestClient() : allow_bidirectional_data_(false) {} | 190 QuicTestClient::QuicTestClient() : allow_bidirectional_data_(false) {} |
| 193 | 191 |
| 194 QuicTestClient::~QuicTestClient() { | 192 QuicTestClient::~QuicTestClient() { |
| 195 if (stream_) { | 193 if (stream_) { |
| 196 stream_->set_visitor(nullptr); | 194 stream_->set_visitor(nullptr); |
| 197 } | 195 } |
| 198 client_->Disconnect(); | 196 client_->Disconnect(); |
| 199 } | 197 } |
| 200 | 198 |
| 201 void QuicTestClient::Initialize() { | 199 void QuicTestClient::Initialize() { |
| 202 priority_ = 3; | 200 priority_ = 3; |
| 203 connect_attempted_ = false; | 201 connect_attempted_ = false; |
| 204 auto_reconnect_ = false; | 202 auto_reconnect_ = false; |
| 205 buffer_body_ = true; | 203 buffer_body_ = true; |
| 204 num_requests_ = 0; |
| 205 num_responses_ = 0; |
| 206 ClearPerRequestState(); | 206 ClearPerRequestState(); |
| 207 // As chrome will generally do this, we want it to be the default when it's | 207 // As chrome will generally do this, we want it to be the default when it's |
| 208 // not overridden. | 208 // not overridden. |
| 209 if (!client_->config()->HasSetBytesForConnectionIdToSend()) { | 209 if (!client_->config()->HasSetBytesForConnectionIdToSend()) { |
| 210 client_->config()->SetBytesForConnectionIdToSend(0); | 210 client_->config()->SetBytesForConnectionIdToSend(0); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void QuicTestClient::SetUserAgentID(const string& user_agent_id) { | 214 void QuicTestClient::SetUserAgentID(const string& user_agent_id) { |
| 215 client_->SetUserAgentID(user_agent_id); | 215 client_->SetUserAgentID(user_agent_id); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 CHECK(message); | 666 CHECK(message); |
| 667 message->headers()->SetRequestVersion( | 667 message->headers()->SetRequestVersion( |
| 668 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 668 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
| 669 message->headers()->SetRequestMethod( | 669 message->headers()->SetRequestMethod( |
| 670 HTTPMessage::MethodToString(HttpConstants::GET)); | 670 HTTPMessage::MethodToString(HttpConstants::GET)); |
| 671 message->headers()->SetRequestUri(uri); | 671 message->headers()->SetRequestUri(uri); |
| 672 } | 672 } |
| 673 | 673 |
| 674 } // namespace test | 674 } // namespace test |
| 675 } // namespace net | 675 } // namespace net |
| OLD | NEW |