| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 *bytes_read = to_read; | 207 *bytes_read = to_read; |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void URLRequestTestJob::GetResponseInfo(HttpResponseInfo* info) { | 211 void URLRequestTestJob::GetResponseInfo(HttpResponseInfo* info) { |
| 212 if (response_headers_) | 212 if (response_headers_) |
| 213 info->headers = response_headers_; | 213 info->headers = response_headers_; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void URLRequestTestJob::GetLoadTimingInfo( |
| 217 LoadTimingInfo* load_timing_info) const { |
| 218 // Preserve the times the URLRequest is responsible for, but overwrite all |
| 219 // the others. |
| 220 base::TimeTicks request_start = load_timing_info->request_start; |
| 221 base::Time request_start_time = load_timing_info->request_start_time; |
| 222 *load_timing_info = load_timing_info_; |
| 223 load_timing_info->request_start = request_start; |
| 224 load_timing_info->request_start_time = request_start_time; |
| 225 } |
| 226 |
| 216 int URLRequestTestJob::GetResponseCode() const { | 227 int URLRequestTestJob::GetResponseCode() const { |
| 217 if (response_headers_) | 228 if (response_headers_) |
| 218 return response_headers_->response_code(); | 229 return response_headers_->response_code(); |
| 219 return -1; | 230 return -1; |
| 220 } | 231 } |
| 221 | 232 |
| 222 bool URLRequestTestJob::IsRedirectResponse(GURL* location, | 233 bool URLRequestTestJob::IsRedirectResponse(GURL* location, |
| 223 int* http_status_code) { | 234 int* http_status_code) { |
| 224 if (!response_headers_) | 235 if (!response_headers_) |
| 225 return false; | 236 return false; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 311 |
| 301 URLRequestTestJob* next_job(g_pending_jobs.Get().front()); | 312 URLRequestTestJob* next_job(g_pending_jobs.Get().front()); |
| 302 g_pending_jobs.Get().pop_front(); | 313 g_pending_jobs.Get().pop_front(); |
| 303 | 314 |
| 304 DCHECK(!next_job->auto_advance()); // auto_advance jobs should be in this q | 315 DCHECK(!next_job->auto_advance()); // auto_advance jobs should be in this q |
| 305 next_job->ProcessNextOperation(); | 316 next_job->ProcessNextOperation(); |
| 306 return true; | 317 return true; |
| 307 } | 318 } |
| 308 | 319 |
| 309 } // namespace net | 320 } // namespace net |
| OLD | NEW |