| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" | 5 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ), | 122 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ), |
| 123 message0.message()); | 123 message0.message()); |
| 124 EXPECT_TRUE(message0.submessages().empty()); | 124 EXPECT_TRUE(message0.submessages().empty()); |
| 125 const PermissionMessage& message1 = *it++; | 125 const PermissionMessage& message1 = *it++; |
| 126 EXPECT_EQ( | 126 EXPECT_EQ( |
| 127 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_USB_DEVICE_LIST), | 127 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_USB_DEVICE_LIST), |
| 128 message1.message()); | 128 message1.message()); |
| 129 EXPECT_FALSE(message1.submessages().empty()); | 129 EXPECT_FALSE(message1.submessages().empty()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Anti-test: Check that adding a parameter to a SettingsOverridePermission |
| 133 // doesn't trigger a privilege increase. This is because prior to M46 beta, we |
| 134 // failed to store the parameter in the granted_permissions pref. Now we do, and |
| 135 // we don't want to bother every user with a spurious permissions warning. |
| 136 // See crbug.com/533086 and crbug.com/619759. |
| 137 // TODO(treib,devlin): Remove this for M56, when hopefully all users will have |
| 138 // updated prefs. |
| 139 TEST_F(ChromePermissionMessageProviderUnittest, |
| 140 EvilHackToSuppressSettingsOverrideParameter) { |
| 141 const APIPermissionInfo* info = |
| 142 PermissionsInfo::GetInstance()->GetByID(APIPermission::kSearchProvider); |
| 143 |
| 144 APIPermissionSet granted_permissions; |
| 145 granted_permissions.insert(new SettingsOverrideAPIPermission(info)); |
| 146 |
| 147 APIPermissionSet actual_permissions; |
| 148 actual_permissions.insert(new SettingsOverrideAPIPermission(info, "a.com")); |
| 149 |
| 150 EXPECT_FALSE(IsPrivilegeIncrease(granted_permissions, actual_permissions)); |
| 151 |
| 152 // Just to be safe: Adding the permission (with or without parameter) should |
| 153 // still be considered a privilege escalation. |
| 154 EXPECT_TRUE(IsPrivilegeIncrease(APIPermissionSet(), granted_permissions)); |
| 155 EXPECT_TRUE(IsPrivilegeIncrease(APIPermissionSet(), actual_permissions)); |
| 156 } |
| 157 |
| 132 } // namespace extensions | 158 } // namespace extensions |
| OLD | NEW |