| Index: chrome/common/extensions/extension_manifests_unittest.cc
|
| diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
|
| index 0008ef7189b40d24f448a166c01732f21bce6378..046c60edfaf7e5a63254d873b108e08f2eb144d0 100644
|
| --- a/chrome/common/extensions/extension_manifests_unittest.cc
|
| +++ b/chrome/common/extensions/extension_manifests_unittest.cc
|
| @@ -640,18 +640,44 @@ TEST_F(ExtensionManifestTest, HostedAppPermissions) {
|
| StringValue* p = new StringValue(name);
|
| permissions->Clear();
|
| permissions->Append(p);
|
| - Extension::Location location = Extension::INTERNAL;
|
|
|
| - // Many permissions are not available to hosted apps.
|
| - if (!permission->is_hosted_app() || permission->is_component_only()) {
|
| + // Some permissions are only available to component hosted apps.
|
| + if (permission->is_component_only()) {
|
| LoadAndExpectError(Manifest(manifest.get(), name),
|
| - errors::kPermissionNotAllowed);
|
| -
|
| - // ... unless the hosted app is a component app.
|
| - location = Extension::COMPONENT;
|
| + errors::kPermissionNotAllowed,
|
| + Extension::INTERNAL);
|
| + scoped_refptr<Extension> extension(
|
| + LoadAndExpectSuccess(Manifest(manifest.get(), name),
|
| + Extension::COMPONENT));
|
| + EXPECT_TRUE(extension->GetActivePermissions()->HasAPIPermission(
|
| + permission->id()));
|
| +
|
| + } else if (!permission->is_hosted_app()) {
|
| + // Most normal extension permissions also aren't available to hosted apps.
|
| + // For these, the error is only reported in strict mode for legacy
|
| + // reasons: crbug.com/101993.
|
| + LoadAndExpectError(Manifest(manifest.get(), name),
|
| + errors::kPermissionNotAllowed,
|
| + Extension::INTERNAL,
|
| + Extension::STRICT_ERROR_CHECKS);
|
| + scoped_refptr<Extension> extension(
|
| + LoadAndExpectSuccess(Manifest(manifest.get(), name),
|
| + Extension::INTERNAL));
|
| + EXPECT_FALSE(extension->GetActivePermissions()->HasAPIPermission(
|
| + permission->id()));
|
| +
|
| + // These permissions are also allowed for component hosted apps.
|
| + extension = LoadAndExpectSuccess(Manifest(manifest.get(), name),
|
| + Extension::COMPONENT);
|
| + EXPECT_TRUE(extension->GetActivePermissions()->HasAPIPermission(
|
| + permission->id()));
|
| +
|
| + } else {
|
| + scoped_refptr<Extension> extension(
|
| + LoadAndExpectSuccess(Manifest(manifest.get(), name)));
|
| + EXPECT_TRUE(extension->GetActivePermissions()->HasAPIPermission(
|
| + permission->id()));
|
| }
|
| -
|
| - LoadAndExpectSuccess(Manifest(manifest.get(), name), location);
|
| }
|
| }
|
|
|
|
|