diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 17:47:26 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 17:47:26 +0000 |
commit | 6f229e8807e2b1fe8d2a44e9f615a09b2c5a612a (patch) | |
tree | f1bdd3c70f531f9819b5d35a42e9d4562053b9da /chrome/browser/extensions/extension_info_map_unittest.cc | |
parent | dc7a7d60a299089afd7d13ca18eb218b2814118a (diff) | |
download | chromium_src-6f229e8807e2b1fe8d2a44e9f615a09b2c5a612a.zip chromium_src-6f229e8807e2b1fe8d2a44e9f615a09b2c5a612a.tar.gz chromium_src-6f229e8807e2b1fe8d2a44e9f615a09b2c5a612a.tar.bz2 |
Unrevert r64676 "Part 4/4 of immutable Extension refactor: Kill Extension::StaticData and put"
Original CL:
Part 4/4 of immutable Extension refactor: Kill Extension::StaticData and put
its guts into Extension.
BUG=56558
TEST=no functional change
Review URL: http://codereview.chromium.org/4200005
Review URL: http://codereview.chromium.org/4277002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64767 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 | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index e417d23..d4892d1 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/browser_thread.h" #include "chrome/browser/extensions/extension_info_map.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/json_value_serializer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -73,37 +74,36 @@ static scoped_refptr<Extension> LoadManifest(const std::string& dir, TEST_F(ExtensionInfoMapTest, RefCounting) { scoped_refptr<ExtensionInfoMap> info_map(new ExtensionInfoMap()); - // New extensions should have a single reference holding onto their static - // data. + // New extensions should have a single reference holding onto them. scoped_refptr<Extension> extension1(CreateExtension("extension1")); scoped_refptr<Extension> extension2(CreateExtension("extension2")); scoped_refptr<Extension> extension3(CreateExtension("extension3")); - EXPECT_TRUE(extension1->static_data()->HasOneRef()); - EXPECT_TRUE(extension2->static_data()->HasOneRef()); - EXPECT_TRUE(extension3->static_data()->HasOneRef()); + EXPECT_TRUE(extension1->HasOneRef()); + EXPECT_TRUE(extension2->HasOneRef()); + EXPECT_TRUE(extension3->HasOneRef()); // Add a ref to each extension and give it to the info map. The info map // expects the caller to add a ref for it, but then assumes ownership of that // reference. - extension1->static_data()->AddRef(); - info_map->AddExtension(extension1->static_data()); - extension2->static_data()->AddRef(); - info_map->AddExtension(extension2->static_data()); - extension3->static_data()->AddRef(); - info_map->AddExtension(extension3->static_data()); - - // Delete extension1, and the info map should have the only ref. - const Extension::StaticData* data1 = extension1->static_data(); + extension1->AddRef(); + info_map->AddExtension(extension1); + extension2->AddRef(); + info_map->AddExtension(extension2); + extension3->AddRef(); + info_map->AddExtension(extension3); + + // Release extension1, and the info map should have the only ref. + const Extension* weak_extension1 = extension1; extension1 = NULL; - EXPECT_TRUE(data1->HasOneRef()); + EXPECT_TRUE(weak_extension1->HasOneRef()); // Remove extension2, and the extension2 object should have the only ref. info_map->RemoveExtension(extension2->id()); - EXPECT_TRUE(extension2->static_data()->HasOneRef()); + EXPECT_TRUE(extension2->HasOneRef()); // Delete the info map, and the extension3 object should have the only ref. info_map = NULL; - EXPECT_TRUE(extension3->static_data()->HasOneRef()); + EXPECT_TRUE(extension3->HasOneRef()); } // Tests that we can query a few extension properties from the ExtensionInfoMap. @@ -113,10 +113,10 @@ TEST_F(ExtensionInfoMapTest, Properties) { scoped_refptr<Extension> extension1(CreateExtension("extension1")); scoped_refptr<Extension> extension2(CreateExtension("extension2")); - extension1->static_data()->AddRef(); - info_map->AddExtension(extension1->static_data()); - extension2->static_data()->AddRef(); - info_map->AddExtension(extension2->static_data()); + extension1->AddRef(); + info_map->AddExtension(extension1); + extension2->AddRef(); + info_map->AddExtension(extension2); EXPECT_EQ(extension1->name(), info_map->GetNameForExtension(extension1->id())); @@ -142,10 +142,10 @@ TEST_F(ExtensionInfoMapTest, CheckPermissions) { ASSERT_TRUE(app->is_app()); ASSERT_TRUE(app->web_extent().ContainsURL(app_url)); - app->static_data()->AddRef(); - info_map->AddExtension(app->static_data()); - extension->static_data()->AddRef(); - info_map->AddExtension(extension->static_data()); + app->AddRef(); + info_map->AddExtension(app); + extension->AddRef(); + info_map->AddExtension(extension); // The app should have the notifications permission, either from a // chrome-extension URL or from its web extent. |