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

Unified Diff: tools/json_schema_compiler/test/functions_as_parameters_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/functions_as_parameters_unittest.cc
diff --git a/tools/json_schema_compiler/test/functions_as_parameters_unittest.cc b/tools/json_schema_compiler/test/functions_as_parameters_unittest.cc
index ce7a2f981659d16a6bf4cdf5fbe8902cb390db39..858f0528fdb1d3f47467097310f93956db7a6e9b 100644
--- a/tools/json_schema_compiler/test/functions_as_parameters_unittest.cc
+++ b/tools/json_schema_compiler/test/functions_as_parameters_unittest.cc
@@ -4,6 +4,8 @@
#include "tools/json_schema_compiler/test/functions_as_parameters.h"
+#include "base/memory/ptr_util.h"
+#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
using namespace test::api::functions_as_parameters;
@@ -19,7 +21,7 @@ TEST(JsonSchemaCompilerFunctionsAsParametersTest, PopulateRequiredFunction) {
{
base::DictionaryValue value;
base::DictionaryValue function_dict;
- value.Set("event_callback", function_dict.DeepCopy());
+ value.Set("event_callback", base::MakeUnique<base::Value>(function_dict));
FunctionType out;
ASSERT_TRUE(FunctionType::Populate(value, &out));
EXPECT_TRUE(out.event_callback.empty());
@@ -30,7 +32,7 @@ TEST(JsonSchemaCompilerFunctionsAsParametersTest, RequiredFunctionToValue) {
{
base::DictionaryValue value;
base::DictionaryValue function_dict;
- value.Set("event_callback", function_dict.DeepCopy());
+ value.Set("event_callback", base::MakeUnique<base::Value>(function_dict));
FunctionType out;
ASSERT_TRUE(FunctionType::Populate(value, &out));
@@ -40,8 +42,9 @@ TEST(JsonSchemaCompilerFunctionsAsParametersTest, RequiredFunctionToValue) {
base::DictionaryValue value;
base::DictionaryValue expected_value;
base::DictionaryValue function_dict;
- value.Set("event_callback", function_dict.DeepCopy());
- expected_value.Set("event_callback", function_dict.DeepCopy());
+ value.Set("event_callback", base::MakeUnique<base::Value>(function_dict));
+ expected_value.Set("event_callback",
+ base::MakeUnique<base::Value>(function_dict));
FunctionType out;
ASSERT_TRUE(FunctionType::Populate(value, &out));
@@ -59,7 +62,7 @@ TEST(JsonSchemaCompilerFunctionsAsParametersTest, PopulateOptionalFunction) {
{
base::DictionaryValue value;
base::DictionaryValue function_value;
- value.Set("event_callback", function_value.DeepCopy());
+ value.Set("event_callback", base::MakeUnique<base::Value>(function_value));
OptionalFunctionType out;
ASSERT_TRUE(OptionalFunctionType::Populate(value, &out));
EXPECT_TRUE(out.event_callback.get());
@@ -67,7 +70,7 @@ TEST(JsonSchemaCompilerFunctionsAsParametersTest, PopulateOptionalFunction) {
{
base::DictionaryValue value;
base::DictionaryValue function_value;
- value.Set("event_callback", function_value.DeepCopy());
+ value.Set("event_callback", base::MakeUnique<base::Value>(function_value));
OptionalFunctionType out;
ASSERT_TRUE(OptionalFunctionType::Populate(value, &out));
EXPECT_TRUE(out.event_callback.get());
@@ -85,7 +88,7 @@ TEST(JsonSchemaCompilerFunctionsAsParametersTest, OptionalFunctionToValue) {
{
base::DictionaryValue value;
base::DictionaryValue function_value;
- value.Set("event_callback", function_value.DeepCopy());
+ value.Set("event_callback", base::MakeUnique<base::Value>(function_value));
OptionalFunctionType out;
ASSERT_TRUE(OptionalFunctionType::Populate(value, &out));
« no previous file with comments | « tools/json_schema_compiler/test/enums_unittest.cc ('k') | tools/json_schema_compiler/test/objects_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698