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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc

Issue 507653003: Remove safe-browsing code to fix up injected prefixes. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert original CL more thoroughly. Created 6 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: chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
index 2766e5571309c028fe0dce2ccb3e6205917b9e03..310f63455cda89fe16051d49533227b87b7eb660 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
@@ -818,6 +818,8 @@ TEST_F(SafeBrowsingStoreFileTest, Version8) {
EXPECT_TRUE(store_->CheckSubChunk(kSubChunk1));
// Sub chunk kAddChunk1 hash kHash2.
+ // NOTE(shess): Having full hashes and prefixes in the same chunk is no longer
+ // supported, though it was when this code was written.
store_->SetSubChunk(kSubChunk2);
EXPECT_TRUE(store_->CheckSubChunk(kSubChunk1));
EXPECT_TRUE(store_->WriteSubPrefix(kSubChunk1, kAddChunk1, kHash2.prefix));
@@ -839,77 +841,4 @@ TEST_F(SafeBrowsingStoreFileTest, Version8) {
}
#endif
-// Test that when the v8 golden file is updated, the add prefix injected from
-// the full hash is removed. All platforms generating v8 files are
-// little-endian, so there is no point to testing this transition if/when a
-// big-endian port is added.
-#if defined(ARCH_CPU_LITTLE_ENDIAN)
-TEST_F(SafeBrowsingStoreFileTest, KnockoutPrefixVolunteers) {
- store_.reset();
-
- // Copy the golden file into temporary storage. The golden file contains:
- // - Add chunk kAddChunk1 containing kHash1.prefix and kHash2.
- // - Sub chunk kSubChunk1 containing kHash3.
- const char kBasename[] = "FileStoreVersion8";
- base::FilePath golden_path;
- ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &golden_path));
- golden_path = golden_path.AppendASCII("SafeBrowsing");
- golden_path = golden_path.AppendASCII(kBasename);
- ASSERT_TRUE(base::CopyFile(golden_path, filename_));
-
- // Reset the store to make sure it re-reads the file.
- store_.reset(new SafeBrowsingStoreFile());
- store_->Init(filename_,
- base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected,
- base::Unretained(this)));
-
- // Check that the expected prefixes and hashes are in place.
- {
- SBAddPrefixes add_prefixes;
- EXPECT_TRUE(store_->GetAddPrefixes(&add_prefixes));
- ASSERT_EQ(2U, add_prefixes.size());
- EXPECT_EQ(kAddChunk1, add_prefixes[0].chunk_id);
- EXPECT_EQ(kHash1.prefix, add_prefixes[0].prefix);
- EXPECT_EQ(kAddChunk1, add_prefixes[1].chunk_id);
- EXPECT_EQ(kHash2.prefix, add_prefixes[1].prefix);
-
- std::vector<SBAddFullHash> add_hashes;
- EXPECT_TRUE(store_->GetAddFullHashes(&add_hashes));
- ASSERT_EQ(1U, add_hashes.size());
- EXPECT_EQ(kAddChunk1, add_hashes[0].chunk_id);
- EXPECT_TRUE(SBFullHashEqual(kHash2, add_hashes[0].full_hash));
- }
-
- // Update the store.
- {
- EXPECT_TRUE(store_->BeginUpdate());
-
- safe_browsing::PrefixSetBuilder builder;
- std::vector<SBAddFullHash> add_full_hashes_result;
- ASSERT_TRUE(store_->FinishUpdate(&builder, &add_full_hashes_result));
- }
-
- // Reset the store to make sure it re-reads the file.
- store_.reset(new SafeBrowsingStoreFile());
- store_->Init(filename_,
- base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected,
- base::Unretained(this)));
-
- // |kHash2.prefix| should have dropped.
- {
- SBAddPrefixes add_prefixes;
- EXPECT_TRUE(store_->GetAddPrefixes(&add_prefixes));
- ASSERT_EQ(1U, add_prefixes.size());
- EXPECT_EQ(kAddChunk1, add_prefixes[0].chunk_id);
- EXPECT_EQ(kHash1.prefix, add_prefixes[0].prefix);
-
- std::vector<SBAddFullHash> add_hashes;
- EXPECT_TRUE(store_->GetAddFullHashes(&add_hashes));
- ASSERT_EQ(1U, add_hashes.size());
- EXPECT_EQ(kAddChunk1, add_hashes[0].chunk_id);
- EXPECT_TRUE(SBFullHashEqual(kHash2, add_hashes[0].full_hash));
- }
-}
-#endif
-
} // namespace safe_browsing
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_store.cc ('k') | chrome/browser/safe_browsing/safe_browsing_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698