summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_updater_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_updater_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_updater_unittest.cc')
-rw-r--r--chrome/browser/extensions/extension_updater_unittest.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc
index 7989e7a..bae09c6 100644
--- a/chrome/browser/extensions/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/extension_updater_unittest.cc
@@ -94,7 +94,8 @@ class MockService : public ExtensionUpdateService {
base::StringPrintf("Extension %d", i));
if (update_url)
manifest.SetString(extension_manifest_keys::kUpdateURL, *update_url);
- Extension* e = prefs_.AddExtensionWithManifest(manifest, location);
+ scoped_refptr<Extension> e =
+ prefs_.AddExtensionWithManifest(manifest, location);
ASSERT_TRUE(e != NULL);
list->push_back(e);
}
@@ -343,10 +344,6 @@ class ExtensionUpdaterTest : public testing::Test {
EXPECT_EQ(extensions[0]->VersionString(), params["v"]);
}
EXPECT_EQ("", params["uc"]);
-
- if (!pending) {
- STLDeleteElements(&extensions);
- }
}
static void TestBlacklistUpdateCheckRequests() {
@@ -438,7 +435,6 @@ class ExtensionUpdaterTest : public testing::Test {
updateable = updater->DetermineUpdates(fetch_data, updates);
EXPECT_EQ(1u, updateable.size());
EXPECT_EQ(0, updateable[0]);
- STLDeleteElements(&tmp);
}
static void TestDetermineUpdatesPending() {
@@ -788,8 +784,6 @@ class ExtensionUpdaterTest : public testing::Test {
size_t pos = url1_query.find(search_string);
EXPECT_TRUE(pos != std::string::npos);
}
-
- STLDeleteElements(&tmp);
}
// This makes sure that the extension updater properly stores the results
@@ -821,8 +815,6 @@ class ExtensionUpdaterTest : public testing::Test {
EXPECT_FALSE(last_ping_day.is_null());
int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds();
EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5);
-
- STLDeleteElements(&tmp);
}
};
@@ -894,7 +886,6 @@ TEST(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) {
ASSERT_FALSE(extensions.empty());
builder.AddExtension(*extensions[0]);
EXPECT_TRUE(builder.GetFetches().empty());
- STLDeleteElements(&extensions);
}
// Extensions with invalid update URLs should be rejected.