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

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

Issue 11530018: DnsProbeJob: Differentiate network and DNS errors (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
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> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 static const int kT3TTL = 0x00000015; 167 static const int kT3TTL = 0x00000015;
168 // +2 for the CNAME records. 168 // +2 for the CNAME records.
169 static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2; 169 static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2;
170 170
171 class DnsClient; 171 class DnsClient;
172 172
173 struct MockDnsClientRule { 173 struct MockDnsClientRule {
174 enum Result { 174 enum Result {
175 FAIL_SYNC, // Fail synchronously with ERR_NAME_NOT_RESOLVED. 175 FAIL_SYNC, // Fail synchronously with ERR_NAME_NOT_RESOLVED.
176 FAIL_ASYNC, // Fail asynchronously with ERR_NAME_NOT_RESOLVED. 176 FAIL_ASYNC, // Fail asynchronously with ERR_NAME_NOT_RESOLVED.
177 TIMEOUT, // Fail asynchronously with ERR_DNS_TIMEOUT.
177 EMPTY, // Return an empty response. 178 EMPTY, // Return an empty response.
178 OK, // Return a response with loopback address. 179 OK, // Return a response with loopback address.
179 }; 180 };
180 181
181 MockDnsClientRule(const std::string& prefix_arg, 182 MockDnsClientRule(const std::string& prefix_arg,
182 uint16 qtype_arg, 183 uint16 qtype_arg,
183 Result result_arg) 184 Result result_arg)
184 : result(result_arg), prefix(prefix_arg), qtype(qtype_arg) { } 185 : result(result_arg), prefix(prefix_arg), qtype(qtype_arg) { }
185 186
186 Result result; 187 Result result;
187 std::string prefix; 188 std::string prefix;
188 uint16 qtype; 189 uint16 qtype;
189 }; 190 };
190 191
191 typedef std::vector<MockDnsClientRule> MockDnsClientRuleList; 192 typedef std::vector<MockDnsClientRule> MockDnsClientRuleList;
192 193
193 // Creates mock DnsClient for testing HostResolverImpl. 194 // Creates mock DnsClient for testing HostResolverImpl.
194 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config, 195 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config,
195 const MockDnsClientRuleList& rules); 196 const MockDnsClientRuleList& rules);
196 197
197 } // namespace net 198 } // namespace net
198 199
199 #endif // NET_DNS_DNS_TEST_UTIL_H_ 200 #endif // NET_DNS_DNS_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698