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 "content/test/net/url_request_slow_download_job.h" | 5 #include "content/test/net/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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
17 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
18 #include "net/url_request/url_request_filter.h" | 18 #include "net/url_request/url_request_filter.h" |
19 | 19 |
20 using content::BrowserThread; | 20 namespace content { |
21 | 21 |
22 const char URLRequestSlowDownloadJob::kUnknownSizeUrl[] = | 22 const char URLRequestSlowDownloadJob::kUnknownSizeUrl[] = |
23 "http://url.handled.by.slow.download/download-unknown-size"; | 23 "http://url.handled.by.slow.download/download-unknown-size"; |
24 const char URLRequestSlowDownloadJob::kKnownSizeUrl[] = | 24 const char URLRequestSlowDownloadJob::kKnownSizeUrl[] = |
25 "http://url.handled.by.slow.download/download-known-size"; | 25 "http://url.handled.by.slow.download/download-known-size"; |
26 const char URLRequestSlowDownloadJob::kFinishDownloadUrl[] = | 26 const char URLRequestSlowDownloadJob::kFinishDownloadUrl[] = |
27 "http://url.handled.by.slow.download/download-finish"; | 27 "http://url.handled.by.slow.download/download-finish"; |
28 | 28 |
29 const int URLRequestSlowDownloadJob::kFirstDownloadSize = 1024 * 35; | 29 const int URLRequestSlowDownloadJob::kFirstDownloadSize = 1024 * 35; |
30 const int URLRequestSlowDownloadJob::kSecondDownloadSize = 1024 * 10; | 30 const int URLRequestSlowDownloadJob::kSecondDownloadSize = 1024 * 10; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // ParseRawHeaders expects \0 to end each header line. | 236 // ParseRawHeaders expects \0 to end each header line. |
237 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); | 237 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); |
238 info->headers = new net::HttpResponseHeaders(raw_headers); | 238 info->headers = new net::HttpResponseHeaders(raw_headers); |
239 } | 239 } |
240 | 240 |
241 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { | 241 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { |
242 net::HttpResponseInfo info; | 242 net::HttpResponseInfo info; |
243 GetResponseInfoConst(&info); | 243 GetResponseInfoConst(&info); |
244 return info.headers && info.headers->GetMimeType(mime_type); | 244 return info.headers && info.headers->GetMimeType(mime_type); |
245 } | 245 } |
| 246 |
| 247 } // namespace content |
OLD | NEW |