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

Unified Diff: chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc

Issue 2071293002: Reinstate evil hack to suppress permission warnings for searchProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comments Created 4 years, 6 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/common/extensions/permissions/chrome_permission_message_provider_unittest.cc
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc b/chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc
index 606218ab78b00c51e1daa905c27ef9b30687925c..c6d69aef740328db2bdd4f9cb114c4b35c4299c9 100644
--- a/chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc
+++ b/chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc
@@ -129,4 +129,30 @@ TEST_F(ChromePermissionMessageProviderUnittest,
EXPECT_FALSE(message1.submessages().empty());
}
+// Anti-test: Check that adding a parameter to a SettingsOverridePermission
+// doesn't trigger a privilege increase. This is because prior to M46 beta, we
+// failed to store the parameter in the granted_permissions pref. Now we do, and
+// we don't want to bother every user with a spurious permissions warning.
+// See crbug.com/533086 and crbug.com/619759.
+// TODO(treib,devlin): Remove this for M56, when hopefully all users will have
+// updated prefs.
+TEST_F(ChromePermissionMessageProviderUnittest,
+ EvilHackToSuppressSettingsOverrideParameter) {
+ const APIPermissionInfo* info =
+ PermissionsInfo::GetInstance()->GetByID(APIPermission::kSearchProvider);
+
+ APIPermissionSet granted_permissions;
+ granted_permissions.insert(new SettingsOverrideAPIPermission(info));
+
+ APIPermissionSet actual_permissions;
+ actual_permissions.insert(new SettingsOverrideAPIPermission(info, "a.com"));
+
+ EXPECT_FALSE(IsPrivilegeIncrease(granted_permissions, actual_permissions));
+
+ // Just to be safe: Adding the permission (with or without parameter) should
+ // still be considered a privilege escalation.
+ EXPECT_TRUE(IsPrivilegeIncrease(APIPermissionSet(), granted_permissions));
+ EXPECT_TRUE(IsPrivilegeIncrease(APIPermissionSet(), actual_permissions));
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698