| 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..3bf1aac778aeeb5bdce994cccd99b26b5c810245 100644
|
| --- a/net/disk_cache/backend_unittest.cc
|
| +++ b/net/disk_cache/backend_unittest.cc
|
| @@ -2118,3 +2118,26 @@ TEST_F(DiskCacheBackendTest, FileSharing) {
|
|
|
| EXPECT_TRUE(disk_cache::DeleteCacheFile(name));
|
| }
|
| +
|
| +TEST_F(DiskCacheBackendTest, UpdateRankForExternalCacheHit) {
|
| + 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.
|
| + cache_->OnExternalCacheHit("key0");
|
| +
|
| + TrimForTest(false);
|
| +
|
| + // Make sure the older key remains.
|
| + EXPECT_EQ(1, cache_->GetEntryCount());
|
| + ASSERT_EQ(net::OK, OpenEntry("key0", &entry));
|
| + entry->Close();
|
| +}
|
|
|