Chromium Code Reviews| 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..22ff514fd9d813943d91f2236880ea009bbf400b 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,13 @@ namespace content { |
| // occurs while the URLRequestPrepackagedInterceptor is alive. |
| class URLRequestPrepackagedInterceptor { |
| public: |
| - URLRequestPrepackagedInterceptor(); |
| + URLRequestPrepackagedInterceptor(const std::string& scheme, |
|
agl
2013/03/26 22:27:16
This constructor needs a comment.
rpaquay
2013/03/27 22:57:25
Done.
|
| + 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 +41,9 @@ class URLRequestPrepackagedInterceptor { |
| private: |
| class Delegate; |
| + std::string scheme_; |
|
agl
2013/03/26 22:27:16
can be const I think.
rpaquay
2013/03/27 22:57:25
Done.
|
| + 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 +51,17 @@ class URLRequestPrepackagedInterceptor { |
| DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor); |
| }; |
| +// Intercepts HTTP requests and gives pre-defined responses to specified URLs. |
|
agl
2013/03/26 22:27:16
Is this actually useful? It seems that just using
rpaquay
2013/03/27 22:57:25
I don't have a strong opinion on this. The common
|
| +// The hostname of urls must be "localhost", and the scheme must be "http". |
| +class URLLocalHostRequestPrepackagedInterceptor |
| + : public URLRequestPrepackagedInterceptor { |
| + public: |
| + URLLocalHostRequestPrepackagedInterceptor(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(URLLocalHostRequestPrepackagedInterceptor); |
| +}; |
| + |
| } // namespace content |
| #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ |