diff options
Diffstat (limited to 'net/dns')
-rw-r--r-- | net/dns/host_resolver_impl_unittest.cc | 22 | ||||
-rw-r--r-- | net/dns/mapped_host_resolver_unittest.cc | 4 | ||||
-rw-r--r-- | net/dns/mock_host_resolver.cc | 36 | ||||
-rw-r--r-- | net/dns/single_request_host_resolver_unittest.cc | 2 |
4 files changed, 44 insertions, 20 deletions
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc index c9ebec0..26bebeb 100644 --- a/net/dns/host_resolver_impl_unittest.cc +++ b/net/dns/host_resolver_impl_unittest.cc @@ -107,7 +107,7 @@ class MockHostResolverProc : public HostResolverProc { void AddRule(const std::string& hostname, AddressFamily family, const std::string& ip_list) { AddressList result; - int rv = ParseAddressList(ip_list, "", &result); + int rv = ParseAddressList(ip_list, std::string(), &result); DCHECK_EQ(OK, rv); AddRule(hostname, family, result); } @@ -115,7 +115,7 @@ class MockHostResolverProc : public HostResolverProc { void AddRuleForAllFamilies(const std::string& hostname, const std::string& ip_list) { AddressList result; - int rv = ParseAddressList(ip_list, "", &result); + int rv = ParseAddressList(ip_list, std::string(), &result); DCHECK_EQ(OK, rv); AddRule(hostname, ADDRESS_FAMILY_UNSPECIFIED, result); AddRule(hostname, ADDRESS_FAMILY_IPV4, result); @@ -137,7 +137,7 @@ class MockHostResolverProc : public HostResolverProc { --num_slots_available_; --num_requests_waiting_; if (rules_.empty()) { - int rv = ParseAddressList("127.0.0.1", "", addrlist); + int rv = ParseAddressList("127.0.0.1", std::string(), addrlist); DCHECK_EQ(OK, rv); return OK; } @@ -527,7 +527,8 @@ TEST_F(HostResolverImplTest, AsynchronousLookup) { } TEST_F(HostResolverImplTest, FailedAsynchronousLookup) { - proc_->AddRuleForAllFamilies("", "0.0.0.0"); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + "0.0.0.0"); // Default to failures. proc_->SignalMultiple(1u); Request* req = CreateRequest("just.testing", 80); @@ -582,7 +583,7 @@ TEST_F(HostResolverImplTest, NumericIPv6Address) { } TEST_F(HostResolverImplTest, EmptyHost) { - Request* req = CreateRequest("", 5555); + Request* req = CreateRequest(std::string(), 5555); EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); } @@ -1344,7 +1345,8 @@ TEST_F(HostResolverImplDnsTest, ServeFromHosts) { DnsConfig config = CreateValidDnsConfig(); ChangeDnsConfig(config); - proc_->AddRuleForAllFamilies("", ""); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + std::string()); // Default to failures. proc_->SignalMultiple(1u); // For the first request which misses. Request* req0 = CreateRequest("er_ipv4", 80); @@ -1396,7 +1398,8 @@ TEST_F(HostResolverImplDnsTest, ServeFromHosts) { TEST_F(HostResolverImplDnsTest, BypassDnsTask) { ChangeDnsConfig(CreateValidDnsConfig()); - proc_->AddRuleForAllFamilies("", ""); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + std::string()); // Default to failures. EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok.local", 80)->Resolve()); EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok.local.", 80)->Resolve()); @@ -1416,7 +1419,8 @@ TEST_F(HostResolverImplDnsTest, BypassDnsTask) { TEST_F(HostResolverImplDnsTest, DisableDnsClientOnPersistentFailure) { ChangeDnsConfig(CreateValidDnsConfig()); - proc_->AddRuleForAllFamilies("", ""); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + std::string()); // Default to failures. // Check that DnsTask works. Request* req = CreateRequest("ok_1", 80); @@ -1470,7 +1474,7 @@ TEST_F(HostResolverImplDnsTest, DontDisableDnsClientOnSporadicFailure) { EXPECT_EQ(OK, requests_[i]->WaitForResult()) << i; // Make |proc_| default to failures. - proc_->AddRuleForAllFamilies("", ""); + proc_->AddRuleForAllFamilies(std::string(), std::string()); // DnsTask should still be enabled. Request* req = CreateRequest("ok_last", 80); diff --git a/net/dns/mapped_host_resolver_unittest.cc b/net/dns/mapped_host_resolver_unittest.cc index 8da95e1..d859466 100644 --- a/net/dns/mapped_host_resolver_unittest.cc +++ b/net/dns/mapped_host_resolver_unittest.cc @@ -18,7 +18,7 @@ namespace { std::string FirstAddress(const AddressList& address_list) { if (address_list.empty()) - return ""; + return std::string(); return address_list.front().ToString(); } @@ -171,7 +171,7 @@ TEST(MappedHostResolverTest, ParseInvalidRules) { new MappedHostResolver(scoped_ptr<HostResolver>())); EXPECT_FALSE(resolver->AddRuleFromString("xyz")); - EXPECT_FALSE(resolver->AddRuleFromString("")); + EXPECT_FALSE(resolver->AddRuleFromString(std::string())); EXPECT_FALSE(resolver->AddRuleFromString(" ")); EXPECT_FALSE(resolver->AddRuleFromString("EXCLUDE")); EXPECT_FALSE(resolver->AddRuleFromString("EXCLUDE foo bar")); diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc index fb03836..e6ecf59 100644 --- a/net/dns/mock_host_resolver.cc +++ b/net/dns/mock_host_resolver.cc @@ -256,8 +256,13 @@ void RuleBasedHostResolverProc::AddRuleForAddressFamily( DCHECK(!replacement.empty()); 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); + Rule rule(Rule::kResolverTypeSystem, + host_pattern, + address_family, + flags, + replacement, + std::string(), + 0); rules_.push_back(rule); } @@ -286,8 +291,13 @@ void RuleBasedHostResolverProc::AddRuleWithLatency( DCHECK(!replacement.empty()); 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); + Rule rule(Rule::kResolverTypeSystem, + host_pattern, + ADDRESS_FAMILY_UNSPECIFIED, + flags, + replacement, + std::string(), + latency_ms); rules_.push_back(rule); } @@ -295,8 +305,13 @@ void RuleBasedHostResolverProc::AllowDirectLookup( const std::string& host_pattern) { 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); + Rule rule(Rule::kResolverTypeSystem, + host_pattern, + ADDRESS_FAMILY_UNSPECIFIED, + flags, + std::string(), + std::string(), + 0); rules_.push_back(rule); } @@ -304,8 +319,13 @@ void RuleBasedHostResolverProc::AddSimulatedFailure( const std::string& host_pattern) { 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); + Rule rule(Rule::kResolverTypeFail, + host_pattern, + ADDRESS_FAMILY_UNSPECIFIED, + flags, + std::string(), + std::string(), + 0); rules_.push_back(rule); } diff --git a/net/dns/single_request_host_resolver_unittest.cc b/net/dns/single_request_host_resolver_unittest.cc index 3e2ea1e..1b0198f 100644 --- a/net/dns/single_request_host_resolver_unittest.cc +++ b/net/dns/single_request_host_resolver_unittest.cc @@ -68,7 +68,7 @@ TEST(SingleRequestHostResolverTest, NormalResolve) { // Create a host resolver dependency that returns address "199.188.1.166" // for resolutions of "watsup". MockHostResolver resolver; - resolver.rules()->AddIPLiteralRule("watsup", "199.188.1.166", ""); + resolver.rules()->AddIPLiteralRule("watsup", "199.188.1.166", std::string()); SingleRequestHostResolver single_request_resolver(&resolver); |