| Index: net/test/url_request/url_request_mock_http_job.cc
|
| diff --git a/net/test/url_request/url_request_mock_http_job.cc b/net/test/url_request/url_request_mock_http_job.cc
|
| index ede87cfeabdb86a0fb1fb849699f339cc3fc4e65..d8dd8c8809291f3da201348e133a46270aa940ba 100644
|
| --- a/net/test/url_request/url_request_mock_http_job.cc
|
| +++ b/net/test/url_request/url_request_mock_http_job.cc
|
| @@ -99,13 +99,15 @@ std::string DoFileIO(const base::FilePath& file_path) {
|
| } // namespace
|
|
|
| // static
|
| -void URLRequestMockHTTPJob::AddUrlHandler(
|
| +void URLRequestMockHTTPJob::AddUrlHandlers(
|
| const base::FilePath& base_path,
|
| const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
|
| - // Add kMockHostname to net::URLRequestFilter.
|
| + // Add kMockHostname to net::URLRequestFilter, for both HTTP and HTTPS.
|
| net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
|
| filter->AddHostnameInterceptor(
|
| "http", kMockHostname, CreateInterceptor(base_path, worker_pool));
|
| + filter->AddHostnameInterceptor("https", kMockHostname,
|
| + CreateInterceptor(base_path, worker_pool));
|
| }
|
|
|
| // static
|
| @@ -120,13 +122,12 @@ void URLRequestMockHTTPJob::AddHostnameToFileHandler(
|
|
|
| // static
|
| GURL URLRequestMockHTTPJob::GetMockUrl(const base::FilePath& path) {
|
| - std::string url = "http://";
|
| - url.append(kMockHostname);
|
| - url.append("/");
|
| - std::string path_str = path.MaybeAsASCII();
|
| - DCHECK(!path_str.empty()); // We only expect ASCII paths in tests.
|
| - url.append(path_str);
|
| - return GURL(url);
|
| + return GetMockUrlForScheme(path, "http");
|
| +}
|
| +
|
| +// static
|
| +GURL URLRequestMockHTTPJob::GetMockHttpsUrl(const base::FilePath& path) {
|
| + return GetMockUrlForScheme(path, "https");
|
| }
|
|
|
| // static
|
| @@ -175,6 +176,18 @@ URLRequestMockHTTPJob::URLRequestMockHTTPJob(
|
| URLRequestMockHTTPJob::~URLRequestMockHTTPJob() {
|
| }
|
|
|
| +// static
|
| +GURL URLRequestMockHTTPJob::GetMockUrlForScheme(const base::FilePath& path,
|
| + const std::string& scheme) {
|
| + std::string url = scheme + "://";
|
| + url.append(kMockHostname);
|
| + url.append("/");
|
| + std::string path_str = path.MaybeAsASCII();
|
| + DCHECK(!path_str.empty()); // We only expect ASCII paths in tests.
|
| + url.append(path_str);
|
| + return GURL(url);
|
| +}
|
| +
|
| // Public virtual version.
|
| void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
| // Forward to private const version.
|
|
|