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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 7461106: Inform disk cache of WebKit memory cache hits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
Index: net/disk_cache/backend_unittest.cc
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 1cde9b6536be65fb73ec6a88424fd30b0396b4e8..574ba79752fd2ed1b1402956982fc3a0793b5ddf 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -2118,3 +2118,28 @@ TEST_F(DiskCacheBackendTest, FileSharing) {
EXPECT_TRUE(disk_cache::DeleteCacheFile(name));
}
+
+TEST_F(DiskCacheBackendTest, UpdateRankForExternalCacheHit) {
rvargas (doing something else) 2011/07/27 23:26:17 I know the distinction is not that clear, but this
+ SetDirectMode();
+ InitCache();
+
+ disk_cache::Entry* entry;
+
+ for (int i = 0; i < 2; ++i) {
+ std::string key = StringPrintf("key%d", i);
+ ASSERT_EQ(net::OK, CreateEntry(key, &entry));
+ entry->Close();
+ }
+
+ // Ping the oldest entry.
+ ASSERT_EQ(net::OK, OpenEntry("key0", &entry));
+ entry->UpdateRankForExternalCacheHit();
+ entry->Close();
+
+ TrimForTest(false);
+
+ // Make sure the older key remains.
+ EXPECT_EQ(1, cache_->GetEntryCount());
+ ASSERT_EQ(net::OK, OpenEntry("key0", &entry));
+ entry->Close();
+}

Powered by Google App Engine
This is Rietveld 408576698