| OLD | NEW |
| 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 #include "net/base/host_resolver_impl.h" | 5 #include "net/base/host_resolver_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 std::string ip_literal = base::StringPrintf("192.%d.%d.%d", | 290 std::string ip_literal = base::StringPrintf("192.%d.%d.%d", |
| 291 static_cast<int>(hostname.size()), | 291 static_cast<int>(hostname.size()), |
| 292 static_cast<int>(hostname[0]), | 292 static_cast<int>(hostname[0]), |
| 293 static_cast<int>(address_family)); | 293 static_cast<int>(address_family)); |
| 294 | 294 |
| 295 return SystemHostResolverProc(ip_literal, | 295 return SystemHostResolverProc(ip_literal, |
| 296 ADDRESS_FAMILY_UNSPECIFIED, | 296 ADDRESS_FAMILY_UNSPECIFIED, |
| 297 host_resolver_flags, | 297 host_resolver_flags, |
| 298 addrlist, os_error); | 298 addrlist, os_error); |
| 299 } | 299 } |
| 300 |
| 301 private: |
| 302 virtual ~EchoingHostResolverProc() {} |
| 300 }; | 303 }; |
| 301 | 304 |
| 302 // Using LookupAttemptHostResolverProc simulate very long lookups, and control | 305 // Using LookupAttemptHostResolverProc simulate very long lookups, and control |
| 303 // which attempt resolves the host. | 306 // which attempt resolves the host. |
| 304 class LookupAttemptHostResolverProc : public HostResolverProc { | 307 class LookupAttemptHostResolverProc : public HostResolverProc { |
| 305 public: | 308 public: |
| 306 LookupAttemptHostResolverProc(HostResolverProc* previous, | 309 LookupAttemptHostResolverProc(HostResolverProc* previous, |
| 307 int attempt_number_to_resolve, | 310 int attempt_number_to_resolve, |
| 308 int total_attempts) | 311 int total_attempts) |
| 309 : HostResolverProc(previous), | 312 : HostResolverProc(previous), |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1964 EXPECT_EQ("[::1]:80", ipv6string); | 1967 EXPECT_EQ("[::1]:80", ipv6string); |
| 1965 EXPECT_EQ(1u, NumberOfAddresses(req6.addrlist())); | 1968 EXPECT_EQ(1u, NumberOfAddresses(req6.addrlist())); |
| 1966 | 1969 |
| 1967 // Request with upper case. | 1970 // Request with upper case. |
| 1968 ResolveRequest req7(host_resolver.get(), "er_IPV4", 80); | 1971 ResolveRequest req7(host_resolver.get(), "er_IPV4", 80); |
| 1969 EXPECT_EQ(OK, req7.result()); | 1972 EXPECT_EQ(OK, req7.result()); |
| 1970 EXPECT_EQ("127.0.0.1:80", FirstAddressToString(req7.addrlist())); | 1973 EXPECT_EQ("127.0.0.1:80", FirstAddressToString(req7.addrlist())); |
| 1971 } | 1974 } |
| 1972 | 1975 |
| 1973 } // namespace net | 1976 } // namespace net |
| OLD | NEW |