Commit d16ea169 authored by Owen Min's avatar Owen Min Committed by Commit Bot

Extension status returns blocked-by-policy when there is no manifest

When manifest type allowlist policy is set, GetExtensionInstallStatus()
function always returns blocked-by-policy when there is no manifest type
information. However, it should actually skip the manifest type check.

Add a test to verify the fix. Also add a test to verify we can handle
similar situation for permission set.

Bug: 1124669
Change-Id: I9727222688177a7beb386e5dc473ef21e766ce8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392442Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806407}
parent 78a58974
...@@ -51,7 +51,8 @@ bool IsExtensionInstallBlockedByPolicy( ...@@ -51,7 +51,8 @@ bool IsExtensionInstallBlockedByPolicy(
// and manifest type. // and manifest type.
// TODO(crbug.com/1088021): Find out the right way to handle extension policy // TODO(crbug.com/1088021): Find out the right way to handle extension policy
// priority. // priority.
if (!extension_management->IsAllowedManifestType(manifest_type, if (manifest_type != Manifest::Type::TYPE_UNKNOWN &&
!extension_management->IsAllowedManifestType(manifest_type,
extension_id)) { extension_id)) {
return true; return true;
} }
......
...@@ -325,6 +325,27 @@ TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByManifestType) { ...@@ -325,6 +325,27 @@ TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByManifestType) {
PermissionSet())); PermissionSet()));
} }
TEST_F(ExtensionInstallStatusTest, ExtensionWithoutPermissionInfo) {
SetExtensionSettings(R"({
"*": {
"blocked_permissions": ["storage"]
}
})");
EXPECT_EQ(ExtensionInstallStatus::kInstallable,
GetWebstoreExtensionInstallStatus(kExtensionId, profile()));
}
TEST_F(ExtensionInstallStatusTest, ExtensionWithoutManifestInfo) {
SetExtensionSettings(R"({
"*": {
"allowed_types": ["theme"]
}
})");
EXPECT_EQ(ExtensionInstallStatus::kInstallable,
GetWebstoreExtensionInstallStatus(kExtensionId, profile()));
}
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByPermissions) { TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByPermissions) {
// Block 'storage' for all extensions. // Block 'storage' for all extensions.
SetExtensionSettings(R"({ SetExtensionSettings(R"({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment