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

Unified Diff: net/disk_cache/simple/simple_index_unittest.cc

Issue 22406005: Index initialization improvements for Simple Cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add unit test, fix windows build. Created 7 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
Index: net/disk_cache/simple/simple_index_unittest.cc
diff --git a/net/disk_cache/simple/simple_index_unittest.cc b/net/disk_cache/simple/simple_index_unittest.cc
index cfc83b3e8f3dfd307c0188d46a2f843f0851bedf..0c845b21318cf4b9574217c0c4ed07186bbe339d 100644
--- a/net/disk_cache/simple/simple_index_unittest.cc
+++ b/net/disk_cache/simple/simple_index_unittest.cc
@@ -197,12 +197,15 @@ TEST_F(SimpleIndexTest, IndexSizeCorrectOnMerge) {
{
scoped_ptr<SimpleIndexLoadResult> result(new SimpleIndexLoadResult());
result->did_load = true;
- const uint64 hash_key = simple_util::GetEntryHashKey("eleven");
+ const uint64 new_hash_key = simple_util::GetEntryHashKey("eleven");
result->entries.insert(
- std::make_pair(hash_key, EntryMetadata(base::Time::Now(), 11)));
+ std::make_pair(new_hash_key, EntryMetadata(base::Time::Now(), 11)));
+ const uint64 redundant_hash_key = simple_util::GetEntryHashKey("seven");
+ result->entries.insert(std::make_pair(redundant_hash_key,
+ EntryMetadata(base::Time::Now(), 7)));
index()->MergeInitializingSet(result.Pass());
}
- EXPECT_EQ(25U, index()->cache_size_);
+ EXPECT_EQ(2U + 5U + 7U + 11U, index()->cache_size_);
}
// State of index changes as expected with an insert and a remove.
« net/disk_cache/simple/simple_index.cc ('K') | « net/disk_cache/simple/simple_index_file.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698