| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 headers->SetRequestUri(full_uri); | 100 headers->SetRequestUri(full_uri); |
| 101 } | 101 } |
| 102 return headers; | 102 return headers; |
| 103 } | 103 } |
| 104 | 104 |
| 105 MockableQuicClient::MockableQuicClient( | 105 MockableQuicClient::MockableQuicClient( |
| 106 IPEndPoint server_address, | 106 IPEndPoint server_address, |
| 107 const QuicServerId& server_id, | 107 const QuicServerId& server_id, |
| 108 const QuicVersionVector& supported_versions, | 108 const QuicVersionVector& supported_versions, |
| 109 EpollServer* epoll_server) | 109 EpollServer* epoll_server) |
| 110 : QuicClient(server_address, | 110 : MockableQuicClient(server_address, |
| 111 server_id, | 111 server_id, |
| 112 supported_versions, | 112 QuicConfig(), |
| 113 epoll_server, | 113 supported_versions, |
| 114 new RecordingProofVerifier()), | 114 epoll_server) {} |
| 115 override_connection_id_(0), | |
| 116 test_writer_(nullptr) {} | |
| 117 | 115 |
| 118 MockableQuicClient::MockableQuicClient( | 116 MockableQuicClient::MockableQuicClient( |
| 119 IPEndPoint server_address, | 117 IPEndPoint server_address, |
| 120 const QuicServerId& server_id, | 118 const QuicServerId& server_id, |
| 121 const QuicConfig& config, | 119 const QuicConfig& config, |
| 122 const QuicVersionVector& supported_versions, | 120 const QuicVersionVector& supported_versions, |
| 123 EpollServer* epoll_server) | 121 EpollServer* epoll_server) |
| 124 : QuicClient(server_address, | 122 : QuicClient(server_address, |
| 125 server_id, | 123 server_id, |
| 126 supported_versions, | 124 supported_versions, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 156 test_writer_ = writer; | 154 test_writer_ = writer; |
| 157 } | 155 } |
| 158 | 156 |
| 159 void MockableQuicClient::UseConnectionId(QuicConnectionId connection_id) { | 157 void MockableQuicClient::UseConnectionId(QuicConnectionId connection_id) { |
| 160 override_connection_id_ = connection_id; | 158 override_connection_id_ = connection_id; |
| 161 } | 159 } |
| 162 | 160 |
| 163 QuicTestClient::QuicTestClient(IPEndPoint server_address, | 161 QuicTestClient::QuicTestClient(IPEndPoint server_address, |
| 164 const string& server_hostname, | 162 const string& server_hostname, |
| 165 const QuicVersionVector& supported_versions) | 163 const QuicVersionVector& supported_versions) |
| 164 : QuicTestClient(server_address, |
| 165 server_hostname, |
| 166 QuicConfig(), |
| 167 supported_versions) {} |
| 168 |
| 169 QuicTestClient::QuicTestClient(IPEndPoint server_address, |
| 170 const string& server_hostname, |
| 171 const QuicConfig& config, |
| 172 const QuicVersionVector& supported_versions) |
| 166 : client_(new MockableQuicClient(server_address, | 173 : client_(new MockableQuicClient(server_address, |
| 167 QuicServerId(server_hostname, | 174 QuicServerId(server_hostname, |
| 168 server_address.port(), | 175 server_address.port(), |
| 169 PRIVACY_MODE_DISABLED), | 176 PRIVACY_MODE_DISABLED), |
| 177 config, |
| 170 supported_versions, | 178 supported_versions, |
| 171 &epoll_server_)) { | 179 &epoll_server_)) { |
| 172 Initialize(); | 180 Initialize(); |
| 173 } | 181 } |
| 174 | 182 |
| 175 QuicTestClient::QuicTestClient( | 183 QuicTestClient::QuicTestClient() {} |
| 176 IPEndPoint server_address, | |
| 177 const string& server_hostname, | |
| 178 const QuicConfig& config, | |
| 179 const QuicVersionVector& supported_versions) | |
| 180 : client_( | |
| 181 new MockableQuicClient(server_address, | |
| 182 QuicServerId(server_hostname, | |
| 183 server_address.port(), | |
| 184 PRIVACY_MODE_DISABLED), | |
| 185 config, | |
| 186 supported_versions, | |
| 187 &epoll_server_)) { | |
| 188 Initialize(); | |
| 189 } | |
| 190 | |
| 191 QuicTestClient::QuicTestClient() { | |
| 192 } | |
| 193 | 184 |
| 194 QuicTestClient::~QuicTestClient() { | 185 QuicTestClient::~QuicTestClient() { |
| 195 if (stream_) { | 186 if (stream_) { |
| 196 stream_->set_visitor(nullptr); | 187 stream_->set_visitor(nullptr); |
| 197 } | 188 } |
| 198 } | 189 } |
| 199 | 190 |
| 200 void QuicTestClient::Initialize() { | 191 void QuicTestClient::Initialize() { |
| 201 priority_ = 3; | 192 priority_ = 3; |
| 202 connect_attempted_ = false; | 193 connect_attempted_ = false; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 message->headers()->SetRequestVersion( | 611 message->headers()->SetRequestVersion( |
| 621 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 612 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
| 622 message->headers()->SetRequestMethod( | 613 message->headers()->SetRequestMethod( |
| 623 HTTPMessage::MethodToString(HttpConstants::GET)); | 614 HTTPMessage::MethodToString(HttpConstants::GET)); |
| 624 message->headers()->SetRequestUri(uri); | 615 message->headers()->SetRequestUri(uri); |
| 625 } | 616 } |
| 626 | 617 |
| 627 } // namespace test | 618 } // namespace test |
| 628 } // namespace tools | 619 } // namespace tools |
| 629 } // namespace net | 620 } // namespace net |
| OLD | NEW |