Index: base/memory/mru_cache_unittest.cc |
diff --git a/base/memory/mru_cache_unittest.cc b/base/memory/mru_cache_unittest.cc |
index 89ca2fadd808627efdc2e36191e90d643ccde01e..39677f2d0cffee484a977a39b7e3d6c9dcf1d0d9 100644 |
--- a/base/memory/mru_cache_unittest.cc |
+++ b/base/memory/mru_cache_unittest.cc |
@@ -251,3 +251,21 @@ TEST(MRUCacheTest, AutoEvict) { |
// There should be no objects leaked. |
EXPECT_EQ(initial_count, cached_item_live_count); |
} |
+ |
+TEST(MRUCacheTest, HashingMRUCache) { |
+ // Very simple test to make sure that the hashing cache works correctly. |
+ typedef base::HashingMRUCache<std::string, CachedItem> Cache; |
+ Cache cache(Cache::NO_AUTO_EVICT); |
+ |
+ CachedItem one(1); |
+ cache.Put("First", one); |
+ |
+ CachedItem two(2); |
+ cache.Put("Second", two); |
+ |
+ EXPECT_EQ(one.value, cache.Get("First")->second.value); |
+ EXPECT_EQ(two.value, cache.Get("Second")->second.value); |
+ cache.ShrinkToSize(1); |
+ EXPECT_EQ(two.value, cache.Get("Second")->second.value); |
+ EXPECT_EQ(cache.end(), cache.Get("First")); |
+} |