diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 22:32:07 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 22:32:07 +0000 |
commit | 0f9f337262c383b94dce482aba0fac7e5778c852 (patch) | |
tree | 9359ce10553fadfb4583601da2b7fe58dba7edce /chrome/browser/themes | |
parent | cc3d6f596df5fa5fa6258b69e947c8977ade7dc7 (diff) | |
download | chromium_src-0f9f337262c383b94dce482aba0fac7e5778c852.zip chromium_src-0f9f337262c383b94dce482aba0fac7e5778c852.tar.gz chromium_src-0f9f337262c383b94dce482aba0fac7e5778c852.tar.bz2 |
Unrevert r63919: "Part 2 of immutable Extension refactor."
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/4186002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/themes')
-rw-r--r-- | chrome/browser/themes/browser_theme_pack_unittest.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 87fc2c7..5da6acf 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -397,8 +397,6 @@ TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { // Part 1: Build the pack from an extension. { FilePath star_gazing_path = GetStarGazingPath(); - Extension extension(star_gazing_path); - FilePath manifest_path = star_gazing_path.AppendASCII("manifest.json"); std::string error; @@ -407,11 +405,13 @@ TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); EXPECT_EQ("", error); ASSERT_TRUE(valid_value.get()); - ASSERT_TRUE(extension.InitFromValue(*valid_value, true, &error)); + scoped_refptr<Extension> extension(Extension::Create( + star_gazing_path, Extension::INVALID, *valid_value, true, &error)); + ASSERT_TRUE(extension.get()); ASSERT_EQ("", error); scoped_refptr<BrowserThemePack> pack = - BrowserThemePack::BuildFromExtension(&extension); + BrowserThemePack::BuildFromExtension(extension.get()); ASSERT_TRUE(pack.get()); ASSERT_TRUE(pack->WriteToDisk(file)); VerifyStarGazing(pack.get()); |