OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/files/file_util.h" | 5 #include "components/component_updater/test/url_request_post_interceptor.h" |
| 6 |
| 7 #include "base/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" | 10 #include "components/component_updater/test/test_configurator.h" |
9 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread.h" |
10 #include "net/base/upload_bytes_element_reader.h" | 12 #include "net/base/upload_bytes_element_reader.h" |
11 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
12 #include "net/url_request/url_request_filter.h" | 14 #include "net/url_request/url_request_filter.h" |
13 #include "net/url_request/url_request_interceptor.h" | 15 #include "net/url_request/url_request_interceptor.h" |
14 #include "net/url_request/url_request_simple_job.h" | 16 #include "net/url_request/url_request_simple_job.h" |
15 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
16 | 18 |
17 using content::BrowserThread; | 19 using content::BrowserThread; |
18 | 20 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 base::Unretained(delegate_), | 251 base::Unretained(delegate_), |
250 base::Unretained(interceptor))); | 252 base::Unretained(interceptor))); |
251 if (!res) { | 253 if (!res) { |
252 delete interceptor; | 254 delete interceptor; |
253 return NULL; | 255 return NULL; |
254 } | 256 } |
255 | 257 |
256 return interceptor; | 258 return interceptor; |
257 } | 259 } |
258 | 260 |
| 261 bool PartialMatch::Match(const std::string& actual) const { |
| 262 return actual.find(expected_) != std::string::npos; |
| 263 } |
| 264 |
| 265 InterceptorFactory::InterceptorFactory() |
| 266 : URLRequestPostInterceptorFactory(POST_INTERCEPT_SCHEME, |
| 267 POST_INTERCEPT_HOSTNAME) { |
| 268 } |
| 269 |
| 270 InterceptorFactory::~InterceptorFactory() { |
| 271 } |
| 272 |
| 273 URLRequestPostInterceptor* InterceptorFactory::CreateInterceptor() { |
| 274 return URLRequestPostInterceptorFactory::CreateInterceptor( |
| 275 base::FilePath::FromUTF8Unsafe(POST_INTERCEPT_PATH)); |
| 276 } |
| 277 |
259 } // namespace component_updater | 278 } // namespace component_updater |
OLD | NEW |