Chromium Code Reviews| 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(); |
| +} |