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_job.h" | 5 #include "net/url_request/url_request_test_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 LoadTimingInfo* load_timing_info) const { | 289 LoadTimingInfo* load_timing_info) const { |
290 // Preserve the times the URLRequest is responsible for, but overwrite all | 290 // Preserve the times the URLRequest is responsible for, but overwrite all |
291 // the others. | 291 // the others. |
292 base::TimeTicks request_start = load_timing_info->request_start; | 292 base::TimeTicks request_start = load_timing_info->request_start; |
293 base::Time request_start_time = load_timing_info->request_start_time; | 293 base::Time request_start_time = load_timing_info->request_start_time; |
294 *load_timing_info = load_timing_info_; | 294 *load_timing_info = load_timing_info_; |
295 load_timing_info->request_start = request_start; | 295 load_timing_info->request_start = request_start; |
296 load_timing_info->request_start_time = request_start_time; | 296 load_timing_info->request_start_time = request_start_time; |
297 } | 297 } |
298 | 298 |
299 int URLRequestTestJob::GetResponseCode() const { | |
300 if (response_headers_.get()) | |
301 return response_headers_->response_code(); | |
302 return -1; | |
303 } | |
304 | |
305 int64_t URLRequestTestJob::GetTotalReceivedBytes() const { | 299 int64_t URLRequestTestJob::GetTotalReceivedBytes() const { |
306 return response_headers_length_ + offset_; | 300 return response_headers_length_ + offset_; |
307 } | 301 } |
308 | 302 |
309 bool URLRequestTestJob::IsRedirectResponse(GURL* location, | 303 bool URLRequestTestJob::IsRedirectResponse(GURL* location, |
310 int* http_status_code) { | 304 int* http_status_code) { |
311 if (!response_headers_.get()) | 305 if (!response_headers_.get()) |
312 return false; | 306 return false; |
313 | 307 |
314 std::string value; | 308 std::string value; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 380 |
387 URLRequestTestJob* next_job(g_pending_jobs.Get().front()); | 381 URLRequestTestJob* next_job(g_pending_jobs.Get().front()); |
388 g_pending_jobs.Get().pop_front(); | 382 g_pending_jobs.Get().pop_front(); |
389 | 383 |
390 DCHECK(!next_job->auto_advance()); // auto_advance jobs should be in this q | 384 DCHECK(!next_job->auto_advance()); // auto_advance jobs should be in this q |
391 next_job->ProcessNextOperation(); | 385 next_job->ProcessNextOperation(); |
392 return true; | 386 return true; |
393 } | 387 } |
394 | 388 |
395 } // namespace net | 389 } // namespace net |
OLD | NEW |