Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams.
[email protected],[email protected]
BUG=263894
Review URL: https://chromiumcodereview.appspot.com/21030009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215885 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 8776c104..733c485 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -203,7 +203,7 @@
TEST(ValuesTest, ListRemoval) {
bool deletion_flag = true;
- Value* removed_item = NULL;
+ scoped_ptr<Value> removed_item;
{
ListValue list;
@@ -218,8 +218,7 @@
EXPECT_EQ(0U, list.GetSize());
}
EXPECT_FALSE(deletion_flag);
- delete removed_item;
- removed_item = NULL;
+ removed_item.reset();
EXPECT_TRUE(deletion_flag);
{
@@ -275,7 +274,7 @@
TEST(ValuesTest, DictionaryRemoval) {
std::string key = "test";
bool deletion_flag = true;
- Value* removed_item = NULL;
+ scoped_ptr<Value> removed_item;
{
DictionaryValue dict;
@@ -288,8 +287,7 @@
ASSERT_TRUE(removed_item);
}
EXPECT_FALSE(deletion_flag);
- delete removed_item;
- removed_item = NULL;
+ removed_item.reset();
EXPECT_TRUE(deletion_flag);
{