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

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

Issue 510313002: Extensions-related fixups for scoped_refptr conversion operator removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/extension_service.cc ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_toolbar_model_unittest.cc
diff --git a/chrome/browser/extensions/extension_toolbar_model_unittest.cc b/chrome/browser/extensions/extension_toolbar_model_unittest.cc
index 88ed6e7a3a48888e40007c6c3e79492d9046ad51..e2631c2bb93d953c1d9753e0bdf9238c6f7c72f7 100644
--- a/chrome/browser/extensions/extension_toolbar_model_unittest.cc
+++ b/chrome/browser/extensions/extension_toolbar_model_unittest.cc
@@ -119,9 +119,9 @@ class ExtensionToolbarModelUnitTest : public ExtensionServiceTestBase {
// Adds or removes the given |extension| and verify success.
testing::AssertionResult AddExtension(
- scoped_refptr<const Extension> extension) WARN_UNUSED_RESULT;
+ const scoped_refptr<const Extension>& extension) WARN_UNUSED_RESULT;
testing::AssertionResult RemoveExtension(
- scoped_refptr<const Extension> extension) WARN_UNUSED_RESULT;
+ const scoped_refptr<const Extension>& extension) WARN_UNUSED_RESULT;
// Adds three extensions, all with browser actions.
testing::AssertionResult AddBrowserActionExtensions() WARN_UNUSED_RESULT;
@@ -142,15 +142,9 @@ class ExtensionToolbarModelUnitTest : public ExtensionServiceTestBase {
size_t num_toolbar_items() const {
return toolbar_model_->toolbar_items().size();
}
- const Extension* browser_action_a() const {
- return browser_action_a_;
- }
- const Extension* browser_action_b() const {
- return browser_action_b_;
- }
- const Extension* browser_action_c() const {
- return browser_action_c_;
- }
+ const Extension* browser_action_a() const { return browser_action_a_.get(); }
+ const Extension* browser_action_b() const { return browser_action_b_.get(); }
+ const Extension* browser_action_c() const { return browser_action_c_.get(); }
const Extension* browser_action() const {
return browser_action_extension_.get();
}
@@ -193,12 +187,12 @@ void ExtensionToolbarModelUnitTest::Init() {
}
testing::AssertionResult ExtensionToolbarModelUnitTest::AddExtension(
- scoped_refptr<const Extension> extension) {
+ const scoped_refptr<const Extension>& extension) {
if (registry()->enabled_extensions().GetByID(extension->id())) {
return testing::AssertionFailure() << "Extension " << extension->name() <<
" already installed!";
}
- service()->AddExtension(extension);
+ service()->AddExtension(extension.get());
if (!registry()->enabled_extensions().GetByID(extension->id())) {
return testing::AssertionFailure() << "Failed to install extension: " <<
extension->name();
@@ -207,7 +201,7 @@ testing::AssertionResult ExtensionToolbarModelUnitTest::AddExtension(
}
testing::AssertionResult ExtensionToolbarModelUnitTest::RemoveExtension(
- scoped_refptr<const Extension> extension) {
+ const scoped_refptr<const Extension>& extension) {
if (!registry()->enabled_extensions().GetByID(extension->id())) {
return testing::AssertionFailure() << "Extension " << extension->name() <<
" not installed!";
@@ -255,8 +249,9 @@ ExtensionToolbarModelUnitTest::AddBrowserActionExtensions() {
const Extension* ExtensionToolbarModelUnitTest::GetExtensionAtIndex(
size_t index) const {
- return index < toolbar_model_->toolbar_items().size() ?
- toolbar_model_->toolbar_items()[index] : NULL;
+ return index < toolbar_model_->toolbar_items().size()
+ ? toolbar_model_->toolbar_items()[index].get()
+ : NULL;
}
testing::AssertionResult ExtensionToolbarModelUnitTest::AddAndVerifyExtensions(
@@ -296,7 +291,7 @@ TEST_F(ExtensionToolbarModelUnitTest, BasicExtensionToolbarModelTest) {
EXPECT_EQ(extension2, GetExtensionAtIndex(0u));
// Should be a no-op, but still fires the events.
- toolbar_model()->MoveExtensionIcon(extension2, 0);
+ toolbar_model()->MoveExtensionIcon(extension2.get(), 0);
EXPECT_EQ(1u, observer()->moved_count());
EXPECT_EQ(1u, num_toolbar_items());
EXPECT_EQ(extension2, GetExtensionAtIndex(0u));
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698