summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_icon_manager_unittest.cc
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 20:37:41 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 20:37:41 +0000
commit66e4eb3c01053c6642804a4f8e188bd05aab4790 (patch)
treefe227c6799230954c48cd70db60d05eae63cbe44 /chrome/browser/extensions/extension_icon_manager_unittest.cc
parenta3ed6c82468f9f704a1b7e112ea3c132adb5ea2e (diff)
downloadchromium_src-66e4eb3c01053c6642804a4f8e188bd05aab4790.zip
chromium_src-66e4eb3c01053c6642804a4f8e188bd05aab4790.tar.gz
chromium_src-66e4eb3c01053c6642804a4f8e188bd05aab4790.tar.bz2
Unrevert again r63919: "Part 2 of immutable Extension refactor."
(Last landing broke chromeos and chromium linux builder.) I made Extension a refcounted object, and privitized the existing con/destructor and InitFromValue. The only way to get an Extension is to call a factory method. In the next CL, I plan to make the factory method return a const Extension, to guarantee that no one can modify the Extension object after creation. Note: There was a tricky part of this CL because of the difference in semantics between scoped_ptr and scoped_refptr. I had to be careful not to use ptr.release(), since that would result in leaks (an un-Released AddRef). BUG=56558 TEST=no functional change Original Review URL: http://codereview.chromium.org/3982001 TBR=aa Review URL: http://codereview.chromium.org/4119010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_icon_manager_unittest.cc')
-rw-r--r--chrome/browser/extensions/extension_icon_manager_unittest.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc
index 51c76ea..37f3453 100644
--- a/chrome/browser/extensions/extension_icon_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc
@@ -109,26 +109,26 @@ TEST_F(ExtensionIconManagerTest, LoadRemoveLoad) {
static_cast<DictionaryValue*>(serializer.Deserialize(NULL, NULL)));
ASSERT_TRUE(manifest.get() != NULL);
- Extension extension(manifest_path.DirName());
- ASSERT_TRUE(extension.InitFromValue(*manifest.get(),
- false /* require_key */,
- NULL /* errors */));
+ scoped_refptr<Extension> extension(Extension::Create(
+ manifest_path.DirName(), Extension::INVALID, *manifest.get(),
+ false, NULL));
+ ASSERT_TRUE(extension.get());
TestIconManager icon_manager(this);
// Load the icon and grab the bitmap.
- icon_manager.LoadIcon(&extension);
+ icon_manager.LoadIcon(extension.get());
WaitForImageLoad();
- SkBitmap first_icon = icon_manager.GetIcon(extension.id());
+ SkBitmap first_icon = icon_manager.GetIcon(extension->id());
EXPECT_FALSE(gfx::BitmapsAreEqual(first_icon, default_icon));
// Remove the icon from the manager.
- icon_manager.RemoveIcon(extension.id());
+ icon_manager.RemoveIcon(extension->id());
// Now re-load the icon - we should get the same result bitmap (and not the
// default icon).
- icon_manager.LoadIcon(&extension);
+ icon_manager.LoadIcon(extension.get());
WaitForImageLoad();
- SkBitmap second_icon = icon_manager.GetIcon(extension.id());
+ SkBitmap second_icon = icon_manager.GetIcon(extension->id());
EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon));
EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon));