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/url_request/url_request_test_util.h" | 5 #include "net/url_request/url_request_test_util.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 allow_certificate_errors_(false), | 187 allow_certificate_errors_(false), |
188 response_started_count_(0), | 188 response_started_count_(0), |
189 received_bytes_count_(0), | 189 received_bytes_count_(0), |
190 received_redirect_count_(0), | 190 received_redirect_count_(0), |
191 received_data_before_response_(false), | 191 received_data_before_response_(false), |
192 request_failed_(false), | 192 request_failed_(false), |
193 have_certificate_errors_(false), | 193 have_certificate_errors_(false), |
194 certificate_errors_are_fatal_(false), | 194 certificate_errors_are_fatal_(false), |
195 auth_required_(false), | 195 auth_required_(false), |
196 have_full_request_headers_(false), | 196 have_full_request_headers_(false), |
| 197 response_completed_(false), |
197 request_status_(ERR_IO_PENDING), | 198 request_status_(ERR_IO_PENDING), |
198 buf_(new IOBuffer(kBufferSize)) {} | 199 buf_(new IOBuffer(kBufferSize)) {} |
199 | 200 |
200 TestDelegate::~TestDelegate() {} | 201 TestDelegate::~TestDelegate() {} |
201 | 202 |
202 void TestDelegate::ClearFullRequestHeaders() { | 203 void TestDelegate::ClearFullRequestHeaders() { |
203 full_request_headers_.Clear(); | 204 full_request_headers_.Clear(); |
204 have_full_request_headers_ = false; | 205 have_full_request_headers_ = false; |
205 } | 206 } |
206 | 207 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 311 } |
311 | 312 |
312 request_status_ = bytes_read; | 313 request_status_ = bytes_read; |
313 if (request_status_ != ERR_IO_PENDING) | 314 if (request_status_ != ERR_IO_PENDING) |
314 OnResponseCompleted(request); | 315 OnResponseCompleted(request); |
315 else if (cancel_in_rd_pending_) | 316 else if (cancel_in_rd_pending_) |
316 request_status_ = request->Cancel(); | 317 request_status_ = request->Cancel(); |
317 } | 318 } |
318 | 319 |
319 void TestDelegate::OnResponseCompleted(URLRequest* request) { | 320 void TestDelegate::OnResponseCompleted(URLRequest* request) { |
| 321 response_completed_ = true; |
320 if (quit_on_complete_) | 322 if (quit_on_complete_) |
321 base::ThreadTaskRunnerHandle::Get()->PostTask( | 323 base::ThreadTaskRunnerHandle::Get()->PostTask( |
322 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 324 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
323 } | 325 } |
324 | 326 |
325 TestNetworkDelegate::TestNetworkDelegate() | 327 TestNetworkDelegate::TestNetworkDelegate() |
326 : last_error_(0), | 328 : last_error_(0), |
327 error_count_(0), | 329 error_count_(0), |
328 created_requests_(0), | 330 created_requests_(0), |
329 destroyed_requests_(0), | 331 destroyed_requests_(0), |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 NetworkDelegate* network_delegate) const { | 668 NetworkDelegate* network_delegate) const { |
667 return main_intercept_job_.release(); | 669 return main_intercept_job_.release(); |
668 } | 670 } |
669 | 671 |
670 void TestJobInterceptor::set_main_intercept_job( | 672 void TestJobInterceptor::set_main_intercept_job( |
671 std::unique_ptr<URLRequestJob> job) { | 673 std::unique_ptr<URLRequestJob> job) { |
672 main_intercept_job_ = std::move(job); | 674 main_intercept_job_ = std::move(job); |
673 } | 675 } |
674 | 676 |
675 } // namespace net | 677 } // namespace net |
OLD | NEW |