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

Side by Side Diff: net/base/mock_host_resolver.h

Issue 8549004: base::Bind: Convert HostResolver::Resolve. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 1 month 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
« no previous file with comments | « net/base/mapped_host_resolver_unittest.cc ('k') | net/base/mock_host_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) 2011 The Chromium Authors. All rights reserved. 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 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_BASE_MOCK_HOST_RESOLVER_H_ 5 #ifndef NET_BASE_MOCK_HOST_RESOLVER_H_
6 #define NET_BASE_MOCK_HOST_RESOLVER_H_ 6 #define NET_BASE_MOCK_HOST_RESOLVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 RuleBasedHostResolverProc* rules() { return rules_; } 58 RuleBasedHostResolverProc* rules() { return rules_; }
59 59
60 // Controls whether resolutions complete synchronously or asynchronously. 60 // Controls whether resolutions complete synchronously or asynchronously.
61 void set_synchronous_mode(bool is_synchronous) { 61 void set_synchronous_mode(bool is_synchronous) {
62 synchronous_mode_ = is_synchronous; 62 synchronous_mode_ = is_synchronous;
63 } 63 }
64 64
65 // HostResolver methods: 65 // HostResolver methods:
66 virtual int Resolve(const RequestInfo& info, 66 virtual int Resolve(const RequestInfo& info,
67 AddressList* addresses, 67 AddressList* addresses,
68 OldCompletionCallback* callback, 68 const CompletionCallback& callback,
69 RequestHandle* out_req, 69 RequestHandle* out_req,
70 const BoundNetLog& net_log) OVERRIDE; 70 const BoundNetLog& net_log) OVERRIDE;
71 virtual int ResolveFromCache(const RequestInfo& info, 71 virtual int ResolveFromCache(const RequestInfo& info,
72 AddressList* addresses, 72 AddressList* addresses,
73 const BoundNetLog& net_log) OVERRIDE; 73 const BoundNetLog& net_log) OVERRIDE;
74 virtual void CancelRequest(RequestHandle req) OVERRIDE; 74 virtual void CancelRequest(RequestHandle req) OVERRIDE;
75 virtual HostCache* GetHostCache() OVERRIDE; 75 virtual HostCache* GetHostCache() OVERRIDE;
76 76
77 protected: 77 protected:
78 explicit MockHostResolverBase(bool use_caching); 78 explicit MockHostResolverBase(bool use_caching);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 }; 172 };
173 173
174 // Create rules that map all requests to localhost. 174 // Create rules that map all requests to localhost.
175 RuleBasedHostResolverProc* CreateCatchAllHostResolverProc(); 175 RuleBasedHostResolverProc* CreateCatchAllHostResolverProc();
176 176
177 // HangingHostResolver never completes its |Resolve| request. 177 // HangingHostResolver never completes its |Resolve| request.
178 class HangingHostResolver : public HostResolver { 178 class HangingHostResolver : public HostResolver {
179 public: 179 public:
180 virtual int Resolve(const RequestInfo& info, 180 virtual int Resolve(const RequestInfo& info,
181 AddressList* addresses, 181 AddressList* addresses,
182 OldCompletionCallback* callback, 182 const CompletionCallback& callback,
183 RequestHandle* out_req, 183 RequestHandle* out_req,
184 const BoundNetLog& net_log) OVERRIDE; 184 const BoundNetLog& net_log) OVERRIDE;
185 virtual int ResolveFromCache(const RequestInfo& info, 185 virtual int ResolveFromCache(const RequestInfo& info,
186 AddressList* addresses, 186 AddressList* addresses,
187 const BoundNetLog& net_log) OVERRIDE; 187 const BoundNetLog& net_log) OVERRIDE;
188 virtual void CancelRequest(RequestHandle req) OVERRIDE {} 188 virtual void CancelRequest(RequestHandle req) OVERRIDE {}
189 }; 189 };
190 190
191 // This class sets the default HostResolverProc for a particular scope. The 191 // This class sets the default HostResolverProc for a particular scope. The
192 // chain of resolver procs starting at |proc| is placed in front of any existing 192 // chain of resolver procs starting at |proc| is placed in front of any existing
(...skipping 14 matching lines...) Expand all
207 void Init(HostResolverProc* proc); 207 void Init(HostResolverProc* proc);
208 208
209 private: 209 private:
210 scoped_refptr<HostResolverProc> current_proc_; 210 scoped_refptr<HostResolverProc> current_proc_;
211 scoped_refptr<HostResolverProc> previous_proc_; 211 scoped_refptr<HostResolverProc> previous_proc_;
212 }; 212 };
213 213
214 } // namespace net 214 } // namespace net
215 215
216 #endif // NET_BASE_MOCK_HOST_RESOLVER_H_ 216 #endif // NET_BASE_MOCK_HOST_RESOLVER_H_
OLDNEW
« no previous file with comments | « net/base/mapped_host_resolver_unittest.cc ('k') | net/base/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698