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

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

Issue 2873123004: [subresource_filter] Duplicate settings notifications should not be logged (Closed)
Patch Set: shivanisha review 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
« no previous file with comments | « chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4fd37f176d0edbadc53ccd2c7de04ded8bd15b3a 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
@@ -109,16 +109,21 @@ TEST_F(SubresourceFilterContentSettingsManagerTest, IrrelevantSetting) {
}
TEST_F(SubresourceFilterContentSettingsManagerTest, DefaultSetting) {
+ // Setting to an existing value should not log any metrics.
GetSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_ALLOW);
- histogram_tester().ExpectBucketCount(kActionsHistogram,
- kActionContentSettingsAllowedGlobal, 1);
+ histogram_tester().ExpectTotalCount(kActionsHistogram, 0);
GetSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_BLOCK);
- histogram_tester().ExpectTotalCount(kActionsHistogram, 2);
histogram_tester().ExpectBucketCount(kActionsHistogram,
kActionContentSettingsBlockedGlobal, 1);
+
+ GetSettingsMap()->SetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_ALLOW);
+ histogram_tester().ExpectTotalCount(kActionsHistogram, 2);
+ histogram_tester().ExpectBucketCount(kActionsHistogram,
+ kActionContentSettingsAllowedGlobal, 1);
}
TEST_F(SubresourceFilterContentSettingsManagerTest, UrlSetting) {
@@ -251,6 +256,21 @@ TEST_F(SubresourceFilterContentSettingsManagerTest,
kActionContentSettingsBlockedFromUI, 1);
}
+TEST_F(SubresourceFilterContentSettingsManagerTest,
+ IgnoreDuplicateGlobalSettings) {
+ histogram_tester().ExpectTotalCount(kActionsHistogram, 0);
+
+ GetSettingsMap()->SetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_BLOCK);
+ histogram_tester().ExpectBucketCount(kActionsHistogram,
+ kActionContentSettingsBlockedGlobal, 1);
+
+ GetSettingsMap()->SetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, CONTENT_SETTING_BLOCK);
+ histogram_tester().ExpectBucketCount(kActionsHistogram,
+ kActionContentSettingsBlockedGlobal, 1);
+}
+
TEST_F(SubresourceFilterContentSettingsManagerHistoryTest,
HistoryUrlDeleted_ClearsWebsiteSetting) {
if (!settings_manager()->should_use_smart_ui())
« no previous file with comments | « chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698