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

Side by Side Diff: tools/json_schema_compiler/test/additional_properties_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
« no previous file with comments | « no previous file | tools/json_schema_compiler/test/arrays_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "tools/json_schema_compiler/test/additional_properties.h" 5 #include "tools/json_schema_compiler/test/additional_properties.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using namespace test::api::additional_properties; 11 using namespace test::api::additional_properties;
12 12
13 TEST(JsonSchemaCompilerAdditionalPropertiesTest, 13 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
14 AdditionalPropertiesTypePopulate) { 14 AdditionalPropertiesTypePopulate) {
15 { 15 {
16 std::unique_ptr<base::ListValue> list_value(new base::ListValue()); 16 std::unique_ptr<base::ListValue> list_value(new base::ListValue());
17 list_value->Append(new base::StringValue("asdf")); 17 list_value->AppendString("asdf");
18 list_value->Append(new base::FundamentalValue(4)); 18 list_value->AppendInteger(4);
19 std::unique_ptr<base::DictionaryValue> type_value( 19 std::unique_ptr<base::DictionaryValue> type_value(
20 new base::DictionaryValue()); 20 new base::DictionaryValue());
21 type_value->SetString("string", "value"); 21 type_value->SetString("string", "value");
22 type_value->SetInteger("other", 9); 22 type_value->SetInteger("other", 9);
23 type_value->Set("another", list_value.release()); 23 type_value->Set("another", list_value.release());
24 std::unique_ptr<AdditionalPropertiesType> type( 24 std::unique_ptr<AdditionalPropertiesType> type(
25 new AdditionalPropertiesType()); 25 new AdditionalPropertiesType());
26 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get())); 26 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get()));
27 EXPECT_TRUE(type->additional_properties.Equals(type_value.get())); 27 EXPECT_TRUE(type->additional_properties.Equals(type_value.get()));
28 } 28 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 base::DictionaryValue* dict = new base::DictionaryValue(); 62 base::DictionaryValue* dict = new base::DictionaryValue();
63 dict->SetInteger("integer", 5); 63 dict->SetInteger("integer", 5);
64 dict->SetString("key", "value"); 64 dict->SetString("key", "value");
65 expected.Append(dict); 65 expected.Append(dict);
66 } 66 }
67 67
68 EXPECT_TRUE(base::Value::Equals( 68 EXPECT_TRUE(base::Value::Equals(
69 ReturnAdditionalProperties::Results::Create(result_object).get(), 69 ReturnAdditionalProperties::Results::Create(result_object).get(),
70 &expected)); 70 &expected));
71 } 71 }
OLDNEW
« no previous file with comments | « no previous file | tools/json_schema_compiler/test/arrays_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698