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

Unified Diff: net/base/host_cache_unittest.cc

Issue 3067012: Merge 53487 - [Linux] Enable connecting to localhost when offline.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/address_family.h ('k') | net/base/host_resolver_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_cache_unittest.cc
===================================================================
--- net/base/host_cache_unittest.cc (revision 53998)
+++ net/base/host_cache_unittest.cc (working copy)
@@ -314,9 +314,12 @@
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 @@
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) {
« no previous file with comments | « net/base/address_family.h ('k') | net/base/host_resolver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698