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

Side by Side Diff: tools/json_schema_compiler/test/functions_on_types_unittest.cc

Issue 2036013002: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //tools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/values.h" 5 #include "base/values.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "tools/json_schema_compiler/test/functions_on_types.h" 7 #include "tools/json_schema_compiler/test/functions_on_types.h"
8 8
9 using namespace test::api::functions_on_types; 9 using namespace test::api::functions_on_types;
10 10
11 TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) { 11 TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) {
12 { 12 {
13 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 13 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
14 std::unique_ptr<StorageArea::Get::Params> params( 14 std::unique_ptr<StorageArea::Get::Params> params(
15 StorageArea::Get::Params::Create(*params_value)); 15 StorageArea::Get::Params::Create(*params_value));
16 ASSERT_TRUE(params); 16 ASSERT_TRUE(params);
17 EXPECT_FALSE(params->keys); 17 EXPECT_FALSE(params->keys);
18 } 18 }
19 { 19 {
20 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 20 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
21 params_value->Append(new base::FundamentalValue(9)); 21 params_value->AppendInteger(9);
22 std::unique_ptr<StorageArea::Get::Params> params( 22 std::unique_ptr<StorageArea::Get::Params> params(
23 StorageArea::Get::Params::Create(*params_value)); 23 StorageArea::Get::Params::Create(*params_value));
24 EXPECT_FALSE(params); 24 EXPECT_FALSE(params);
25 } 25 }
26 { 26 {
27 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 27 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
28 params_value->Append(new base::StringValue("test")); 28 params_value->AppendString("test");
29 std::unique_ptr<StorageArea::Get::Params> params( 29 std::unique_ptr<StorageArea::Get::Params> params(
30 StorageArea::Get::Params::Create(*params_value)); 30 StorageArea::Get::Params::Create(*params_value));
31 ASSERT_TRUE(params); 31 ASSERT_TRUE(params);
32 ASSERT_TRUE(params->keys); 32 ASSERT_TRUE(params->keys);
33 EXPECT_EQ("test", *params->keys->as_string); 33 EXPECT_EQ("test", *params->keys->as_string);
34 } 34 }
35 { 35 {
36 std::unique_ptr<base::DictionaryValue> keys_object_value( 36 std::unique_ptr<base::DictionaryValue> keys_object_value(
37 new base::DictionaryValue()); 37 new base::DictionaryValue());
38 keys_object_value->SetInteger("integer", 5); 38 keys_object_value->SetInteger("integer", 5);
(...skipping 24 matching lines...) Expand all
63 std::unique_ptr<base::DictionaryValue> details_value( 63 std::unique_ptr<base::DictionaryValue> details_value(
64 new base::DictionaryValue()); 64 new base::DictionaryValue());
65 details_value->SetBoolean("incognito", true); 65 details_value->SetBoolean("incognito", true);
66 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 66 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
67 params_value->Append(details_value.release()); 67 params_value->Append(details_value.release());
68 std::unique_ptr<ChromeSetting::Get::Params> params( 68 std::unique_ptr<ChromeSetting::Get::Params> params(
69 ChromeSetting::Get::Params::Create(*params_value)); 69 ChromeSetting::Get::Params::Create(*params_value));
70 EXPECT_TRUE(params.get()); 70 EXPECT_TRUE(params.get());
71 EXPECT_TRUE(*params->details.incognito); 71 EXPECT_TRUE(*params->details.incognito);
72 } 72 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/enums_unittest.cc ('k') | tools/json_schema_compiler/test/idl_schemas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698