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

Side by Side Diff: net/proxy/mock_proxy_resolver.h

Issue 2082773002: Remove calls to MessageLoop::current() in net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward declaration Created 4 years, 5 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
« no previous file with comments | « net/dns/serial_worker_unittest.cc ('k') | net/proxy/mock_proxy_resolver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_PROXY_MOCK_PROXY_RESOLVER_H_ 5 #ifndef NET_PROXY_MOCK_PROXY_RESOLVER_H_
6 #define NET_PROXY_MOCK_PROXY_RESOLVER_H_ 6 #define NET_PROXY_MOCK_PROXY_RESOLVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/proxy/proxy_resolver.h" 13 #include "net/proxy/proxy_resolver.h"
14 #include "net/proxy/proxy_resolver_factory.h" 14 #include "net/proxy/proxy_resolver_factory.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace base {
18 class MessageLoop;
19 }
20
21 namespace net { 17 namespace net {
22 18
23 // Asynchronous mock proxy resolver. All requests complete asynchronously, 19 // Asynchronous mock proxy resolver. All requests complete asynchronously,
24 // user must call Request::CompleteNow() on a pending request to signal it. 20 // user must call Request::CompleteNow() on a pending request to signal it.
25 class MockAsyncProxyResolver : public ProxyResolver { 21 class MockAsyncProxyResolver : public ProxyResolver {
26 public: 22 public:
27 class Request : public base::RefCounted<Request> { 23 class Request : public base::RefCounted<Request> {
28 public: 24 public:
29 Request(MockAsyncProxyResolver* resolver, 25 Request(MockAsyncProxyResolver* resolver,
30 const GURL& url, 26 const GURL& url,
31 ProxyInfo* results, 27 ProxyInfo* results,
32 const CompletionCallback& callback); 28 const CompletionCallback& callback);
33 29
34 const GURL& url() const { return url_; } 30 const GURL& url() const { return url_; }
35 ProxyInfo* results() const { return results_; } 31 ProxyInfo* results() const { return results_; }
36 const CompletionCallback& callback() const { return callback_; } 32 const CompletionCallback& callback() const { return callback_; }
37 33
38 void CompleteNow(int rv); 34 void CompleteNow(int rv);
39 35
40 private: 36 private:
41 friend class base::RefCounted<Request>; 37 friend class base::RefCounted<Request>;
42 38
43 virtual ~Request(); 39 virtual ~Request();
44 40
45 MockAsyncProxyResolver* resolver_; 41 MockAsyncProxyResolver* resolver_;
46 const GURL url_; 42 const GURL url_;
47 ProxyInfo* results_; 43 ProxyInfo* results_;
48 CompletionCallback callback_; 44 CompletionCallback callback_;
49 base::MessageLoop* origin_loop_;
50 }; 45 };
51 46
52 typedef std::vector<scoped_refptr<Request> > RequestsList; 47 typedef std::vector<scoped_refptr<Request> > RequestsList;
53 48
54 MockAsyncProxyResolver(); 49 MockAsyncProxyResolver();
55 ~MockAsyncProxyResolver() override; 50 ~MockAsyncProxyResolver() override;
56 51
57 // ProxyResolver implementation. 52 // ProxyResolver implementation.
58 int GetProxyForURL(const GURL& url, 53 int GetProxyForURL(const GURL& url,
59 ProxyInfo* results, 54 ProxyInfo* results,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 153
159 private: 154 private:
160 ProxyResolver* impl_; 155 ProxyResolver* impl_;
161 156
162 DISALLOW_COPY_AND_ASSIGN(ForwardingProxyResolver); 157 DISALLOW_COPY_AND_ASSIGN(ForwardingProxyResolver);
163 }; 158 };
164 159
165 } // namespace net 160 } // namespace net
166 161
167 #endif // NET_PROXY_MOCK_PROXY_RESOLVER_H_ 162 #endif // NET_PROXY_MOCK_PROXY_RESOLVER_H_
OLDNEW
« no previous file with comments | « net/dns/serial_worker_unittest.cc ('k') | net/proxy/mock_proxy_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698