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

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

Issue 2086523002: Reinstate evil hack to suppress permission warnings for searchProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: 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 e45a1f0121db86f138a2e7f3664c501695e5db35..6387ae9d3d6aaef7e4bbba866197794d764d4166 100644
--- a/chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc
+++ b/chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc
@@ -131,4 +131,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