OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_data_job.h" | 5 #include "net/test/url_request/url_request_mock_data_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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
14 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
15 #include "net/base/url_util.h" | 16 #include "net/base/url_util.h" |
16 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
17 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
18 #include "net/http/http_util.h" | 19 #include "net/http/http_util.h" |
19 #include "net/ssl/ssl_cert_request_info.h" | 20 #include "net/ssl/ssl_cert_request_info.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void URLRequestMockDataJob::AddUrlHandler() { | 176 void URLRequestMockDataJob::AddUrlHandler() { |
176 return AddUrlHandlerForHostname(kMockHostname); | 177 return AddUrlHandlerForHostname(kMockHostname); |
177 } | 178 } |
178 | 179 |
179 // static | 180 // static |
180 void URLRequestMockDataJob::AddUrlHandlerForHostname( | 181 void URLRequestMockDataJob::AddUrlHandlerForHostname( |
181 const std::string& hostname) { | 182 const std::string& hostname) { |
182 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. | 183 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. |
183 URLRequestFilter* filter = URLRequestFilter::GetInstance(); | 184 URLRequestFilter* filter = URLRequestFilter::GetInstance(); |
184 filter->AddHostnameInterceptor("http", hostname, | 185 filter->AddHostnameInterceptor("http", hostname, |
185 make_scoped_ptr(new MockJobInterceptor())); | 186 base::WrapUnique(new MockJobInterceptor())); |
186 filter->AddHostnameInterceptor("https", hostname, | 187 filter->AddHostnameInterceptor("https", hostname, |
187 make_scoped_ptr(new MockJobInterceptor())); | 188 base::WrapUnique(new MockJobInterceptor())); |
188 } | 189 } |
189 | 190 |
190 // static | 191 // static |
191 GURL URLRequestMockDataJob::GetMockHttpUrl(const std::string& data, | 192 GURL URLRequestMockDataJob::GetMockHttpUrl(const std::string& data, |
192 int repeat_count) { | 193 int repeat_count) { |
193 return GetMockHttpUrlForHostname(kMockHostname, data, repeat_count); | 194 return GetMockHttpUrlForHostname(kMockHostname, data, repeat_count); |
194 } | 195 } |
195 | 196 |
196 // static | 197 // static |
197 GURL URLRequestMockDataJob::GetMockHttpsUrl(const std::string& data, | 198 GURL URLRequestMockDataJob::GetMockHttpsUrl(const std::string& data, |
(...skipping 15 matching lines...) Expand all Loading... |
213 | 214 |
214 // static | 215 // static |
215 GURL URLRequestMockDataJob::GetMockHttpsUrlForHostname( | 216 GURL URLRequestMockDataJob::GetMockHttpsUrlForHostname( |
216 const std::string& hostname, | 217 const std::string& hostname, |
217 const std::string& data, | 218 const std::string& data, |
218 int repeat_count) { | 219 int repeat_count) { |
219 return GetMockUrl("https", hostname, data, repeat_count, false); | 220 return GetMockUrl("https", hostname, data, repeat_count, false); |
220 } | 221 } |
221 | 222 |
222 } // namespace net | 223 } // namespace net |
OLD | NEW |