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

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: sync 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) 2012 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 "base/basictypes.h"
9
10 class FilePath;
11 class GURL;
12
13 namespace content {
14
15 // Intercepts HTTP requests and gives pre-defined responses to specified URLs.
16 // The pre-defined responses are loaded from files on disk. The interception
17 // occurs while the URLRequestPrepackagedInterceptor is alive.
18 class URLRequestPrepackagedInterceptor {
19 public:
20 URLRequestPrepackagedInterceptor();
21 virtual ~URLRequestPrepackagedInterceptor();
22
23 // When requests for |url| arrive, respond with the contents of |path|. The
24 // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme
25 // must be "http".
26 void SetResponse(const GURL& url, const FilePath& path);
27
28 // Identical to SetResponse except that query parameters are ignored on
29 // incoming URLs when comparing against |url|.
30 void SetResponseIgnoreQuery(const GURL& url, const FilePath& path);
31
32 // Returns how many requests have been issued that have a stored reply.
33 int GetHitCount();
34
35 private:
36 class Delegate;
37
38 // After creation, |delegate_| lives on the IO thread, and a task to delete
39 // it is posted from ~URLRequestPrepackagedInterceptor().
40 Delegate* delegate_;
41
42 DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor);
43 };
44
45 } // namespace content
46
47 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
OLDNEW
« no previous file with comments | « content/test/net/url_request_abort_on_end_job.cc ('k') | content/test/net/url_request_prepackaged_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698