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

Unified Diff: net/base/host_cache_unittest.cc

Issue 523076: Clear the host cache when closing the last incognito window.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address jar's comments Created 10 years, 11 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
« chrome/browser/browser_main.cc ('K') | « net/base/host_cache.h ('k') | no next file » | 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 35853)
+++ net/base/host_cache_unittest.cc (working copy)
@@ -319,6 +319,26 @@
EXPECT_EQ(0U, cache.size());
}
+TEST(HostCacheTest, Clear) {
+ HostCache cache(kMaxCacheEntries, kSuccessEntryTTL, kFailureEntryTTL);
+
+ // Set t=0.
+ base::TimeTicks now;
+
+ EXPECT_EQ(0u, cache.size());
+
+ // Add three entries.
+ cache.Set(Key("foobar1.com"), OK, AddressList(), now);
+ cache.Set(Key("foobar2.com"), OK, AddressList(), now);
+ cache.Set(Key("foobar3.com"), OK, AddressList(), now);
+
+ EXPECT_EQ(3u, cache.size());
+
+ cache.clear();
+
+ EXPECT_EQ(0u, cache.size());
+}
+
// Tests the less than and equal operators for HostCache::Key work.
TEST(HostCacheTest, KeyComparators) {
struct {
« chrome/browser/browser_main.cc ('K') | « net/base/host_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698