| 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_failed_job.h" | 5 #include "net/test/url_request/url_request_failed_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return AddUrlHandlerForHostname(kMockHostname); | 129 return AddUrlHandlerForHostname(kMockHostname); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // static | 132 // static |
| 133 void URLRequestFailedJob::AddUrlHandlerForHostname( | 133 void URLRequestFailedJob::AddUrlHandlerForHostname( |
| 134 const std::string& hostname) { | 134 const std::string& hostname) { |
| 135 URLRequestFilter* filter = URLRequestFilter::GetInstance(); | 135 URLRequestFilter* filter = URLRequestFilter::GetInstance(); |
| 136 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. | 136 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. |
| 137 filter->AddHostnameInterceptor( | 137 filter->AddHostnameInterceptor( |
| 138 "http", hostname, | 138 "http", hostname, |
| 139 scoped_ptr<URLRequestInterceptor>(new MockJobInterceptor())); | 139 std::unique_ptr<URLRequestInterceptor>(new MockJobInterceptor())); |
| 140 filter->AddHostnameInterceptor( | 140 filter->AddHostnameInterceptor( |
| 141 "https", hostname, | 141 "https", hostname, |
| 142 scoped_ptr<URLRequestInterceptor>(new MockJobInterceptor())); | 142 std::unique_ptr<URLRequestInterceptor>(new MockJobInterceptor())); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // static | 145 // static |
| 146 GURL URLRequestFailedJob::GetMockHttpUrl(int net_error) { | 146 GURL URLRequestFailedJob::GetMockHttpUrl(int net_error) { |
| 147 return GetMockHttpUrlForHostname(net_error, kMockHostname); | 147 return GetMockHttpUrlForHostname(net_error, kMockHostname); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // static | 150 // static |
| 151 GURL URLRequestFailedJob::GetMockHttpsUrl(int net_error) { | 151 GURL URLRequestFailedJob::GetMockHttpsUrl(int net_error) { |
| 152 return GetMockHttpsUrlForHostname(net_error, kMockHostname); | 152 return GetMockHttpsUrlForHostname(net_error, kMockHostname); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 181 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_)); | 181 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_)); |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 return; | 184 return; |
| 185 } | 185 } |
| 186 response_info_.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK"); | 186 response_info_.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK"); |
| 187 NotifyHeadersComplete(); | 187 NotifyHeadersComplete(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace net | 190 } // namespace net |
| OLD | NEW |