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

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

Issue 11196036: Finish conversion from bloom filter to prefix set in safe browsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delete the unnecessary unit test. Created 8 years, 2 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 | « chrome/browser/safe_browsing/safe_browsing_database.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 2938ebd497430edde1befa3269963af1d25af397..31cb3600681adb6291a22da275468519273baf9f 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -9,7 +9,6 @@
#include "base/message_loop.h"
#include "base/scoped_temp_dir.h"
#include "base/time.h"
-#include "chrome/browser/safe_browsing/bloom_filter.h"
#include "chrome/browser/safe_browsing/safe_browsing_database.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h"
@@ -321,8 +320,8 @@ TEST_F(SafeBrowsingDatabaseTest, ListNameForBrowse) {
EXPECT_EQ(lists[0].subs, "7");
if (lists.size() == 2) {
// Old style database won't have the second entry since it creates the lists
- // when it receives an update containing that list. The new bloom filter
- // based database has these values hard coded.
+ // when it receives an update containing that list. The filter-based
+ // database has these values hard coded.
EXPECT_TRUE(lists[1].name == safe_browsing_util::kPhishingList);
EXPECT_TRUE(lists[1].adds.empty());
EXPECT_TRUE(lists[1].subs.empty());
@@ -1646,58 +1645,3 @@ TEST_F(SafeBrowsingDatabaseTest, FilterFile) {
GURL("http://www.good.com/goodware.html"),
&matching_list, &prefix_hits, &full_hashes, now));
}
-
-TEST_F(SafeBrowsingDatabaseTest, PrefixSetTransition) {
- // Create a database with trivial example data and write it out.
- {
- SBChunkList chunks;
- SBChunk chunk;
-
- // Prime the database.
- std::vector<SBListChunkRanges> lists;
- EXPECT_TRUE(database_->UpdateStarted(&lists));
-
- InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
- "www.evil.com/malware.html");
- chunks.clear();
- chunks.push_back(chunk);
- database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
- database_->UpdateFinished(true);
- }
-
- // Some helpful paths.
- FilePath prefix_set_file = database_->PrefixSetForFilename(
- database_->BrowseDBFilename(database_filename_));
- FilePath bloom_filter_file = database_->BloomFilterForFilename(
- database_->BrowseDBFilename(database_filename_));
-
- // Manually create a bloom filter for the prefixes and write it out.
- {
- scoped_refptr<BloomFilter> filter(
- new BloomFilter(BloomFilter::kBloomFilterSizeRatio *
- BloomFilter::kBloomFilterMinSize));
- filter->Insert(Sha256Prefix("www.evil.com/"));
- filter->Insert(Sha256Prefix("www.evil.com/malware.html"));
- ASSERT_TRUE(filter->WriteFile(bloom_filter_file));
- }
-
- file_util::Delete(prefix_set_file, false);
- ASSERT_FALSE(file_util::PathExists(prefix_set_file));
- ASSERT_TRUE(file_util::PathExists(bloom_filter_file));
-
- // Reload the database.
- database_.reset(new SafeBrowsingDatabaseNew);
- database_->Init(database_filename_);
-
- // Should find the malware.
- const Time now = Time::Now();
- std::vector<SBFullHashResult> full_hashes;
- std::vector<SBPrefix> prefix_hits;
- std::string matching_list;
- EXPECT_TRUE(database_->ContainsBrowseUrl(
- GURL("http://www.evil.com/malware.html"),
- &matching_list, &prefix_hits, &full_hashes, now));
- EXPECT_FALSE(database_->ContainsBrowseUrl(
- GURL("http://www.good.com/goodware.html"),
- &matching_list, &prefix_hits, &full_hashes, now));
-}
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698