summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_manifests_unittest.cc
diff options
context:
space:
mode:
authorjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-29 17:22:49 +0000
committerjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-29 17:22:49 +0000
commit3d0e75058b54ad624c0a410bd31bc39085fe15fa (patch)
tree3d2e7eeee7df820bf0d1cae60ef39595694a81d4 /chrome/common/extensions/extension_manifests_unittest.cc
parent177e1e5687ff03ce1b36caa139c6e5a79bfe02d3 (diff)
downloadchromium_src-3d0e75058b54ad624c0a410bd31bc39085fe15fa.zip
chromium_src-3d0e75058b54ad624c0a410bd31bc39085fe15fa.tar.gz
chromium_src-3d0e75058b54ad624c0a410bd31bc39085fe15fa.tar.bz2
Track permissions granted to extensions in prefs
Adds a section to the extension preferences to store the recognized permissions that the user has granted the extension. Ignores unknown permissions when installing extensions. Disables extension and prompts user to re-enable when unknown permissions become recognized (e.g., through browser upgrade). Allows extensions to remove a permission in one version, then add them back in the next without prompting the user. BUG=42742 TEST=ExtensionsServiceTest, ExtensionPrefsGrantedPermissions, ExtensionTest Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=67500 Review URL: http://codereview.chromium.org/4687005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_manifests_unittest.cc')
-rw-r--r--chrome/common/extensions/extension_manifests_unittest.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 3a89166..446ff31 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -294,7 +294,7 @@ TEST_F(ExtensionManifestTest, OptionsPageInApps) {
errors::kInvalidOptionsPageExpectUrlInPackage);
}
-TEST_F(ExtensionManifestTest, DisallowExtensionPermissions) {
+TEST_F(ExtensionManifestTest, AllowUnrecognizedPermissions) {
std::string error;
scoped_ptr<DictionaryValue> manifest(
LoadManifestFile("valid_app.json", &error));
@@ -308,13 +308,11 @@ TEST_F(ExtensionManifestTest, DisallowExtensionPermissions) {
permissions->Clear();
permissions->Append(p);
std::string message_name = base::StringPrintf("permission-%s", name);
- if (Extension::IsHostedAppPermission(name)) {
- scoped_refptr<Extension> extension;
- extension = LoadAndExpectSuccess(manifest.get(), message_name);
- } else {
- LoadAndExpectError(manifest.get(), message_name,
- errors::kInvalidPermission);
- }
+
+ // Extensions are allowed to contain unrecognized API permissions,
+ // so there shouldn't be any errors.
+ scoped_refptr<Extension> extension;
+ extension = LoadAndExpectSuccess(manifest.get(), message_name);
}
}