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

Side by Side Diff: net/base/host_resolver_impl_unittest.cc

Issue 155618: Use manually constructed IPv6 socket addresses for tests, rather than system ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 11 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/address_list.cc ('k') | net/base/mock_host_resolver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 const uint8 expect_addr[] = { 312 const uint8 expect_addr[] = {
313 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 313 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
315 }; 315 };
316 for (int i = 0; i < 16; i++) { 316 for (int i = 0; i < 16; i++) {
317 EXPECT_EQ(expect_addr[i], sa_in6->sin6_addr.s6_addr[i]); 317 EXPECT_EQ(expect_addr[i], sa_in6->sin6_addr.s6_addr[i]);
318 } 318 }
319 } 319 }
320 320
321 TEST_F(HostResolverImplTest, EmptyHost) { 321 // TODO(eroman): This test is disabled because it is bogus. It used to pass
322 // solely because of a bug in the RuleBasedHostMapper -- (empty replacements
323 // would map to a failure). However when using the actual host resolver
324 // (getaddrinfo), this is not necessarily the case. On windows getaddrinfo("")
325 // gives you the address of your machine.
326 TEST_F(HostResolverImplTest, DISABLED_EmptyHost) {
322 scoped_refptr<RuleBasedHostResolverProc> resolver_proc = 327 scoped_refptr<RuleBasedHostResolverProc> resolver_proc =
323 new RuleBasedHostResolverProc(NULL); 328 new RuleBasedHostResolverProc(NULL);
324 resolver_proc->AllowDirectLookup("*"); 329 resolver_proc->AllowDirectLookup("*");
325 330
326 scoped_refptr<net::HostResolver> host_resolver( 331 scoped_refptr<net::HostResolver> host_resolver(
327 new HostResolverImpl(resolver_proc, kMaxCacheEntries, kMaxCacheAgeMs)); 332 new HostResolverImpl(resolver_proc, kMaxCacheEntries, kMaxCacheAgeMs));
328 net::AddressList adrlist; 333 net::AddressList adrlist;
329 const int kPortnum = 5555; 334 const int kPortnum = 5555;
330 net::HostResolver::RequestInfo info("", kPortnum); 335 net::HostResolver::RequestInfo info("", kPortnum);
331 int err = host_resolver->Resolve(info, &adrlist, NULL, NULL); 336 int err = host_resolver->Resolve(info, &adrlist, NULL, NULL);
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 EXPECT_EQ(2U, observer.start_log.size()); 919 EXPECT_EQ(2U, observer.start_log.size());
915 EXPECT_EQ(0U, observer.finish_log.size()); 920 EXPECT_EQ(0U, observer.finish_log.size());
916 EXPECT_EQ(2U, observer.cancel_log.size()); 921 EXPECT_EQ(2U, observer.cancel_log.size());
917 922
918 net::HostResolver::RequestInfo info("host2", 60); 923 net::HostResolver::RequestInfo info("host2", 60);
919 EXPECT_TRUE(observer.cancel_log[1] == 924 EXPECT_TRUE(observer.cancel_log[1] ==
920 CapturingObserver::StartOrCancelEntry(1, info)); 925 CapturingObserver::StartOrCancelEntry(1, info));
921 } 926 }
922 927
923 } // namespace 928 } // namespace
OLDNEW
« no previous file with comments | « net/base/address_list.cc ('k') | net/base/mock_host_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698