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

Unified Diff: chrome/browser/extensions/permissions_updater_unittest.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/permissions_updater.cc ('k') | chrome/browser/extensions/requirements_checker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/permissions_updater_unittest.cc
diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc
index 14a52e828b502c795573ae009fc85f4dafa05720..b13888695f9071ab9c2f7f61f57e78956881db69 100644
--- a/chrome/browser/extensions/permissions_updater_unittest.cc
+++ b/chrome/browser/extensions/permissions_updater_unittest.cc
@@ -55,11 +55,9 @@ class PermissionsUpdaterListener : public content::NotificationObserver {
}
bool received_notification() const { return received_notification_; }
- const Extension* extension() const { return extension_; }
- const PermissionSet* permissions() const { return permissions_; }
- UpdatedExtensionPermissionsInfo::Reason reason() const {
- return reason_;
- }
+ const Extension* extension() const { return extension_.get(); }
+ const PermissionSet* permissions() const { return permissions_.get(); }
+ UpdatedExtensionPermissionsInfo::Reason reason() const { return reason_; }
private:
virtual void Observe(int type,
@@ -129,7 +127,7 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
// Make sure it loaded properly.
scoped_refptr<const PermissionSet> permissions =
extension->GetActivePermissions();
- ASSERT_EQ(*default_permissions, *extension->GetActivePermissions());
+ ASSERT_EQ(*default_permissions.get(), *extension->GetActivePermissions());
// Add a few permissions.
APIPermissionSet apis;
@@ -151,12 +149,12 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
ASSERT_TRUE(listener.received_notification());
ASSERT_EQ(extension, listener.extension());
ASSERT_EQ(UpdatedExtensionPermissionsInfo::ADDED, listener.reason());
- ASSERT_EQ(*delta, *listener.permissions());
+ ASSERT_EQ(*delta.get(), *listener.permissions());
// Make sure the extension's active permissions reflect the change.
scoped_refptr<PermissionSet> active_permissions =
- PermissionSet::CreateUnion(default_permissions, delta);
- ASSERT_EQ(*active_permissions, *extension->GetActivePermissions());
+ PermissionSet::CreateUnion(default_permissions.get(), delta.get());
+ ASSERT_EQ(*active_permissions.get(), *extension->GetActivePermissions());
// Verify that the new granted and active permissions were also stored
// in the extension preferences. In this case, the granted permissions should
@@ -167,10 +165,10 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
scoped_refptr<PermissionSet> from_prefs =
prefs->GetActivePermissions(extension->id());
- ASSERT_EQ(*active_permissions, *from_prefs);
+ ASSERT_EQ(*active_permissions.get(), *from_prefs.get());
from_prefs = prefs->GetGrantedPermissions(extension->id());
- ASSERT_EQ(*active_permissions, *from_prefs);
+ ASSERT_EQ(*active_permissions.get(), *from_prefs.get());
// In the second part of the test, we'll remove the permissions that we
// just added except for 'notification'.
@@ -178,27 +176,27 @@ TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) {
delta = new PermissionSet(apis, hosts, URLPatternSet());
listener.Reset();
- updater.RemovePermissions(extension, delta);
+ updater.RemovePermissions(extension.get(), delta.get());
listener.Wait();
// Verify that the notification was correct.
ASSERT_TRUE(listener.received_notification());
ASSERT_EQ(extension, listener.extension());
ASSERT_EQ(UpdatedExtensionPermissionsInfo::REMOVED, listener.reason());
- ASSERT_EQ(*delta, *listener.permissions());
+ ASSERT_EQ(*delta.get(), *listener.permissions());
// Make sure the extension's active permissions reflect the change.
active_permissions =
- PermissionSet::CreateDifference(active_permissions, delta);
- ASSERT_EQ(*active_permissions, *extension->GetActivePermissions());
+ PermissionSet::CreateDifference(active_permissions.get(), delta.get());
+ ASSERT_EQ(*active_permissions.get(), *extension->GetActivePermissions());
// Verify that the extension prefs hold the new active permissions and the
// same granted permissions.
from_prefs = prefs->GetActivePermissions(extension->id());
- ASSERT_EQ(*active_permissions, *from_prefs);
+ ASSERT_EQ(*active_permissions.get(), *from_prefs.get());
from_prefs = prefs->GetGrantedPermissions(extension->id());
- ASSERT_EQ(*granted_permissions, *from_prefs);
+ ASSERT_EQ(*granted_permissions.get(), *from_prefs.get());
}
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/permissions_updater.cc ('k') | chrome/browser/extensions/requirements_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698