diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 20:37:41 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 20:37:41 +0000 |
commit | 66e4eb3c01053c6642804a4f8e188bd05aab4790 (patch) | |
tree | fe227c6799230954c48cd70db60d05eae63cbe44 /chrome/common/extensions/extension_file_util_unittest.cc | |
parent | a3ed6c82468f9f704a1b7e112ea3c132adb5ea2e (diff) | |
download | chromium_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/common/extensions/extension_file_util_unittest.cc')
-rw-r--r-- | chrome/common/extensions/extension_file_util_unittest.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index 634df05..230712d 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -78,7 +78,7 @@ TEST(ExtensionFileUtil, LoadExtensionWithValidLocales) { .AppendASCII("1.0.0.0"); std::string error; - scoped_ptr<Extension> extension(extension_file_util::LoadExtension( + scoped_refptr<Extension> extension(extension_file_util::LoadExtension( install_dir, Extension::LOAD, false, &error)); ASSERT_TRUE(extension != NULL); EXPECT_EQ("The first extension that I made.", extension->description()); @@ -94,7 +94,7 @@ TEST(ExtensionFileUtil, LoadExtensionWithoutLocalesFolder) { .AppendASCII("1.0"); std::string error; - scoped_ptr<Extension> extension(extension_file_util::LoadExtension( + scoped_refptr<Extension> extension(extension_file_util::LoadExtension( install_dir, Extension::LOAD, false, &error)); ASSERT_FALSE(extension == NULL); EXPECT_TRUE(error.empty()); @@ -152,7 +152,7 @@ TEST(ExtensionFileUtil, LoadExtensionGivesHelpfullErrorOnMissingManifest) { .AppendASCII("1.0"); std::string error; - scoped_ptr<Extension> extension(extension_file_util::LoadExtension( + scoped_refptr<Extension> extension(extension_file_util::LoadExtension( install_dir, Extension::LOAD, false, &error)); ASSERT_TRUE(extension == NULL); ASSERT_FALSE(error.empty()); @@ -169,7 +169,7 @@ TEST(ExtensionFileUtil, LoadExtensionGivesHelpfullErrorOnBadManifest) { .AppendASCII("1.0"); std::string error; - scoped_ptr<Extension> extension(extension_file_util::LoadExtension( + scoped_refptr<Extension> extension(extension_file_util::LoadExtension( install_dir, Extension::LOAD, false, &error)); ASSERT_TRUE(extension == NULL); ASSERT_FALSE(error.empty()); @@ -185,7 +185,7 @@ TEST(ExtensionFileUtil, FailLoadingNonUTF8Scripts) { .AppendASCII("bad_encoding"); std::string error; - scoped_ptr<Extension> extension(extension_file_util::LoadExtension( + scoped_refptr<Extension> extension(extension_file_util::LoadExtension( install_dir, Extension::LOAD, false, &error)); ASSERT_TRUE(extension == NULL); ASSERT_STREQ("Could not load file 'bad_encoding.js' for content script. " |