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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 "http://www.google.com"; | 93 "http://www.google.com"; |
94 full_uri.append(uri.as_string()); | 94 full_uri.append(uri.as_string()); |
95 headers->SetRequestUri(full_uri); | 95 headers->SetRequestUri(full_uri); |
96 } | 96 } |
97 return headers; | 97 return headers; |
98 } | 98 } |
99 | 99 |
100 MockableQuicClient::MockableQuicClient( | 100 MockableQuicClient::MockableQuicClient( |
101 IPEndPoint server_address, | 101 IPEndPoint server_address, |
102 const QuicServerId& server_id, | 102 const QuicServerId& server_id, |
103 const QuicVersionVector& supported_versions, | 103 const QuicVersionVector& supported_versions) |
104 uint32 initial_flow_control_window) | |
105 : QuicClient(server_address, | 104 : QuicClient(server_address, |
106 server_id, | 105 server_id, |
107 supported_versions, | 106 supported_versions, |
108 false, | 107 false), |
109 initial_flow_control_window), | |
110 override_connection_id_(0), | 108 override_connection_id_(0), |
111 test_writer_(NULL) {} | 109 test_writer_(NULL) {} |
112 | 110 |
113 MockableQuicClient::MockableQuicClient( | 111 MockableQuicClient::MockableQuicClient( |
114 IPEndPoint server_address, | 112 IPEndPoint server_address, |
115 const QuicServerId& server_id, | 113 const QuicServerId& server_id, |
116 const QuicConfig& config, | 114 const QuicConfig& config, |
117 const QuicVersionVector& supported_versions, | 115 const QuicVersionVector& supported_versions) |
118 uint32 initial_flow_control_window) | |
119 : QuicClient(server_address, | 116 : QuicClient(server_address, |
120 server_id, | 117 server_id, |
121 config, | |
122 supported_versions, | 118 supported_versions, |
123 initial_flow_control_window), | 119 false, |
| 120 config), |
124 override_connection_id_(0), | 121 override_connection_id_(0), |
125 test_writer_(NULL) {} | 122 test_writer_(NULL) {} |
126 | 123 |
127 MockableQuicClient::~MockableQuicClient() { | 124 MockableQuicClient::~MockableQuicClient() { |
128 if (connected()) { | 125 if (connected()) { |
129 Disconnect(); | 126 Disconnect(); |
130 } | 127 } |
131 } | 128 } |
132 | 129 |
133 QuicPacketWriter* MockableQuicClient::CreateQuicPacketWriter() { | 130 QuicPacketWriter* MockableQuicClient::CreateQuicPacketWriter() { |
(...skipping 21 matching lines...) Expand all Loading... |
155 } | 152 } |
156 | 153 |
157 QuicTestClient::QuicTestClient(IPEndPoint server_address, | 154 QuicTestClient::QuicTestClient(IPEndPoint server_address, |
158 const string& server_hostname, | 155 const string& server_hostname, |
159 const QuicVersionVector& supported_versions) | 156 const QuicVersionVector& supported_versions) |
160 : client_(new MockableQuicClient(server_address, | 157 : client_(new MockableQuicClient(server_address, |
161 QuicServerId(server_hostname, | 158 QuicServerId(server_hostname, |
162 server_address.port(), | 159 server_address.port(), |
163 false, | 160 false, |
164 PRIVACY_MODE_DISABLED), | 161 PRIVACY_MODE_DISABLED), |
165 supported_versions, | 162 supported_versions)) { |
166 kInitialFlowControlWindowForTest)) { | |
167 Initialize(true); | 163 Initialize(true); |
168 } | 164 } |
169 | 165 |
170 QuicTestClient::QuicTestClient(IPEndPoint server_address, | 166 QuicTestClient::QuicTestClient(IPEndPoint server_address, |
171 const string& server_hostname, | 167 const string& server_hostname, |
172 bool secure, | 168 bool secure, |
173 const QuicVersionVector& supported_versions) | 169 const QuicVersionVector& supported_versions) |
174 : client_(new MockableQuicClient(server_address, | 170 : client_(new MockableQuicClient(server_address, |
175 QuicServerId(server_hostname, | 171 QuicServerId(server_hostname, |
176 server_address.port(), | 172 server_address.port(), |
177 secure, | 173 secure, |
178 PRIVACY_MODE_DISABLED), | 174 PRIVACY_MODE_DISABLED), |
179 supported_versions, | 175 supported_versions)) { |
180 kInitialFlowControlWindowForTest)) { | |
181 Initialize(secure); | 176 Initialize(secure); |
182 } | 177 } |
183 | 178 |
184 QuicTestClient::QuicTestClient( | 179 QuicTestClient::QuicTestClient( |
185 IPEndPoint server_address, | 180 IPEndPoint server_address, |
186 const string& server_hostname, | 181 const string& server_hostname, |
187 bool secure, | 182 bool secure, |
188 const QuicConfig& config, | 183 const QuicConfig& config, |
189 const QuicVersionVector& supported_versions, | 184 const QuicVersionVector& supported_versions) |
190 uint32 client_initial_flow_control_receive_window) | |
191 : client_( | 185 : client_( |
192 new MockableQuicClient(server_address, | 186 new MockableQuicClient(server_address, |
193 QuicServerId(server_hostname, | 187 QuicServerId(server_hostname, |
194 server_address.port(), | 188 server_address.port(), |
195 secure, | 189 secure, |
196 PRIVACY_MODE_DISABLED), | 190 PRIVACY_MODE_DISABLED), |
197 config, | 191 config, |
198 supported_versions, | 192 supported_versions)) { |
199 client_initial_flow_control_receive_window)) { | |
200 Initialize(secure); | 193 Initialize(secure); |
201 } | 194 } |
202 | 195 |
203 QuicTestClient::QuicTestClient() { | 196 QuicTestClient::QuicTestClient() { |
204 } | 197 } |
205 | 198 |
206 QuicTestClient::~QuicTestClient() { | 199 QuicTestClient::~QuicTestClient() { |
207 if (stream_) { | 200 if (stream_) { |
208 stream_->set_visitor(NULL); | 201 stream_->set_visitor(NULL); |
209 } | 202 } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 534 |
542 void QuicTestClient::WaitForWriteToFlush() { | 535 void QuicTestClient::WaitForWriteToFlush() { |
543 while (connected() && client()->session()->HasDataToWrite()) { | 536 while (connected() && client()->session()->HasDataToWrite()) { |
544 client_->WaitForEvents(); | 537 client_->WaitForEvents(); |
545 } | 538 } |
546 } | 539 } |
547 | 540 |
548 } // namespace test | 541 } // namespace test |
549 } // namespace tools | 542 } // namespace tools |
550 } // namespace net | 543 } // namespace net |
OLD | NEW |