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

Unified Diff: components/subresource_filter/core/browser/subresource_filter_features_unittest.cc

Issue 2664283003: Add field trial param to suppress disallowed subresource notifications. (Closed)
Patch Set: fix compilation error Created 3 years, 11 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 | « components/subresource_filter/core/browser/subresource_filter_features_test_support.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
diff --git a/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc b/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
index 33d672dd905c6f92178198d6455b6900eefaeaba..55fb1981fd8e4c302827578f16c7527fc581c014 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
+++ b/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
@@ -219,4 +219,37 @@ TEST(SubresourceFilterFeaturesTest, PerfMeasurementRate) {
}
}
+TEST(SubresourceFilterFeaturesTest, SuppressNotifications) {
+ const struct {
+ bool feature_enabled;
+ const char* suppress_notifications_param;
+ bool expected_suppress_notifications_value;
+ } kTestCases[] = {{false, "", false},
+ {false, "true", false},
+ {false, "false", false},
+ {false, "invalid value", false},
+ {true, "", false},
+ {true, "false", false},
+ {true, "invalid value", false},
+ {true, "True", false},
+ {true, "TRUE", false},
+ {true, "true", true}};
+
+ for (const auto& test_case : kTestCases) {
+ SCOPED_TRACE(::testing::Message("Enabled = ") << test_case.feature_enabled);
+ SCOPED_TRACE(::testing::Message("SuppressNotificationsParam = \"")
+ << test_case.suppress_notifications_param << "\"");
+
+ base::FieldTrialList field_trial_list(nullptr /* entropy_provider */);
+ testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
+ test_case.feature_enabled ? base::FeatureList::OVERRIDE_ENABLE_FEATURE
+ : base::FeatureList::OVERRIDE_USE_DEFAULT,
+ {{kSuppressNotificationsParameterName,
+ test_case.suppress_notifications_param}});
+
+ EXPECT_EQ(test_case.expected_suppress_notifications_value,
+ ShouldSuppressNotifications());
+ }
+}
+
} // namespace subresource_filter
« no previous file with comments | « components/subresource_filter/core/browser/subresource_filter_features_test_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698