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

Side by Side Diff: chrome/browser/component_updater/test/url_request_post_interceptor.h

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_
7 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_
8
9 #include "net/url_request/url_request_job_factory.h"
10 #include "net/url_request/url_request_simple_job.h"
11
12 namespace net {
13 class NetworkDelegate;
14 class URLRequest;
15 }
16
17 class RequestCounter {
18 public:
19 virtual void Trial(net::URLRequest* request) = 0;
20 };
21
22 class URLRequestPostInterceptor {
23 public:
24 explicit URLRequestPostInterceptor(RequestCounter* counter);
25 virtual ~URLRequestPostInterceptor();
26
27 private:
28 class Delegate;
29
30 // After creation, |delegate_| lives on the IO thread, and a task to delete it
31 // is posted from ~URLRequestPostInterceptor().
32 Delegate* delegate_;
33
34 DISALLOW_COPY_AND_ASSIGN(URLRequestPostInterceptor);
35 };
36
37 class URLRequestPostInterceptor::Delegate
38 : public net::URLRequestJobFactory::ProtocolHandler {
39 public:
40 explicit Delegate(RequestCounter* counter);
41 virtual ~Delegate() {}
42
43 void Register();
44
45 void Unregister();
46
47 private:
48 RequestCounter* counter_;
49
50 virtual net::URLRequestJob* MaybeCreateJob(
51 net::URLRequest* request,
52 net::NetworkDelegate* network_delegate) const OVERRIDE;
53 };
54
55 class URLRequestPingMockJob : public net::URLRequestSimpleJob {
56 public:
57 URLRequestPingMockJob(net::URLRequest* request,
58 net::NetworkDelegate* network_delegate);
59
60 protected:
61 virtual int GetData(std::string* mime_type,
62 std::string* charset,
63 std::string* data,
64 const net::CompletionCallback& callback) const OVERRIDE;
65
66 private:
67 virtual ~URLRequestPingMockJob() {}
68
69 DISALLOW_COPY_AND_ASSIGN(URLRequestPingMockJob);
70 };
71
72 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698