Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: net/test/url_request/url_request_mock_http_job.cc

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/test/url_request/url_request_mock_http_job.h ('k') | net/tools/net_watcher/net_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_mock_http_job.h" 5 #include "net/test/url_request/url_request_mock_http_job.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const scoped_refptr<base::SequencedWorkerPool>& worker_pool) { 115 const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
116 // Add kMockHostname to net::URLRequestFilter, for both HTTP and HTTPS. 116 // Add kMockHostname to net::URLRequestFilter, for both HTTP and HTTPS.
117 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 117 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
118 filter->AddHostnameInterceptor( 118 filter->AddHostnameInterceptor(
119 "http", kMockHostname, CreateInterceptor(base_path, worker_pool)); 119 "http", kMockHostname, CreateInterceptor(base_path, worker_pool));
120 filter->AddHostnameInterceptor("https", kMockHostname, 120 filter->AddHostnameInterceptor("https", kMockHostname,
121 CreateInterceptor(base_path, worker_pool)); 121 CreateInterceptor(base_path, worker_pool));
122 } 122 }
123 123
124 // static 124 // static
125 void URLRequestMockHTTPJob::AddHostnameToFileHandler(
126 const std::string& hostname,
127 const base::FilePath& file,
128 const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
129 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
130 filter->AddHostnameInterceptor(
131 "http", hostname, CreateInterceptorForSingleFile(file, worker_pool));
132 }
133
134 // static
135 GURL URLRequestMockHTTPJob::GetMockUrl(const base::FilePath& path) { 125 GURL URLRequestMockHTTPJob::GetMockUrl(const base::FilePath& path) {
136 return GetMockUrlForScheme(path, "http"); 126 return GetMockUrlForScheme(path, "http");
137 } 127 }
138 128
139 // static 129 // static
140 GURL URLRequestMockHTTPJob::GetMockHttpsUrl(const base::FilePath& path) { 130 GURL URLRequestMockHTTPJob::GetMockHttpsUrl(const base::FilePath& path) {
141 return GetMockUrlForScheme(path, "https"); 131 return GetMockUrlForScheme(path, "https");
142 } 132 }
143 133
144 // static 134 // static
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return net::URLRequestJob::GetResponseCode(); 279 return net::URLRequestJob::GetResponseCode();
290 } 280 }
291 281
292 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { 282 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) {
293 net::HttpResponseInfo info; 283 net::HttpResponseInfo info;
294 GetResponseInfo(&info); 284 GetResponseInfo(&info);
295 return info.headers.get() && info.headers->GetCharset(charset); 285 return info.headers.get() && info.headers->GetCharset(charset);
296 } 286 }
297 287
298 } // namespace net 288 } // namespace net
OLDNEW
« no previous file with comments | « net/test/url_request/url_request_mock_http_job.h ('k') | net/tools/net_watcher/net_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698