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

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

Issue 1643573002: Add a ModuleLoadAnalyzer which checks modules against a whitelist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only enable for extended reporting AND feature flag. Add unit test. Created 4 years, 10 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_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 f3b094b0b56fa3de1914afeffac0234baff60a85..8d80e82366caf5462102e0eac922113189a6d2d0 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -280,11 +280,13 @@ class SafeBrowsingDatabaseTest : public PlatformTest {
new SafeBrowsingStoreFile(task_runner_);
SafeBrowsingStoreFile* unwanted_software_store =
new SafeBrowsingStoreFile(task_runner_);
+ SafeBrowsingStoreFile* module_whitelist_store =
+ new SafeBrowsingStoreFile(task_runner_);
database_.reset(new SafeBrowsingDatabaseNew(
task_runner_, browse_store, download_store, csd_whitelist_store,
download_whitelist_store, inclusion_whitelist_store,
- extension_blacklist_store, ip_blacklist_store,
- unwanted_software_store));
+ extension_blacklist_store, ip_blacklist_store, unwanted_software_store,
+ module_whitelist_store));
database_->Init(database_filename_);
}
@@ -440,10 +442,14 @@ TEST_F(SafeBrowsingDatabaseTest, ListNames) {
chunks.push_back(AddChunkPrefixValue(11, "www.unwanted.com/software.html"));
database_->InsertChunks(kUnwantedUrlList, chunks);
+ chunks.clear();
+ chunks.push_back(AddChunkPrefixValue(12, "chrome.dll"));
+ database_->InsertChunks(kModuleWhitelist, chunks);
+
database_->UpdateFinished(true);
GetListsInfo(&lists);
- ASSERT_EQ(9U, lists.size());
+ ASSERT_EQ(10U, lists.size());
EXPECT_EQ(kMalwareList, lists[0].name);
EXPECT_EQ("1", lists[0].adds);
EXPECT_TRUE(lists[0].subs.empty());
@@ -471,6 +477,9 @@ TEST_F(SafeBrowsingDatabaseTest, ListNames) {
EXPECT_EQ(kUnwantedUrlList, lists[8].name);
EXPECT_EQ("11", lists[8].adds);
EXPECT_TRUE(lists[8].subs.empty());
+ EXPECT_EQ(kModuleWhitelist, lists[9].name);
+ EXPECT_EQ("12", lists[9].adds);
+ EXPECT_TRUE(lists[9].subs.empty());
database_.reset();
}
@@ -1153,7 +1162,7 @@ TEST_F(SafeBrowsingDatabaseTest, DISABLED_FileCorruptionHandling) {
base::MessageLoop loop;
SafeBrowsingStoreFile* store = new SafeBrowsingStoreFile(task_runner_);
database_.reset(new SafeBrowsingDatabaseNew(
- task_runner_, store, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
+ task_runner_, store, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
database_->Init(database_filename_);
// This will cause an empty database to be created.
@@ -1328,7 +1337,7 @@ TEST_F(SafeBrowsingDatabaseTest, Whitelists) {
// If the whitelist is disabled everything should match the whitelist.
database_.reset(new SafeBrowsingDatabaseNew(
task_runner_, new SafeBrowsingStoreFile(task_runner_), NULL, NULL, NULL,
- NULL, NULL, NULL, NULL));
+ NULL, NULL, NULL, NULL, NULL));
database_->Init(database_filename_);
for (const auto& test_case : kTestCases) {
SCOPED_TRACE(std::string("Tested list at fault => ") +

Powered by Google App Engine
This is Rietveld 408576698