diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 19:11:38 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 19:11:38 +0000 |
commit | c366ad280c032aed580af147b2285d45649ad29b (patch) | |
tree | 8aef07bf9b5b862e1c623826c527492c9fe12dee /chrome/browser/extensions/extension_info_map_unittest.cc | |
parent | d6b3999f71631506c1b390707f205929bdfa221e (diff) | |
download | chromium_src-c366ad280c032aed580af147b2285d45649ad29b.zip chromium_src-c366ad280c032aed580af147b2285d45649ad29b.tar.gz chromium_src-c366ad280c032aed580af147b2285d45649ad29b.tar.bz2 |
Revert r63919 "Part 2 of immutable Extension refactor."
Compile failure on Linux x64.
BUG=56558
TEST=no functional change
TBR=aa
Review URL: http://codereview.chromium.org/4156002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_info_map_unittest.cc')
-rw-r--r-- | chrome/browser/extensions/extension_info_map_unittest.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index e417d23..559febb 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -28,27 +28,27 @@ class ExtensionInfoMapTest : public testing::Test { }; // Returns a barebones test Extension object with the given name. -static scoped_refptr<Extension> CreateExtension(const std::string& name) { +static Extension* CreateExtension(const std::string& name) { #if defined(OS_WIN) FilePath path(FILE_PATH_LITERAL("c:\\foo")); #elif defined(OS_POSIX) FilePath path(FILE_PATH_LITERAL("/foo")); #endif + scoped_ptr<Extension> extension(new Extension(path.AppendASCII(name))); + DictionaryValue manifest; manifest.SetString(keys::kVersion, "1.0.0.0"); manifest.SetString(keys::kName, name); std::string error; - scoped_refptr<Extension> extension = Extension::Create( - path.AppendASCII(name), Extension::INVALID, manifest, false, &error); - EXPECT_TRUE(extension) << error; + EXPECT_TRUE(extension->InitFromValue(manifest, false, &error)) << error; - return extension; + return extension.release(); } -static scoped_refptr<Extension> LoadManifest(const std::string& dir, - const std::string& test_file) { +static Extension* LoadManifest(const std::string& dir, + const std::string& test_file) { FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") @@ -61,12 +61,11 @@ static scoped_refptr<Extension> LoadManifest(const std::string& dir, return NULL; std::string error; - scoped_refptr<Extension> extension = Extension::Create( - path, Extension::INVALID, *static_cast<DictionaryValue*>(result.get()), - false, &error); - EXPECT_TRUE(extension) << error; + scoped_ptr<Extension> extension(new Extension(path)); + EXPECT_TRUE(extension->InitFromValue( + *static_cast<DictionaryValue*>(result.get()), false, &error)) << error; - return extension; + return extension.release(); } // Test that the ExtensionInfoMap handles refcounting properly. @@ -75,9 +74,9 @@ TEST_F(ExtensionInfoMapTest, RefCounting) { // New extensions should have a single reference holding onto their static // data. - scoped_refptr<Extension> extension1(CreateExtension("extension1")); - scoped_refptr<Extension> extension2(CreateExtension("extension2")); - scoped_refptr<Extension> extension3(CreateExtension("extension3")); + scoped_ptr<Extension> extension1(CreateExtension("extension1")); + scoped_ptr<Extension> extension2(CreateExtension("extension2")); + scoped_ptr<Extension> extension3(CreateExtension("extension3")); EXPECT_TRUE(extension1->static_data()->HasOneRef()); EXPECT_TRUE(extension2->static_data()->HasOneRef()); EXPECT_TRUE(extension3->static_data()->HasOneRef()); @@ -94,7 +93,7 @@ TEST_F(ExtensionInfoMapTest, RefCounting) { // Delete extension1, and the info map should have the only ref. const Extension::StaticData* data1 = extension1->static_data(); - extension1 = NULL; + extension1.reset(); EXPECT_TRUE(data1->HasOneRef()); // Remove extension2, and the extension2 object should have the only ref. @@ -110,8 +109,8 @@ TEST_F(ExtensionInfoMapTest, RefCounting) { TEST_F(ExtensionInfoMapTest, Properties) { scoped_refptr<ExtensionInfoMap> info_map(new ExtensionInfoMap()); - scoped_refptr<Extension> extension1(CreateExtension("extension1")); - scoped_refptr<Extension> extension2(CreateExtension("extension2")); + scoped_ptr<Extension> extension1(CreateExtension("extension1")); + scoped_ptr<Extension> extension2(CreateExtension("extension2")); extension1->static_data()->AddRef(); info_map->AddExtension(extension1->static_data()); @@ -133,9 +132,9 @@ TEST_F(ExtensionInfoMapTest, Properties) { TEST_F(ExtensionInfoMapTest, CheckPermissions) { scoped_refptr<ExtensionInfoMap> info_map(new ExtensionInfoMap()); - scoped_refptr<Extension> app(LoadManifest("manifest_tests", + scoped_ptr<Extension> app(LoadManifest("manifest_tests", "valid_app.json")); - scoped_refptr<Extension> extension(LoadManifest("manifest_tests", + scoped_ptr<Extension> extension(LoadManifest("manifest_tests", "tabs_extension.json")); GURL app_url("http://www.google.com/mail/foo.html"); |