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

Unified Diff: tools/json_schema_compiler/test/idl_schemas_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
« no previous file with comments | « tools/json_schema_compiler/test/callbacks_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/test/idl_schemas_unittest.cc
diff --git a/tools/json_schema_compiler/test/idl_schemas_unittest.cc b/tools/json_schema_compiler/test/idl_schemas_unittest.cc
index e010346926074c9ca5b4fa4698f01da3bb4b1c73..139f4df15ab36f505ed180976f9d05033e9283ad 100644
--- a/tools/json_schema_compiler/test/idl_schemas_unittest.cc
+++ b/tools/json_schema_compiler/test/idl_schemas_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/values.h"
@@ -45,14 +46,14 @@ TEST(IdlCompiler, Basics) {
// Test Function3, which takes a MyType1 parameter.
list.Clear();
- base::DictionaryValue* tmp = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> tmp(new base::DictionaryValue());
tmp->SetInteger("x", 17);
tmp->SetString("y", "hello");
tmp->SetString("z", "zstring");
tmp->SetString("a", "astring");
tmp->SetString("b", "bstring");
tmp->SetString("c", "cstring");
- list.Append(tmp);
+ list.Append(std::move(tmp));
std::unique_ptr<Function3::Params> f3_params =
Function3::Params::Create(list);
EXPECT_EQ(17, f3_params->arg.x);
@@ -108,14 +109,14 @@ TEST(IdlCompiler, OptionalArguments) {
Function9::Params::Create(list);
EXPECT_EQ(NULL, f9_params->arg.get());
list.Clear();
- base::DictionaryValue* tmp = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> tmp(new base::DictionaryValue());
tmp->SetInteger("x", 17);
tmp->SetString("y", "hello");
tmp->SetString("z", "zstring");
tmp->SetString("a", "astring");
tmp->SetString("b", "bstring");
tmp->SetString("c", "cstring");
- list.Append(tmp);
+ list.Append(std::move(tmp));
f9_params = Function9::Params::Create(list);
ASSERT_TRUE(f9_params->arg.get() != NULL);
MyType1* t1 = f9_params->arg.get();
@@ -138,10 +139,10 @@ TEST(IdlCompiler, ArrayTypes) {
// Same function, but this time with 2 values in the array.
list.Clear();
list.AppendInteger(33);
- base::ListValue* sublist = new base::ListValue;
+ std::unique_ptr<base::ListValue> sublist(new base::ListValue);
sublist->AppendInteger(34);
sublist->AppendInteger(35);
- list.Append(sublist);
+ list.Append(std::move(sublist));
f10_params = Function10::Params::Create(list);
ASSERT_TRUE(f10_params != NULL);
EXPECT_EQ(33, f10_params->x);
@@ -157,10 +158,10 @@ TEST(IdlCompiler, ArrayTypes) {
b.x = 6;
a.y = std::string("foo");
b.y = std::string("bar");
- base::ListValue* sublist2 = new base::ListValue;
+ std::unique_ptr<base::ListValue> sublist2(new base::ListValue);
sublist2->Append(a.ToValue());
sublist2->Append(b.ToValue());
- list.Append(sublist2);
+ list.Append(std::move(sublist2));
std::unique_ptr<Function11::Params> f11_params =
Function11::Params::Create(list);
ASSERT_TRUE(f11_params != NULL);
« no previous file with comments | « tools/json_schema_compiler/test/callbacks_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698