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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..10c3d14e71a065cee301a1fec575a6559886b72c |
| --- /dev/null |
| +++ b/content/test/net/url_request_prepackaged_interceptor.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// 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_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| + |
| +class FilePath; |
| + |
| +namespace content { |
| + |
| +// 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 { |
| + public: |
| + URLRequestPrepackagedInterceptor(); |
| + 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". |
| + void SetResponse(const std::string& url, |
| + const FilePath& path); |
| + |
| + // Identical to SetResponse except that query parameters are ignored on |
| + // incoming URLs when comparing against |url|. |
| + void SetResponseIgnoreQuery(const std::string& url, |
| + const FilePath& path); |
|
mmenke
2012/12/11 17:22:38
nit: Could use a single line here and above.
|
| + |
| + // Returns how many requests have been issued that have a stored reply. |
| + int GetHitCount(); |
| + |
| + private: |
| + class Delegate; |
| + |
| + Delegate* delegate_; |
|
mmenke
2012/12/11 17:22:38
Think it's worth mentioning that after creation, t
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ |