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

Unified Diff: chrome/browser/subresource_filter/subresource_filter_content_settings_manager_unittest.cc

Issue 2877553002: [subresource_filter] Swap ALLOW and BLOCK meanings in the content setting (Closed)
Patch Set: Created 3 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
Index: chrome/browser/subresource_filter/subresource_filter_content_settings_manager_unittest.cc
diff --git a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager_unittest.cc b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager_unittest.cc
index 06fa25c9d512025f3cc459f44af049d118d1cda2..34979234304cbdb5521301e42bcc3ff84d0080df 100644
--- a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager_unittest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager_unittest.cc
@@ -104,21 +104,21 @@ class SubresourceFilterContentSettingsManagerHistoryTest
TEST_F(SubresourceFilterContentSettingsManagerTest, IrrelevantSetting) {
GetSettingsMap()->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_POPUPS,
- CONTENT_SETTING_ALLOW);
+ CONTENT_SETTING_BLOCK);
histogram_tester().ExpectTotalCount(kActionsHistogram, 0);
}
TEST_F(SubresourceFilterContentSettingsManagerTest, DefaultSetting) {
GetSettingsMap()->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_ALLOW);
+ CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_BLOCK);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsAllowedGlobal, 1);
+ kActionContentSettingsBlockedGlobal, 1);
GetSettingsMap()->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_BLOCK);
+ CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_ALLOW);
histogram_tester().ExpectTotalCount(kActionsHistogram, 2);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlockedGlobal, 1);
+ kActionContentSettingsAllowedGlobal, 1);
}
TEST_F(SubresourceFilterContentSettingsManagerTest, UrlSetting) {
@@ -126,16 +126,16 @@ TEST_F(SubresourceFilterContentSettingsManagerTest, UrlSetting) {
GetSettingsMap()->SetContentSettingDefaultScope(
url, url, CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, std::string(),
- CONTENT_SETTING_BLOCK);
+ CONTENT_SETTING_ALLOW);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlocked, 1);
+ kActionContentSettingsAllowed, 1);
GetSettingsMap()->SetContentSettingDefaultScope(
url, url, CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, std::string(),
- CONTENT_SETTING_ALLOW);
+ CONTENT_SETTING_BLOCK);
histogram_tester().ExpectTotalCount(kActionsHistogram, 2);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsAllowed, 1);
+ kActionContentSettingsBlocked, 1);
}
TEST_F(SubresourceFilterContentSettingsManagerTest, WildcardUpdate) {
@@ -146,14 +146,14 @@ TEST_F(SubresourceFilterContentSettingsManagerTest, WildcardUpdate) {
GetSettingsMap()->SetContentSettingCustomScope(
primary_pattern, secondary_pattern,
CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, std::string(),
- CONTENT_SETTING_BLOCK);
+ CONTENT_SETTING_ALLOW);
histogram_tester().ExpectBucketCount(kActionsHistogram,
kActionContentSettingsWildcardUpdate, 1);
GetSettingsMap()->SetContentSettingCustomScope(
primary_pattern, secondary_pattern,
CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, std::string(),
- CONTENT_SETTING_ALLOW);
+ CONTENT_SETTING_BLOCK);
histogram_tester().ExpectTotalCount(kActionsHistogram, 2);
histogram_tester().ExpectBucketCount(kActionsHistogram,
kActionContentSettingsWildcardUpdate, 2);
@@ -179,7 +179,7 @@ TEST_F(SubresourceFilterContentSettingsManagerTest, SmartUI) {
// Showing the UI should trigger a forced content setting update, but no
// metrics should be recorded.
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsAllowed, 0);
+ kActionContentSettingsBlocked, 0);
// Fast forward the clock.
test_clock()->Advance(
@@ -205,17 +205,17 @@ TEST_F(SubresourceFilterContentSettingsManagerTest,
// The user changed their mind, make sure the feature is showing up in the
// settings UI. i.e. the setting should be non-default.
- EXPECT_EQ(CONTENT_SETTING_ALLOW, settings_manager()->GetSitePermission(url));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK, settings_manager()->GetSitePermission(url));
GetSettingsMap()->SetContentSettingDefaultScope(
url, GURL(), CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, std::string(),
- CONTENT_SETTING_BLOCK);
+ CONTENT_SETTING_ALLOW);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlocked, 1);
+ kActionContentSettingsAllowed, 1);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlockedFromUI, 0);
+ kActionContentSettingsAllowedFromUI, 0);
histogram_tester().ExpectBucketCount(
- kActionsHistogram, kActionContentSettingsBlockedWhileUISuppressed, 1);
+ kActionsHistogram, kActionContentSettingsAllowedWhileUISuppressed, 1);
// Smart UI should be reset.
EXPECT_TRUE(settings_manager()->ShouldShowUIForSite(url));
@@ -232,23 +232,23 @@ TEST_F(SubresourceFilterContentSettingsManagerTest,
// Simulate changing the setting via the infobar UI.
settings_manager()->WhitelistSite(url);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlockedFromUI, 1);
+ kActionContentSettingsAllowedFromUI, 1);
// The standard "Block" histograms are only triggered when blocking from the
// settings UI, not our standard UI.
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlocked, 0);
+ kActionContentSettingsAllowed, 0);
histogram_tester().ExpectBucketCount(
- kActionsHistogram, kActionContentSettingsBlockedWhileUISuppressed, 0);
+ kActionsHistogram, kActionContentSettingsAllowedWhileUISuppressed, 0);
GURL url2("https://example.test2/");
GetSettingsMap()->SetContentSettingDefaultScope(
url2, GURL(), CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, std::string(),
- CONTENT_SETTING_BLOCK);
+ CONTENT_SETTING_ALLOW);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlocked, 1);
+ kActionContentSettingsAllowed, 1);
histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsBlockedFromUI, 1);
+ kActionContentSettingsAllowedFromUI, 1);
}
TEST_F(SubresourceFilterContentSettingsManagerHistoryTest,

Powered by Google App Engine
This is Rietveld 408576698