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

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

Issue 1629005: Revert 43826 - HostResolver now adds AI_CANONNAME to the hint flags if a requ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 8 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
« no previous file with comments | « net/base/host_resolver_proc.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/waitable_event.h" 10 #include "base/waitable_event.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Make sure that |host| will not be re-mapped or even processed by underlying 121 // Make sure that |host| will not be re-mapped or even processed by underlying
122 // host resolver procedures. It can also be a pattern. 122 // host resolver procedures. It can also be a pattern.
123 void AllowDirectLookup(const std::string& host); 123 void AllowDirectLookup(const std::string& host);
124 124
125 // Simulate a lookup failure for |host| (it also can be a pattern). 125 // Simulate a lookup failure for |host| (it also can be a pattern).
126 void AddSimulatedFailure(const std::string& host); 126 void AddSimulatedFailure(const std::string& host);
127 127
128 // HostResolverProc methods: 128 // HostResolverProc methods:
129 virtual int Resolve(const std::string& host, 129 virtual int Resolve(const std::string& host,
130 AddressFamily address_family, 130 AddressFamily address_family,
131 HostResolverFlags host_resolver_flags,
132 AddressList* addrlist); 131 AddressList* addrlist);
133 132
134 private: 133 private:
135 ~RuleBasedHostResolverProc(); 134 ~RuleBasedHostResolverProc();
136 135
137 struct Rule; 136 struct Rule;
138 typedef std::list<Rule> RuleList; 137 typedef std::list<Rule> RuleList;
139 138
140 RuleList rules_; 139 RuleList rules_;
141 }; 140 };
142 141
143 // Using WaitingHostResolverProc you can simulate very long lookups. 142 // Using WaitingHostResolverProc you can simulate very long lookups.
144 class WaitingHostResolverProc : public HostResolverProc { 143 class WaitingHostResolverProc : public HostResolverProc {
145 public: 144 public:
146 explicit WaitingHostResolverProc(HostResolverProc* previous) 145 explicit WaitingHostResolverProc(HostResolverProc* previous)
147 : HostResolverProc(previous), event_(false, false) {} 146 : HostResolverProc(previous), event_(false, false) {}
148 147
149 void Signal() { 148 void Signal() {
150 event_.Signal(); 149 event_.Signal();
151 } 150 }
152 151
153 // HostResolverProc methods: 152 // HostResolverProc methods:
154 virtual int Resolve(const std::string& host, 153 virtual int Resolve(const std::string& host,
155 AddressFamily address_family, 154 AddressFamily address_family,
156 HostResolverFlags host_resolver_flags,
157 AddressList* addrlist) { 155 AddressList* addrlist) {
158 event_.Wait(); 156 event_.Wait();
159 return ResolveUsingPrevious(host, address_family, host_resolver_flags, 157 return ResolveUsingPrevious(host, address_family, addrlist);
160 addrlist);
161 } 158 }
162 159
163 private: 160 private:
164 ~WaitingHostResolverProc() {} 161 ~WaitingHostResolverProc() {}
165 162
166 base::WaitableEvent event_; 163 base::WaitableEvent event_;
167 }; 164 };
168 165
169 // This class sets the default HostResolverProc for a particular scope. The 166 // This class sets the default HostResolverProc for a particular scope. The
170 // chain of resolver procs starting at |proc| is placed in front of any existing 167 // chain of resolver procs starting at |proc| is placed in front of any existing
(...skipping 14 matching lines...) Expand all
185 void Init(HostResolverProc* proc); 182 void Init(HostResolverProc* proc);
186 183
187 private: 184 private:
188 scoped_refptr<HostResolverProc> current_proc_; 185 scoped_refptr<HostResolverProc> current_proc_;
189 scoped_refptr<HostResolverProc> previous_proc_; 186 scoped_refptr<HostResolverProc> previous_proc_;
190 }; 187 };
191 188
192 } // namespace net 189 } // namespace net
193 190
194 #endif // NET_BASE_MOCK_HOST_RESOLVER_H_ 191 #endif // NET_BASE_MOCK_HOST_RESOLVER_H_
OLDNEW
« no previous file with comments | « net/base/host_resolver_proc.cc ('k') | net/base/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698