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

Unified Diff: chrome/common/safe_browsing/file_type_policies_unittest.cc

Issue 1979153002: Use FileTypePolicies for is_archive and is_supported classifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_by_platform
Patch Set: Fix comment, per asanka's review Created 4 years, 7 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/common/safe_browsing/file_type_policies.cc ('k') | chrome/common/safe_browsing/zip_analyzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/safe_browsing/file_type_policies_unittest.cc
diff --git a/chrome/common/safe_browsing/file_type_policies_unittest.cc b/chrome/common/safe_browsing/file_type_policies_unittest.cc
index 7ab64baa4ef11bf751d7bd54887246d58d25b841..c5e3cbb1a18668ca8000288b3854e98081a9c81e 100644
--- a/chrome/common/safe_browsing/file_type_policies_unittest.cc
+++ b/chrome/common/safe_browsing/file_type_policies_unittest.cc
@@ -54,7 +54,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
DownloadFileType file_type = policies_.PolicyForFile(exe_file);
EXPECT_EQ("exe", file_type.extension());
EXPECT_EQ(0l, file_type.uma_value());
- EXPECT_EQ(false, file_type.is_archive());
+ EXPECT_FALSE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
#if defined(OS_WIN)
EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE,
@@ -74,7 +74,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
file_type = policies_.PolicyForFile(class_file);
EXPECT_EQ("class", file_type.extension());
EXPECT_EQ(13l, file_type.uma_value());
- EXPECT_EQ(false, file_type.is_archive());
+ EXPECT_FALSE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
#if defined(OS_CHROMEOS)
EXPECT_EQ(DownloadFileType::NOT_DANGEROUS,
@@ -93,7 +93,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
file_type = policies_.PolicyForFile(dmg_file);
EXPECT_EQ("dmg", file_type.extension());
EXPECT_EQ(21, file_type.uma_value());
- EXPECT_EQ(false, file_type.is_archive());
+ EXPECT_FALSE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
#if defined(OS_MACOSX)
EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE,
@@ -112,7 +112,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
file_type = policies_.PolicyForFile(dex_file);
EXPECT_EQ("dex", file_type.extension());
EXPECT_EQ(143, file_type.uma_value());
- EXPECT_EQ(false, file_type.is_archive());
+ EXPECT_FALSE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
#if defined(OS_ANDROID)
EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE,
@@ -131,7 +131,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
file_type = policies_.PolicyForFile(rpm_file);
EXPECT_EQ("rpm", file_type.extension());
EXPECT_EQ(142, file_type.uma_value());
- EXPECT_EQ(false, file_type.is_archive());
+ EXPECT_FALSE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE,
@@ -150,21 +150,22 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
file_type = policies_.PolicyForFile(zip_file);
EXPECT_EQ("zip", file_type.extension());
EXPECT_EQ(7l, file_type.uma_value());
- EXPECT_EQ(true, file_type.is_archive());
+ EXPECT_TRUE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
EXPECT_EQ(DownloadFileType::NOT_DANGEROUS,
file_type.platform_settings(0).danger_level());
// Check other accessors
EXPECT_EQ(7l, policies_.UmaValueForFile(zip_file));
- EXPECT_EQ(true, policies_.IsFileAnArchive(zip_file));
+ EXPECT_TRUE(policies_.IsArchiveFile(zip_file));
+ EXPECT_FALSE(policies_.IsArchiveFile(exe_file));
// Verify settings on the default type.
file_type = policies_.PolicyForFile(
base::FilePath(FILE_PATH_LITERAL("a/foo.fooobar")));
EXPECT_EQ("", file_type.extension());
EXPECT_EQ(18l, file_type.uma_value());
- EXPECT_EQ(false, file_type.is_archive());
+ EXPECT_FALSE(file_type.is_archive());
EXPECT_EQ(DownloadFileType::SAMPLED_PING, file_type.ping_setting());
EXPECT_EQ(DownloadFileType::NOT_DANGEROUS,
file_type.platform_settings(0).danger_level());
@@ -173,6 +174,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
}
TEST_F(FileTypePoliciesTest, BadProto) {
+ base::AutoLock lock(policies_.lock_);
EXPECT_EQ(FileTypePolicies::UpdateResult::FAILED_EMPTY,
policies_.PopulateFromBinaryPb(std::string()));
@@ -195,6 +197,7 @@ TEST_F(FileTypePoliciesTest, BadProto) {
}
TEST_F(FileTypePoliciesTest, BadUpdateFromExisting) {
+ base::AutoLock lock(policies_.lock_);
// Make a minimum viable config
DownloadFileTypeConfig cfg;
cfg.mutable_default_file_type()->add_platform_settings();
« no previous file with comments | « chrome/common/safe_browsing/file_type_policies.cc ('k') | chrome/common/safe_browsing/zip_analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698