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

Side by Side Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 8598022: Restrict access to permissions based on extension types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 if (permission->is_component_only()) { 646 if (permission->is_component_only()) {
647 LoadAndExpectError(Manifest(manifest.get(), name), 647 LoadAndExpectError(Manifest(manifest.get(), name),
648 errors::kPermissionNotAllowed, 648 errors::kPermissionNotAllowed,
649 Extension::INTERNAL); 649 Extension::INTERNAL);
650 scoped_refptr<Extension> extension( 650 scoped_refptr<Extension> extension(
651 LoadAndExpectSuccess(Manifest(manifest.get(), name), 651 LoadAndExpectSuccess(Manifest(manifest.get(), name),
652 Extension::COMPONENT)); 652 Extension::COMPONENT));
653 EXPECT_TRUE(extension->GetActivePermissions()->HasAPIPermission( 653 EXPECT_TRUE(extension->GetActivePermissions()->HasAPIPermission(
654 permission->id())); 654 permission->id()));
655 655
656 } else if (!permission->is_hosted_app()) { 656 } else if (!permission->supports_hosted_apps()) {
Aaron Boodman 2011/11/22 09:40:32 I like the 'supports' nomenclature better - nice c
jstritar 2011/11/22 15:58:29 Nice, thx.
657 // Most normal extension permissions also aren't available to hosted apps. 657 // Most normal extension permissions also aren't available to hosted apps.
658 // For these, the error is only reported in strict mode for legacy 658 // For these, the error is only reported in strict mode for legacy
659 // reasons: crbug.com/101993. 659 // reasons: crbug.com/101993.
660 LoadAndExpectError(Manifest(manifest.get(), name), 660 LoadAndExpectError(Manifest(manifest.get(), name),
661 errors::kPermissionNotAllowed, 661 errors::kPermissionNotAllowed,
662 Extension::INTERNAL, 662 Extension::INTERNAL,
663 Extension::STRICT_ERROR_CHECKS); 663 Extension::STRICT_ERROR_CHECKS);
664 scoped_refptr<Extension> extension( 664 scoped_refptr<Extension> extension(
665 LoadAndExpectSuccess(Manifest(manifest.get(), name), 665 LoadAndExpectSuccess(Manifest(manifest.get(), name),
666 Extension::INTERNAL)); 666 Extension::INTERNAL));
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 scoped_refptr<Extension> extension_2( 954 scoped_refptr<Extension> extension_2(
955 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); 955 LoadAndExpectSuccess("offline_disabled_packaged_app.json"));
956 EXPECT_FALSE(extension_2->offline_enabled()); 956 EXPECT_FALSE(extension_2->offline_enabled());
957 scoped_refptr<Extension> extension_3( 957 scoped_refptr<Extension> extension_3(
958 LoadAndExpectSuccess("offline_default_packaged_app.json")); 958 LoadAndExpectSuccess("offline_default_packaged_app.json"));
959 EXPECT_FALSE(extension_3->offline_enabled()); 959 EXPECT_FALSE(extension_3->offline_enabled());
960 scoped_refptr<Extension> extension_4( 960 scoped_refptr<Extension> extension_4(
961 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); 961 LoadAndExpectSuccess("offline_enabled_hosted_app.json"));
962 EXPECT_TRUE(extension_4->offline_enabled()); 962 EXPECT_TRUE(extension_4->offline_enabled());
963 } 963 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698