| Index: net/url_request/test_url_request_interceptor.h
|
| diff --git a/content/test/net/url_request_prepackaged_interceptor.h b/net/url_request/test_url_request_interceptor.h
|
| similarity index 51%
|
| rename from content/test/net/url_request_prepackaged_interceptor.h
|
| rename to net/url_request/test_url_request_interceptor.h
|
| index cc5736d9e2738cb332bf186c544e0fb555f130da..99445fe8837231cb7b560fe8d0b3372c16bec6a4 100644
|
| --- a/content/test/net/url_request_prepackaged_interceptor.h
|
| +++ b/net/url_request/test_url_request_interceptor.h
|
| @@ -2,31 +2,36 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
|
| -#define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
|
| +#ifndef NET_URL_REQUEST_TEST_URL_REQUEST_INTERCEPTOR_H_
|
| +#define NET_URL_REQUEST_TEST_URL_REQUEST_INTERCEPTOR_H_
|
|
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/memory/ref_counted.h"
|
|
|
| class GURL;
|
|
|
| namespace base {
|
| class FilePath;
|
| +class TaskRunner;
|
| }
|
|
|
| -namespace content {
|
| +namespace net {
|
|
|
| // Intercepts HTTP requests and gives pre-defined responses to specified URLs.
|
| // The pre-defined responses are loaded from files on disk. The interception
|
| -// occurs while the URLRequestPrepackagedInterceptor is alive.
|
| -class URLRequestPrepackagedInterceptor {
|
| +// occurs while the TestURLRequestInterceptor is alive.
|
| +class TestURLRequestInterceptor {
|
| public:
|
| // Registers an interceptor for urls using |scheme| and |hostname|. Urls
|
| // passed to "SetResponse" are required to use |scheme| and |hostname|.
|
| - URLRequestPrepackagedInterceptor(const std::string& scheme,
|
| - const std::string& hostname);
|
| - virtual ~URLRequestPrepackagedInterceptor();
|
| + TestURLRequestInterceptor(
|
| + const std::string& scheme,
|
| + const std::string& hostname,
|
| + const scoped_refptr<base::TaskRunner>& io_task_runner,
|
| + const scoped_refptr<base::TaskRunner>& worker_task_runner);
|
| + virtual ~TestURLRequestInterceptor();
|
|
|
| // When requests for |url| arrive, respond with the contents of |path|. The
|
| // hostname and scheme of |url| must match the corresponding parameters
|
| @@ -46,24 +51,27 @@ class URLRequestPrepackagedInterceptor {
|
| const std::string scheme_;
|
| const std::string hostname_;
|
|
|
| - // After creation, |delegate_| lives on the IO thread, and a task to delete
|
| - // it is posted from ~URLRequestPrepackagedInterceptor().
|
| + scoped_refptr<base::TaskRunner> io_task_runner_;
|
| +
|
| + // After creation, |delegate_| lives on the thread of the |io_task_runner_|,
|
| + // and a task to delete it is posted from ~TestURLRequestInterceptor().
|
| Delegate* delegate_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor);
|
| + DISALLOW_COPY_AND_ASSIGN(TestURLRequestInterceptor);
|
| };
|
|
|
| -// Specialization of URLRequestPrepackagedInterceptor where scheme is "http" and
|
| +// Specialization of TestURLRequestInterceptor where scheme is "http" and
|
| // hostname is "localhost".
|
| -class URLLocalHostRequestPrepackagedInterceptor
|
| - : public URLRequestPrepackagedInterceptor {
|
| +class LocalHostTestURLRequestInterceptor : public TestURLRequestInterceptor {
|
| public:
|
| - URLLocalHostRequestPrepackagedInterceptor();
|
| + LocalHostTestURLRequestInterceptor(
|
| + const scoped_refptr<base::TaskRunner>& io_task_runner,
|
| + const scoped_refptr<base::TaskRunner>& worker_task_runner);
|
|
|
| private:
|
| - DISALLOW_COPY_AND_ASSIGN(URLLocalHostRequestPrepackagedInterceptor);
|
| + DISALLOW_COPY_AND_ASSIGN(LocalHostTestURLRequestInterceptor);
|
| };
|
|
|
| -} // namespace content
|
| +} // namespace net
|
|
|
| -#endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
|
| +#endif // NET_URL_REQUEST_TEST_URL_REQUEST_INTERCEPTOR_H_
|
|
|