Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2325)

Unified Diff: base/values_unittest.cc

Issue 1150863002: Make DictionaryValue::DeepCopyWithoutEmptyChildren return a scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.cc ('k') | chrome/browser/chromeos/extensions/echo_private_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values_unittest.cc
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 6466a962554d3b0ba1e2cae0df95c53f21619968..9e5e349018eb6bc87c8352b6dda5f728958fe0f9 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -672,25 +672,28 @@ TEST(ValuesTest, RemoveEmptyChildren) {
root->Set("empty_list", make_scoped_ptr(new ListValue));
root->SetWithoutPathExpansion("a.b.c.d.e",
make_scoped_ptr(new DictionaryValue));
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
EXPECT_TRUE(root->empty());
// Make sure we don't prune too much.
root->SetBoolean("bool", true);
root->Set("empty_dict", make_scoped_ptr(new DictionaryValue));
root->SetString("empty_string", std::string());
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
brettw 2015/05/22 20:59:32 Did you screw up search and replace for these plac
Evan Stade 2015/05/22 21:28:57 must have done
EXPECT_EQ(2U, root->size());
// Should do nothing.
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
EXPECT_EQ(2U, root->size());
// Nested test cases. These should all reduce back to the bool and string
// set above.
{
root->Set("a.b.c.d.e", make_scoped_ptr(new DictionaryValue));
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
EXPECT_EQ(2U, root->size());
}
{
@@ -698,7 +701,8 @@ TEST(ValuesTest, RemoveEmptyChildren) {
inner->Set("empty_dict", make_scoped_ptr(new DictionaryValue));
inner->Set("empty_list", make_scoped_ptr(new ListValue));
root->Set("dict_with_empty_children", inner.Pass());
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
EXPECT_EQ(2U, root->size());
}
{
@@ -706,7 +710,8 @@ TEST(ValuesTest, RemoveEmptyChildren) {
inner->Append(make_scoped_ptr(new DictionaryValue));
inner->Append(make_scoped_ptr(new ListValue));
root->Set("list_with_empty_children", inner.Pass());
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
EXPECT_EQ(2U, root->size());
}
@@ -720,7 +725,8 @@ TEST(ValuesTest, RemoveEmptyChildren) {
inner2->Set("empty_dict", make_scoped_ptr(new DictionaryValue));
inner2->Set("empty_list", make_scoped_ptr(new ListValue));
root->Set("dict_with_empty_children", inner2.Pass());
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
EXPECT_EQ(2U, root->size());
}
@@ -732,7 +738,8 @@ TEST(ValuesTest, RemoveEmptyChildren) {
inner->Append(make_scoped_ptr(new DictionaryValue));
inner->Append(inner2.Pass());
root->Set("list_with_empty_children", inner.Pass());
- root.reset(root->DeepCopyWithoutEmptyChildren());
+ root = root->DeepCopyWithoutEmptyChildren();
+ ;
EXPECT_EQ(3U, root->size());
ListValue* inner_value, *inner_value2;
« no previous file with comments | « base/values.cc ('k') | chrome/browser/chromeos/extensions/echo_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698