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

Side by Side Diff: net/dns/dns_test_util.h

Issue 10855163: Revert 151586 - [net/dns] Resolve AF_UNSPEC on dual-stacked systems. Sort addresses according to RF… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/dns/dns_response_unittest.cc ('k') | net/dns/dns_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
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_DNS_DNS_TEST_UTIL_H_ 5 #ifndef NET_DNS_DNS_TEST_UTIL_H_
6 #define NET_DNS_DNS_TEST_UTIL_H_ 6 #define NET_DNS_DNS_TEST_UTIL_H_
7 7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h" 8 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
13 #include "net/dns/dns_config_service.h" 10 #include "net/dns/dns_config_service.h"
14 #include "net/dns/dns_protocol.h" 11 #include "net/dns/dns_protocol.h"
15 12
16 namespace net { 13 namespace net {
17 14
18 //----------------------------------------------------------------------------- 15 //-----------------------------------------------------------------------------
19 // Query/response set for www.google.com, ID is fixed to 0. 16 // Query/response set for www.google.com, ID is fixed to 0.
20 static const char kT0HostName[] = "www.google.com"; 17 static const char kT0HostName[] = "www.google.com";
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 static const char* const kT3IpAddresses[] = { 159 static const char* const kT3IpAddresses[] = {
163 "74.125.226.178", "74.125.226.179", "74.125.226.180", 160 "74.125.226.178", "74.125.226.179", "74.125.226.180",
164 "74.125.226.176", "74.125.226.177" 161 "74.125.226.176", "74.125.226.177"
165 }; 162 };
166 static const char kT3CanonName[] = "www.l.google.com"; 163 static const char kT3CanonName[] = "www.l.google.com";
167 static const int kT3TTL = 0x00000015; 164 static const int kT3TTL = 0x00000015;
168 // +2 for the CNAME records. 165 // +2 for the CNAME records.
169 static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2; 166 static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2;
170 167
171 class DnsClient; 168 class DnsClient;
172
173 struct MockDnsClientRule {
174 enum Result {
175 FAIL_SYNC, // Fail synchronously with ERR_NAME_NOT_RESOLVED.
176 FAIL_ASYNC, // Fail asynchronously with ERR_NAME_NOT_RESOLVED.
177 EMPTY, // Return an empty response.
178 OK, // Return a response with loopback address.
179 };
180
181 std::string prefix;
182 uint16 qtype;
183 Result result;
184 };
185
186 typedef std::vector<MockDnsClientRule> MockDnsClientRuleList;
187
188 // Creates mock DnsClient for testing HostResolverImpl. 169 // Creates mock DnsClient for testing HostResolverImpl.
189 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config, 170 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config);
190 const MockDnsClientRuleList& rules);
191 171
192 class MockDnsConfigService : public DnsConfigService { 172 class MockDnsConfigService : public DnsConfigService {
193 public: 173 public:
194 virtual ~MockDnsConfigService(); 174 virtual ~MockDnsConfigService();
195 175
196 // NetworkChangeNotifier::DNSObserver: 176 // NetworkChangeNotifier::DNSObserver:
197 virtual void OnDNSChanged(unsigned detail) OVERRIDE; 177 virtual void OnDNSChanged(unsigned detail) OVERRIDE;
198 178
199 // Expose the protected methods for tests. 179 // Expose the protected methods for tests.
200 void ChangeConfig(const DnsConfig& config); 180 void ChangeConfig(const DnsConfig& config);
201 void ChangeHosts(const DnsHosts& hosts); 181 void ChangeHosts(const DnsHosts& hosts);
202 }; 182 };
203 183
204 184
205 } // namespace net 185 } // namespace net
206 186
207 #endif // NET_DNS_DNS_TEST_UTIL_H_ 187 #endif // NET_DNS_DNS_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/dns/dns_response_unittest.cc ('k') | net/dns/dns_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698