| Index: net/base/mock_host_resolver.cc
|
| diff --git a/net/base/mock_host_resolver.cc b/net/base/mock_host_resolver.cc
|
| index 2baeb26a20656a97a9164b45092617203b138ed5..8c2a9a406f4300a1d74256d6dc627fba69ac03f8 100644
|
| --- a/net/base/mock_host_resolver.cc
|
| +++ b/net/base/mock_host_resolver.cc
|
| @@ -156,8 +156,10 @@ void RuleBasedHostResolverProc::AddRuleForAddressFamily(
|
| AddressFamily address_family,
|
| const std::string& replacement) {
|
| DCHECK(!replacement.empty());
|
| - Rule rule(Rule::kResolverTypeSystem, host_pattern,
|
| - address_family, 0, replacement, "", 0);
|
| + HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY |
|
| + HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
|
| + Rule rule(Rule::kResolverTypeSystem, host_pattern, address_family, flags,
|
| + replacement, "", 0);
|
| rules_.push_back(rule);
|
| }
|
|
|
| @@ -169,13 +171,12 @@ void RuleBasedHostResolverProc::AddIPLiteralRule(
|
| // consequently we do not support remapping them.
|
| IPAddressNumber ip_number;
|
| DCHECK(!ParseIPLiteralToNumber(host_pattern, &ip_number));
|
| - Rule rule(Rule::kResolverTypeIPLiteral,
|
| - host_pattern,
|
| - ADDRESS_FAMILY_UNSPECIFIED,
|
| - canonical_name.empty() ? 0 : HOST_RESOLVER_CANONNAME,
|
| - ip_literal,
|
| - canonical_name,
|
| - 0);
|
| + HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY |
|
| + HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
|
| + if (!canonical_name.empty())
|
| + flags |= HOST_RESOLVER_CANONNAME;
|
| + Rule rule(Rule::kResolverTypeIPLiteral, host_pattern,
|
| + ADDRESS_FAMILY_UNSPECIFIED, flags, ip_literal, canonical_name, 0);
|
| rules_.push_back(rule);
|
| }
|
|
|
| @@ -184,22 +185,28 @@ void RuleBasedHostResolverProc::AddRuleWithLatency(
|
| const std::string& replacement,
|
| int latency_ms) {
|
| DCHECK(!replacement.empty());
|
| - Rule rule(Rule::kResolverTypeSystem, host_pattern,
|
| - ADDRESS_FAMILY_UNSPECIFIED, 0, replacement, "", latency_ms);
|
| + HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY |
|
| + HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
|
| + Rule rule(Rule::kResolverTypeSystem, host_pattern, ADDRESS_FAMILY_UNSPECIFIED,
|
| + flags, replacement, "", latency_ms);
|
| rules_.push_back(rule);
|
| }
|
|
|
| void RuleBasedHostResolverProc::AllowDirectLookup(
|
| const std::string& host_pattern) {
|
| - Rule rule(Rule::kResolverTypeSystem, host_pattern,
|
| - ADDRESS_FAMILY_UNSPECIFIED, 0, "", "", 0);
|
| + HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY |
|
| + HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
|
| + Rule rule(Rule::kResolverTypeSystem, host_pattern, ADDRESS_FAMILY_UNSPECIFIED,
|
| + flags, "", "", 0);
|
| rules_.push_back(rule);
|
| }
|
|
|
| void RuleBasedHostResolverProc::AddSimulatedFailure(
|
| const std::string& host_pattern) {
|
| - Rule rule(Rule::kResolverTypeFail, host_pattern,
|
| - ADDRESS_FAMILY_UNSPECIFIED, 0, "", "", 0);
|
| + HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY |
|
| + HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
|
| + Rule rule(Rule::kResolverTypeFail, host_pattern, ADDRESS_FAMILY_UNSPECIFIED,
|
| + flags, "", "", 0);
|
| rules_.push_back(rule);
|
| }
|
|
|
|
|