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

Unified Diff: chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc

Issue 2772513004: Disable permissions embargo for plugins. (Closed)
Patch Set: Add todo Created 3 years, 9 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/permissions/permission_decision_auto_blocker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
diff --git a/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc b/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
index e62eebb311866c64f25fb678d187034dc6c8854e..849d0b2086349d9d9681f0922895506a4e258408 100644
--- a/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
+++ b/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
@@ -310,6 +310,41 @@ TEST_F(PermissionDecisionAutoBlockerUnitTest, TestRequestNotBlacklisted) {
"Permissions.AutoBlocker.SafeBrowsingResponseTime", 1);
}
+// Check that we do not apply embargo to the plugins content type, as prompts
+// should be triggered only when necessary by Html5ByDefault.
+TEST_F(PermissionDecisionAutoBlockerUnitTest,
+ PluginsNotEmbargoedByMultipleDismisses) {
+ GURL url("https://www.google.com");
+ autoblocker()->RecordDismissAndEmbargo(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+ autoblocker()->RecordDismissAndEmbargo(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+ PermissionResult result =
+ autoblocker()->GetEmbargoResult(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+
+ EXPECT_EQ(CONTENT_SETTING_ASK, result.content_setting);
+ EXPECT_EQ(PermissionStatusSource::UNSPECIFIED, result.source);
+ EXPECT_EQ(2,
+ autoblocker()->GetDismissCount(url, CONTENT_SETTINGS_TYPE_PLUGINS));
+
+ // The third dismiss would normally embargo, but this shouldn't happen for
+ // plugins.
+ autoblocker()->RecordDismissAndEmbargo(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+ result = autoblocker()->GetEmbargoResult(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+
+ EXPECT_EQ(CONTENT_SETTING_ASK, result.content_setting);
+ EXPECT_EQ(PermissionStatusSource::UNSPECIFIED, result.source);
+ EXPECT_EQ(3,
+ autoblocker()->GetDismissCount(url, CONTENT_SETTINGS_TYPE_PLUGINS));
+
+ // Extra one for sanity checking.
+ autoblocker()->RecordDismissAndEmbargo(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+ result = autoblocker()->GetEmbargoResult(url, CONTENT_SETTINGS_TYPE_PLUGINS);
+
+ EXPECT_EQ(CONTENT_SETTING_ASK, result.content_setting);
+ EXPECT_EQ(PermissionStatusSource::UNSPECIFIED, result.source);
+ EXPECT_EQ(4,
+ autoblocker()->GetDismissCount(url, CONTENT_SETTINGS_TYPE_PLUGINS));
+}
+
// Check that GetEmbargoResult returns the correct value when the embargo is set
// and expires.
TEST_F(PermissionDecisionAutoBlockerUnitTest, CheckEmbargoStatus) {
« no previous file with comments | « chrome/browser/permissions/permission_decision_auto_blocker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698