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

Unified Diff: content/test/net/url_request_prepackaged_interceptor.h

Issue 12967016: Improve <adview> implementation and add tests. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Disable test with dependency on binary file. Created 7 years, 8 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
Index: content/test/net/url_request_prepackaged_interceptor.h
diff --git a/content/test/net/url_request_prepackaged_interceptor.h b/content/test/net/url_request_prepackaged_interceptor.h
index edb65c585597eb90d32613672aa85fc65f4465eb..cc5736d9e2738cb332bf186c544e0fb555f130da 100644
--- a/content/test/net/url_request_prepackaged_interceptor.h
+++ b/content/test/net/url_request_prepackaged_interceptor.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
#define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
+#include <string>
+
#include "base/basictypes.h"
class GURL;
@@ -20,12 +22,15 @@ namespace content {
// occurs while the URLRequestPrepackagedInterceptor is alive.
class URLRequestPrepackagedInterceptor {
public:
- URLRequestPrepackagedInterceptor();
+ // 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();
// When requests for |url| arrive, respond with the contents of |path|. The
- // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme
- // must be "http".
+ // hostname and scheme of |url| must match the corresponding parameters
+ // passed as constructor arguments.
void SetResponse(const GURL& url, const base::FilePath& path);
// Identical to SetResponse except that query parameters are ignored on
@@ -38,6 +43,9 @@ class URLRequestPrepackagedInterceptor {
private:
class Delegate;
+ 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().
Delegate* delegate_;
@@ -45,6 +53,17 @@ class URLRequestPrepackagedInterceptor {
DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor);
};
+// Specialization of URLRequestPrepackagedInterceptor where scheme is "http" and
+// hostname is "localhost".
+class URLLocalHostRequestPrepackagedInterceptor
+ : public URLRequestPrepackagedInterceptor {
+ public:
+ URLLocalHostRequestPrepackagedInterceptor();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(URLLocalHostRequestPrepackagedInterceptor);
+};
+
} // namespace content
#endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698