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