| 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/test/url_request/url_request_slow_download_job.h" | 5 #include "net/test/url_request/url_request_slow_download_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 "Cache-Control: max-age=0\n"); | 266 "Cache-Control: max-age=0\n"); |
| 267 | 267 |
| 268 if (base::LowerCaseEqualsASCII(kKnownSizeUrl, | 268 if (base::LowerCaseEqualsASCII(kKnownSizeUrl, |
| 269 request_->url().spec().c_str())) { | 269 request_->url().spec().c_str())) { |
| 270 raw_headers.append(base::StringPrintf( | 270 raw_headers.append(base::StringPrintf( |
| 271 "Content-Length: %d\n", kFirstDownloadSize + kSecondDownloadSize)); | 271 "Content-Length: %d\n", kFirstDownloadSize + kSecondDownloadSize)); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 // ParseRawHeaders expects \0 to end each header line. | 275 // ParseRawHeaders expects \0 to end each header line. |
| 276 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); | 276 base::ReplaceSubstringsAfterOffset( |
| 277 &raw_headers, 0, "\n", base::StringPiece("\0", 1)); |
| 277 info->headers = new HttpResponseHeaders(raw_headers); | 278 info->headers = new HttpResponseHeaders(raw_headers); |
| 278 } | 279 } |
| 279 | 280 |
| 280 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { | 281 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { |
| 281 HttpResponseInfo info; | 282 HttpResponseInfo info; |
| 282 GetResponseInfoConst(&info); | 283 GetResponseInfoConst(&info); |
| 283 return info.headers.get() && info.headers->GetMimeType(mime_type); | 284 return info.headers.get() && info.headers->GetMimeType(mime_type); |
| 284 } | 285 } |
| 285 | 286 |
| 286 } // namespace net | 287 } // namespace net |
| OLD | NEW |