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_mock_http_job.h" | 5 #include "content/test/net/url_request_mock_http_job.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 url.append(kMockHostname); | 88 url.append(kMockHostname); |
89 url.append("/"); | 89 url.append("/"); |
90 std::string path_str = path.MaybeAsASCII(); | 90 std::string path_str = path.MaybeAsASCII(); |
91 DCHECK(!path_str.empty()); // We only expect ASCII paths in tests. | 91 DCHECK(!path_str.empty()); // We only expect ASCII paths in tests. |
92 url.append(path_str); | 92 url.append(path_str); |
93 return GURL(url); | 93 return GURL(url); |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 GURL URLRequestMockHTTPJob::GetMockViewSourceUrl(const base::FilePath& path) { | 97 GURL URLRequestMockHTTPJob::GetMockViewSourceUrl(const base::FilePath& path) { |
98 std::string url = chrome::kViewSourceScheme; | 98 std::string url = kViewSourceScheme; |
99 url.append(":"); | 99 url.append(":"); |
100 url.append(GetMockUrl(path).spec()); | 100 url.append(GetMockUrl(path).spec()); |
101 return GURL(url); | 101 return GURL(url); |
102 } | 102 } |
103 | 103 |
104 // static | 104 // static |
105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
106 URLRequestMockHTTPJob::CreateProtocolHandler(const base::FilePath& base_path) { | 106 URLRequestMockHTTPJob::CreateProtocolHandler(const base::FilePath& base_path) { |
107 return scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 107 return scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
108 new ProtocolHandler(base_path, false)); | 108 new ProtocolHandler(base_path, false)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return net::URLRequestJob::GetResponseCode(); | 162 return net::URLRequestJob::GetResponseCode(); |
163 } | 163 } |
164 | 164 |
165 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { | 165 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { |
166 net::HttpResponseInfo info; | 166 net::HttpResponseInfo info; |
167 GetResponseInfo(&info); | 167 GetResponseInfo(&info); |
168 return info.headers && info.headers->GetCharset(charset); | 168 return info.headers && info.headers->GetCharset(charset); |
169 } | 169 } |
170 | 170 |
171 } // namespace content | 171 } // namespace content |
OLD | NEW |