Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Unified Diff: net/url_request/test_url_request_interceptor.h

Issue 508473002: Componentize component_updater: Move URLRequestPrepackagedInterceptor from content/ to net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/net.gyp ('k') | net/url_request/test_url_request_interceptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
Ryan Sleevi 2014/08/28 17:39:53 Document more about the threading Namely, that th
tommycli 2014/08/28 17:54:07 Done.
+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,
Ryan Sleevi 2014/08/28 17:39:53 1) naming wise, this is traditionally called "netw
tommycli 2014/08/28 17:54:07 Done.
+ 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_
« no previous file with comments | « net/net.gyp ('k') | net/url_request/test_url_request_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698