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

Unified Diff: base/memory/mru_cache_unittest.cc

Issue 7549003: Optimize phishing page term feature extraction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Brian's comments Created 9 years, 4 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
« no previous file with comments | « base/memory/mru_cache.h ('k') | base/string_piece.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"));
+}
« no previous file with comments | « base/memory/mru_cache.h ('k') | base/string_piece.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698