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

Unified Diff: net/dns/dns_test_util.h

Issue 10855179: [net/dns] Resolve AF_UNSPEC on dual-stacked systems. Sort addresses according to RFC3484. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_response_unittest.cc ('k') | net/dns/dns_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_test_util.h
diff --git a/net/dns/dns_test_util.h b/net/dns/dns_test_util.h
index 53a0620cb6c289055bcbde83919512d78b4e501b..2d03d0e654021eb7b0bfaf5ad443c56325110c12 100644
--- a/net/dns/dns_test_util.h
+++ b/net/dns/dns_test_util.h
@@ -5,6 +5,9 @@
#ifndef NET_DNS_DNS_TEST_UTIL_H_
#define NET_DNS_DNS_TEST_UTIL_H_
+#include <string>
+#include <vector>
+
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "net/dns/dns_config_service.h"
@@ -166,8 +169,25 @@ static const int kT3TTL = 0x00000015;
static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2;
class DnsClient;
+
+struct MockDnsClientRule {
+ enum Result {
+ FAIL_SYNC, // Fail synchronously with ERR_NAME_NOT_RESOLVED.
+ FAIL_ASYNC, // Fail asynchronously with ERR_NAME_NOT_RESOLVED.
+ EMPTY, // Return an empty response.
+ OK, // Return a response with loopback address.
+ };
+
+ std::string prefix;
+ uint16 qtype;
+ Result result;
+};
+
+typedef std::vector<MockDnsClientRule> MockDnsClientRuleList;
+
// Creates mock DnsClient for testing HostResolverImpl.
-scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config);
+scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config,
+ const MockDnsClientRuleList& rules);
class MockDnsConfigService : public DnsConfigService {
public:
« 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