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

Side by Side Diff: content/test/net/url_request_prepackaged_interceptor.h

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address mmenke's first round of comments Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11
12 class FilePath;
13
14 namespace content {
15
16 // Intercepts HTTP requests and gives pre-defined responses to specified URLs.
17 // The pre-defined responses are loaded from files on disk. The interception
18 // occurs while the URLRequestPrepackagedInterceptor is alive.
19 class URLRequestPrepackagedInterceptor {
20 public:
21 URLRequestPrepackagedInterceptor();
22 virtual ~URLRequestPrepackagedInterceptor();
23
24 // When requests for |url| arrive, respond with the contents of |path|. The
25 // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme
26 // must be "http".
27 void SetResponse(const std::string& url, const FilePath& path);
28
29 // Identical to SetResponse except that query parameters are ignored on
30 // incoming URLs when comparing against |url|.
31 void SetResponseIgnoreQuery(const std::string& url, const FilePath& path);
mmenke 2012/12/13 16:12:04 Think both these functions should be taking GURLs,
32
33 // Returns how many requests have been issued that have a stored reply.
34 int GetHitCount();
35
36 private:
37 class Delegate;
38
39 // After creation, |delegate_| lives on the IO thread, and a task to delete
40 // it is posted from ~URLRequestPrepackagedInterceptor().
41 Delegate* delegate_;
42
43 DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor);
44 };
45
46 } // namespace content
47
48 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698