summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/permissions_updater_unittest.cc
diff options
context:
space:
mode:
authorpenghuang@chromium.org <penghuang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 06:27:06 +0000
committerpenghuang@chromium.org <penghuang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 06:27:06 +0000
commitc2e66e129d73bd28f2911731591c1e0ac74cd95b (patch)
tree040be611b5c97d75eaa8fbb8cd80031727d5c706 /chrome/browser/extensions/permissions_updater_unittest.cc
parent1e03cdff9cdb66731a7543cf357a6f5af264685f (diff)
downloadchromium_src-c2e66e129d73bd28f2911731591c1e0ac74cd95b.zip
chromium_src-c2e66e129d73bd28f2911731591c1e0ac74cd95b.tar.gz
chromium_src-c2e66e129d73bd28f2911731591c1e0ac74cd95b.tar.bz2
Move each permission classes to its own files in extensions/permissions and rename classes from ExtensionPermission* to extensions::Permission*
This CL replaces CL 10649003 TBR=estade BUG=133049 TEST=unit_tests & browser_tests Review URL: https://chromiumcodereview.appspot.com/10675007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/permissions_updater_unittest.cc')
-rw-r--r--chrome/browser/extensions/permissions_updater_unittest.cc40
1 files changed, 20 insertions, 20 deletions
diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc
index 36226f8..4910dc3 100644
--- a/chrome/browser/extensions/permissions_updater_unittest.cc
+++ b/chrome/browser/extensions/permissions_updater_unittest.cc
@@ -13,7 +13,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_permission_set.h"
+#include "chrome/common/extensions/permissions/permission_set.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_observer.h"
@@ -52,7 +52,7 @@ class PermissionsUpdaterListener : public content::NotificationObserver {
bool received_notification() const { return received_notification_; }
const Extension* extension() const { return extension_; }
- const ExtensionPermissionSet* permissions() const { return permissions_; }
+ const PermissionSet* permissions() const { return permissions_; }
UpdatedExtensionPermissionsInfo::Reason reason() const {
return reason_;
}
@@ -79,7 +79,7 @@ class PermissionsUpdaterListener : public content::NotificationObserver {
bool waiting_;
content::NotificationRegistrar registrar_;
scoped_refptr<const Extension> extension_;
- scoped_refptr<const ExtensionPermissionSet> permissions_;
+ scoped_refptr<const PermissionSet> permissions_;
UpdatedExtensionPermissionsInfo::Reason reason_;
};
@@ -125,27 +125,27 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
scoped_refptr<Extension> extension = LoadManifest(&error);
ASSERT_TRUE(error.empty()) << error;
- ExtensionAPIPermissionSet default_apis;
- default_apis.insert(ExtensionAPIPermission::kManagement);
+ APIPermissionSet default_apis;
+ default_apis.insert(APIPermission::kManagement);
URLPatternSet default_hosts;
AddPattern(&default_hosts, "http://a.com/*");
- scoped_refptr<ExtensionPermissionSet> default_permissions =
- new ExtensionPermissionSet(default_apis, default_hosts, URLPatternSet());
+ scoped_refptr<PermissionSet> default_permissions =
+ new PermissionSet(default_apis, default_hosts, URLPatternSet());
// Make sure it loaded properly.
- scoped_refptr<const ExtensionPermissionSet> permissions =
+ scoped_refptr<const PermissionSet> permissions =
extension->GetActivePermissions();
ASSERT_EQ(*default_permissions, *extension->GetActivePermissions());
// Add a few permissions.
- ExtensionAPIPermissionSet apis;
- apis.insert(ExtensionAPIPermission::kTab);
- apis.insert(ExtensionAPIPermission::kNotification);
+ APIPermissionSet apis;
+ apis.insert(APIPermission::kTab);
+ apis.insert(APIPermission::kNotification);
URLPatternSet hosts;
AddPattern(&hosts, "http://*.c.com/*");
- scoped_refptr<ExtensionPermissionSet> delta =
- new ExtensionPermissionSet(apis, hosts, URLPatternSet());
+ scoped_refptr<PermissionSet> delta =
+ new PermissionSet(apis, hosts, URLPatternSet());
PermissionsUpdaterListener listener;
PermissionsUpdater updater(profile_.get());
@@ -160,18 +160,18 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
ASSERT_EQ(*delta, *listener.permissions());
// Make sure the extension's active permissions reflect the change.
- scoped_refptr<ExtensionPermissionSet> active_permissions =
- ExtensionPermissionSet::CreateUnion(default_permissions, delta);
+ scoped_refptr<PermissionSet> active_permissions =
+ PermissionSet::CreateUnion(default_permissions, delta);
ASSERT_EQ(*active_permissions, *extension->GetActivePermissions());
// Verify that the new granted and active permissions were also stored
// in the extension preferences. In this case, the granted permissions should
// be equal to the active permissions.
ExtensionPrefs* prefs = service_->extension_prefs();
- scoped_refptr<ExtensionPermissionSet> granted_permissions =
+ scoped_refptr<PermissionSet> granted_permissions =
active_permissions;
- scoped_refptr<ExtensionPermissionSet> from_prefs =
+ scoped_refptr<PermissionSet> from_prefs =
prefs->GetActivePermissions(extension->id());
ASSERT_EQ(*active_permissions, *from_prefs);
@@ -180,8 +180,8 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
// In the second part of the test, we'll remove the permissions that we
// just added except for 'notification'.
- apis.erase(ExtensionAPIPermission::kNotification);
- delta = new ExtensionPermissionSet(apis, hosts, URLPatternSet());
+ apis.erase(APIPermission::kNotification);
+ delta = new PermissionSet(apis, hosts, URLPatternSet());
listener.Reset();
updater.RemovePermissions(extension, delta);
@@ -195,7 +195,7 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
// Make sure the extension's active permissions reflect the change.
active_permissions =
- ExtensionPermissionSet::CreateDifference(active_permissions, delta);
+ PermissionSet::CreateDifference(active_permissions, delta);
ASSERT_EQ(*active_permissions, *extension->GetActivePermissions());
// Verify that the extension prefs hold the new active permissions and the