Index: tools/json_schema_compiler/test/choices_unittest.cc |
diff --git a/tools/json_schema_compiler/test/choices_unittest.cc b/tools/json_schema_compiler/test/choices_unittest.cc |
index 35ec22984cf4e86e2faaa90845ca6d6c9c057a27..708c90053ba8d84f67b74d50b7a19488ed2b9320 100644 |
--- a/tools/json_schema_compiler/test/choices_unittest.cc |
+++ b/tools/json_schema_compiler/test/choices_unittest.cc |
@@ -8,7 +8,9 @@ |
#include <utility> |
+#include "base/memory/ptr_util.h" |
#include "base/strings/string_piece.h" |
+#include "base/values.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "tools/json_schema_compiler/test/test_util.h" |
@@ -22,21 +24,22 @@ using json_schema_compiler::test_util::Vector; |
TEST(JsonSchemaCompilerChoicesTest, TakesIntegersParamsCreate) { |
{ |
- std::unique_ptr<TakesIntegers::Params> params( |
- TakesIntegers::Params::Create(*List(new base::Value(true)))); |
+ std::unique_ptr<TakesIntegers::Params> params(TakesIntegers::Params::Create( |
+ *List(base::MakeUnique<base::Value>(true)))); |
EXPECT_FALSE(params); |
} |
{ |
std::unique_ptr<TakesIntegers::Params> params( |
- TakesIntegers::Params::Create(*List(new base::Value(6)))); |
+ TakesIntegers::Params::Create(*List(base::MakeUnique<base::Value>(6)))); |
ASSERT_TRUE(params); |
EXPECT_FALSE(params->nums.as_integers); |
EXPECT_EQ(6, *params->nums.as_integer); |
} |
{ |
- std::unique_ptr<TakesIntegers::Params> params(TakesIntegers::Params::Create( |
- *List(List(new base::Value(2), new base::Value(6), new base::Value(8)) |
- .release()))); |
+ std::unique_ptr<TakesIntegers::Params> params( |
+ TakesIntegers::Params::Create(*List(List( |
+ base::MakeUnique<base::Value>(2), base::MakeUnique<base::Value>(6), |
+ base::MakeUnique<base::Value>(8))))); |
ASSERT_TRUE(params); |
ASSERT_TRUE(params->nums.as_integers); |
EXPECT_EQ(Vector(2, 6, 8), *params->nums.as_integers); |
@@ -46,8 +49,8 @@ TEST(JsonSchemaCompilerChoicesTest, TakesIntegersParamsCreate) { |
TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreate) { |
{ |
std::unique_ptr<ObjectWithChoices::Params> params( |
- ObjectWithChoices::Params::Create( |
- *List(Dictionary("strings", new base::Value("asdf")).release()))); |
+ ObjectWithChoices::Params::Create(*List( |
+ Dictionary("strings", base::MakeUnique<base::Value>("asdf"))))); |
ASSERT_TRUE(params); |
EXPECT_FALSE(params->string_info.strings.as_strings); |
EXPECT_EQ("asdf", *params->string_info.strings.as_string); |
@@ -56,9 +59,8 @@ TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreate) { |
{ |
std::unique_ptr<ObjectWithChoices::Params> params( |
ObjectWithChoices::Params::Create( |
- *List(Dictionary("strings", new base::Value("asdf"), "integers", |
- new base::Value(6)) |
- .release()))); |
+ *List(Dictionary("strings", base::MakeUnique<base::Value>("asdf"), |
+ "integers", base::MakeUnique<base::Value>(6))))); |
ASSERT_TRUE(params); |
EXPECT_FALSE(params->string_info.strings.as_strings); |
EXPECT_EQ("asdf", *params->string_info.strings.as_string); |
@@ -75,7 +77,7 @@ TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreateFail) { |
{ |
std::unique_ptr<base::DictionaryValue> object_param( |
new base::DictionaryValue()); |
- object_param->SetWithoutPathExpansion("strings", new base::Value(5)); |
+ object_param->SetIntegerWithoutPathExpansion("strings", 5); |
std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
params_value->Append(std::move(object_param)); |
std::unique_ptr<ObjectWithChoices::Params> params( |
@@ -85,8 +87,8 @@ TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreateFail) { |
{ |
std::unique_ptr<base::DictionaryValue> object_param( |
new base::DictionaryValue()); |
- object_param->SetWithoutPathExpansion("strings", new base::Value("asdf")); |
- object_param->SetWithoutPathExpansion("integers", new base::Value("asdf")); |
+ object_param->SetStringWithoutPathExpansion("strings", "asdf"); |
+ object_param->SetStringWithoutPathExpansion("integers", "asdf"); |
std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
params_value->Append(std::move(object_param)); |
std::unique_ptr<ObjectWithChoices::Params> params( |
@@ -96,7 +98,7 @@ TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreateFail) { |
{ |
std::unique_ptr<base::DictionaryValue> object_param( |
new base::DictionaryValue()); |
- object_param->SetWithoutPathExpansion("integers", new base::Value(6)); |
+ object_param->SetIntegerWithoutPathExpansion("integers", 6); |
std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
params_value->Append(std::move(object_param)); |
std::unique_ptr<ObjectWithChoices::Params> params( |