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

Unified Diff: tools/json_schema_compiler/test/arrays_unittest.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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
Index: tools/json_schema_compiler/test/arrays_unittest.cc
diff --git a/tools/json_schema_compiler/test/arrays_unittest.cc b/tools/json_schema_compiler/test/arrays_unittest.cc
index 5d68563710ed1c58ef5fbfc8c26c42591e71d7aa..29ca4a6d34877220357829f5a37338197e5eca68 100644
--- a/tools/json_schema_compiler/test/arrays_unittest.cc
+++ b/tools/json_schema_compiler/test/arrays_unittest.cc
@@ -249,10 +249,10 @@ TEST(JsonSchemaCompilerArrayTest, ReturnIntegerArrayResultCreate) {
ReturnIntegerArray::Results::Create(integers);
base::ListValue expected;
- base::ListValue* expected_argument = new base::ListValue();
+ std::unique_ptr<base::ListValue> expected_argument(new base::ListValue());
expected_argument->AppendInteger(1);
expected_argument->AppendInteger(2);
- expected.Append(expected_argument);
+ expected.Append(std::move(expected_argument));
EXPECT_TRUE(results->Equals(&expected));
}
@@ -266,13 +266,13 @@ TEST(JsonSchemaCompilerArrayTest, ReturnRefArrayResultCreate) {
ReturnRefArray::Results::Create(items);
base::ListValue expected;
- base::ListValue* expected_argument = new base::ListValue();
- base::DictionaryValue* first = new base::DictionaryValue();
+ std::unique_ptr<base::ListValue> expected_argument(new base::ListValue());
+ std::unique_ptr<base::DictionaryValue> first(new base::DictionaryValue());
first->SetInteger("val", 1);
- expected_argument->Append(first);
- base::DictionaryValue* second = new base::DictionaryValue();
+ expected_argument->Append(std::move(first));
+ std::unique_ptr<base::DictionaryValue> second(new base::DictionaryValue());
second->SetInteger("val", 2);
- expected_argument->Append(second);
- expected.Append(expected_argument);
+ expected_argument->Append(std::move(second));
+ expected.Append(std::move(expected_argument));
EXPECT_TRUE(results->Equals(&expected));
}

Powered by Google App Engine
This is Rietveld 408576698