diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 17:47:10 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 17:47:10 +0000 |
commit | 2f3bc65c0d7abb88bc3f9c88d32625eceaa7f5bc (patch) | |
tree | 748f318e00982b2a3a2ca3591cbd6cdb4f5c1b6b /net/base/host_cache_unittest.cc | |
parent | 5ce20320ef59981866de5f51ef2ddc671ea205e8 (diff) | |
download | chromium_src-2f3bc65c0d7abb88bc3f9c88d32625eceaa7f5bc.zip chromium_src-2f3bc65c0d7abb88bc3f9c88d32625eceaa7f5bc.tar.gz chromium_src-2f3bc65c0d7abb88bc3f9c88d32625eceaa7f5bc.tar.bz2 |
[Linux] Enable connecting to localhost when offline.
Add a utility function to determine if only loopback address are configured.
Add a mechanism to add supplemental HostResolverFlags in the HostResolver.
Change the resolver on Linux to not use AI_ADDRCONFIG if only loopback addresses are configured.
BUG=41408
TEST=localhost works when offline
Review URL: http://codereview.chromium.org/3036011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_cache_unittest.cc')
-rw-r--r-- | net/base/host_cache_unittest.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/base/host_cache_unittest.cc b/net/base/host_cache_unittest.cc index a851c0b..54a64c4 100644 --- a/net/base/host_cache_unittest.cc +++ b/net/base/host_cache_unittest.cc @@ -314,9 +314,12 @@ TEST(HostCacheTest, HostResolverFlagsArePartOfKey) { HostCache::Key key1("foobar.com", ADDRESS_FAMILY_IPV4, 0); HostCache::Key key2("foobar.com", ADDRESS_FAMILY_IPV4, HOST_RESOLVER_CANONNAME); + HostCache::Key key3("foobar.com", ADDRESS_FAMILY_IPV4, + HOST_RESOLVER_LOOPBACK_ONLY); const HostCache::Entry* entry1 = NULL; // Entry for key1 const HostCache::Entry* entry2 = NULL; // Entry for key2 + const HostCache::Entry* entry3 = NULL; // Entry for key3 EXPECT_EQ(0U, cache.size()); @@ -334,9 +337,18 @@ TEST(HostCacheTest, HostResolverFlagsArePartOfKey) { EXPECT_FALSE(entry2 == NULL); EXPECT_EQ(2U, cache.size()); + // Add an entry for ("foobar.com", IPV4, LOOPBACK_ONLY) at t=0. + EXPECT_TRUE(cache.Lookup(key3, base::TimeTicks()) == NULL); + cache.Set(key3, OK, AddressList(), now); + entry3 = cache.Lookup(key3, base::TimeTicks()); + EXPECT_FALSE(entry3 == NULL); + EXPECT_EQ(3U, cache.size()); + // Even though the hostnames were the same, we should have two unique // entries (because the HostResolverFlags differ). EXPECT_NE(entry1, entry2); + EXPECT_NE(entry1, entry3); + EXPECT_NE(entry2, entry3); } TEST(HostCacheTest, NoCache) { |