OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
9 #include <wspiapi.h> | 9 #include <wspiapi.h> |
10 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 337 |
338 const uint8 expect_addr[] = { | 338 const uint8 expect_addr[] = { |
339 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, | 339 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, |
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 | 340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 |
341 }; | 341 }; |
342 for (int i = 0; i < 16; i++) { | 342 for (int i = 0; i < 16; i++) { |
343 EXPECT_EQ(expect_addr[i], sa_in6->sin6_addr.s6_addr[i]); | 343 EXPECT_EQ(expect_addr[i], sa_in6->sin6_addr.s6_addr[i]); |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 // TODO(eroman): This test is disabled because it is bogus. It used to pass | 347 TEST_F(HostResolverImplTest, EmptyHost) { |
348 // solely because of a bug in the RuleBasedHostMapper -- (empty replacements | |
349 // would map to a failure). However when using the actual host resolver | |
350 // (getaddrinfo), this is not necessarily the case. On windows getaddrinfo("") | |
351 // gives you the address of your machine. | |
352 TEST_F(HostResolverImplTest, DISABLED_EmptyHost) { | |
353 scoped_refptr<RuleBasedHostResolverProc> resolver_proc = | 348 scoped_refptr<RuleBasedHostResolverProc> resolver_proc = |
354 new RuleBasedHostResolverProc(NULL); | 349 new RuleBasedHostResolverProc(NULL); |
355 resolver_proc->AllowDirectLookup("*"); | 350 resolver_proc->AllowDirectLookup("*"); |
356 | 351 |
357 scoped_refptr<net::HostResolver> host_resolver( | 352 scoped_refptr<net::HostResolver> host_resolver( |
358 new HostResolverImpl(resolver_proc, kMaxCacheEntries, kMaxCacheAgeMs)); | 353 new HostResolverImpl(resolver_proc, kMaxCacheEntries, kMaxCacheAgeMs)); |
359 net::AddressList adrlist; | 354 net::AddressList adrlist; |
360 const int kPortnum = 5555; | 355 const int kPortnum = 5555; |
361 net::HostResolver::RequestInfo info("", kPortnum); | 356 net::HostResolver::RequestInfo info("", kPortnum); |
362 int err = host_resolver->Resolve(NULL, info, &adrlist, NULL, NULL); | 357 int err = host_resolver->Resolve(NULL, info, &adrlist, NULL, NULL); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 EXPECT_EQ(2U, observer.start_log.size()); | 955 EXPECT_EQ(2U, observer.start_log.size()); |
961 EXPECT_EQ(0U, observer.finish_log.size()); | 956 EXPECT_EQ(0U, observer.finish_log.size()); |
962 EXPECT_EQ(2U, observer.cancel_log.size()); | 957 EXPECT_EQ(2U, observer.cancel_log.size()); |
963 | 958 |
964 net::HostResolver::RequestInfo info("host2", 60); | 959 net::HostResolver::RequestInfo info("host2", 60); |
965 EXPECT_TRUE(observer.cancel_log[1] == | 960 EXPECT_TRUE(observer.cancel_log[1] == |
966 CapturingObserver::StartOrCancelEntry(1, info)); | 961 CapturingObserver::StartOrCancelEntry(1, info)); |
967 } | 962 } |
968 | 963 |
969 } // namespace | 964 } // namespace |
OLD | NEW |