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

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

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 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/objects_unittest.cc
diff --git a/tools/json_schema_compiler/test/objects_unittest.cc b/tools/json_schema_compiler/test/objects_unittest.cc
index b00ea35497b8fbb99ec8b84362d4245afc25697a..9bc8e5e1bb90f4eb53b57d34982c05bffde9bd0d 100644
--- a/tools/json_schema_compiler/test/objects_unittest.cc
+++ b/tools/json_schema_compiler/test/objects_unittest.cc
@@ -9,6 +9,8 @@
#include <utility>
#include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
+#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "tools/json_schema_compiler/test/objects_movable.h"
#include "tools/json_schema_compiler/test/objects_movable_json.h"
@@ -19,16 +21,15 @@ using namespace test::api::objects_movable_json;
TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) {
{
- std::unique_ptr<base::ListValue> strings(new base::ListValue());
+ auto strings = base::MakeUnique<base::ListValue>();
strings->AppendString("one");
strings->AppendString("two");
- std::unique_ptr<base::DictionaryValue> info_value(
- new base::DictionaryValue());
- info_value->Set("strings", strings.release());
- info_value->Set("integer", new base::Value(5));
- info_value->Set("boolean", new base::Value(true));
+ auto info_value = base::MakeUnique<base::DictionaryValue>();
+ info_value->Set("strings", std::move(strings));
+ info_value->SetInteger("integer", 5);
+ info_value->SetBoolean("boolean", true);
- std::unique_ptr<base::ListValue> params_value(new base::ListValue());
+ auto params_value = base::MakeUnique<base::ListValue>();
params_value->Append(std::move(info_value));
std::unique_ptr<ObjectParam::Params> params(
ObjectParam::Params::Create(*params_value));
@@ -40,15 +41,14 @@ TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) {
EXPECT_TRUE(params->info.boolean);
}
{
- std::unique_ptr<base::ListValue> strings(new base::ListValue());
+ auto strings = base::MakeUnique<base::ListValue>();
strings->AppendString("one");
strings->AppendString("two");
- std::unique_ptr<base::DictionaryValue> info_value(
- new base::DictionaryValue());
- info_value->Set("strings", strings.release());
- info_value->Set("integer", new base::Value(5));
+ auto info_value = base::MakeUnique<base::DictionaryValue>();
+ info_value->Set("strings", std::move(strings));
+ info_value->SetInteger("integer", 5);
- std::unique_ptr<base::ListValue> params_value(new base::ListValue());
+ auto params_value = base::MakeUnique<base::ListValue>();
params_value->Append(std::move(info_value));
std::unique_ptr<ObjectParam::Params> params(
ObjectParam::Params::Create(*params_value));
« no previous file with comments | « tools/json_schema_compiler/test/functions_as_parameters_unittest.cc ('k') | ui/app_list/search/history_data_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698