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

Unified Diff: components/safe_browsing_db/v4_store_unittest.cc

Issue 2154973002: Reland: PVer4: Keep track of the smallest hashes not their sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't increment the iterator past the end. Check first. Created 4 years, 5 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: components/safe_browsing_db/v4_store_unittest.cc
diff --git a/components/safe_browsing_db/v4_store_unittest.cc b/components/safe_browsing_db/v4_store_unittest.cc
index cb0fd02aaaf26e80826517b633ff3f73e7a753b8..3bcb884e2803c572ec93f2efa9a8a1e7a1cd64c9 100644
--- a/components/safe_browsing_db/v4_store_unittest.cc
+++ b/components/safe_browsing_db/v4_store_unittest.cc
@@ -177,46 +177,29 @@ TEST_F(V4StoreTest, TestAddUnlumpedHashes) {
EXPECT_EQ("abcde5432100000-----", hash_prefixes);
}
-TEST_F(V4StoreTest, TestGetNextSmallestPrefixSizeWithEmptyPrefixMap) {
+TEST_F(V4StoreTest, TestGetNextSmallestUnmergedPrefixWithEmptyPrefixMap) {
HashPrefixMap prefix_map;
- CounterMap counter_map;
- V4Store::InitializeCounterMap(prefix_map, &counter_map);
+ IteratorMap iterator_map;
+ V4Store::InitializeIteratorMap(prefix_map, &iterator_map);
- PrefixSize prefix_size;
- EXPECT_FALSE(V4Store::GetNextSmallestPrefixSize(prefix_map, counter_map,
- &prefix_size));
+ HashPrefix prefix;
+ EXPECT_FALSE(V4Store::GetNextSmallestUnmergedPrefix(prefix_map, iterator_map,
+ &prefix));
}
-TEST_F(V4StoreTest, TestGetNextSmallestPrefixSize) {
+TEST_F(V4StoreTest, TestGetNextSmallestUnmergedPrefix) {
HashPrefixMap prefix_map;
EXPECT_EQ(APPLY_UPDATE_SUCCESS,
V4Store::AddUnlumpedHashes(5, "-----0000054321abcde", &prefix_map));
EXPECT_EQ(APPLY_UPDATE_SUCCESS,
- V4Store::AddUnlumpedHashes(4, "-----0000054321abcde", &prefix_map));
- CounterMap counter_map;
- V4Store::InitializeCounterMap(prefix_map, &counter_map);
-
- PrefixSize prefix_size;
- EXPECT_TRUE(V4Store::GetNextSmallestPrefixSize(prefix_map, counter_map,
- &prefix_size));
- EXPECT_EQ(4u, prefix_size);
-}
-
-TEST_F(V4StoreTest, TestGetNextUnmergedPrefix) {
- HashPrefixMap prefix_map;
- EXPECT_EQ(APPLY_UPDATE_SUCCESS,
- V4Store::AddUnlumpedHashes(5, "-----0000054321abcde", &prefix_map));
- EXPECT_EQ(APPLY_UPDATE_SUCCESS,
- V4Store::AddUnlumpedHashes(4, "-----0000054321abcde", &prefix_map));
- CounterMap counter_map;
- V4Store::InitializeCounterMap(prefix_map, &counter_map);
-
- PrefixSize prefix_size;
- EXPECT_TRUE(V4Store::GetNextSmallestPrefixSize(prefix_map, counter_map,
- &prefix_size));
- const HashPrefix& prefix = V4Store::GetNextUnmergedPrefixForSize(
- prefix_size, prefix_map, counter_map);
- EXPECT_EQ("----", prefix);
+ V4Store::AddUnlumpedHashes(4, "*****0000054321abcde", &prefix_map));
+ IteratorMap iterator_map;
+ V4Store::InitializeIteratorMap(prefix_map, &iterator_map);
+
+ HashPrefix prefix;
+ EXPECT_TRUE(V4Store::GetNextSmallestUnmergedPrefix(prefix_map, iterator_map,
+ &prefix));
+ EXPECT_EQ("****", prefix);
}
TEST_F(V4StoreTest, TestMergeUpdatesWithSameSizesInEachMap) {
« components/safe_browsing_db/v4_store.cc ('K') | « components/safe_browsing_db/v4_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698