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

Side by Side Diff: tools/json_schema_compiler/test/additional_properties_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 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 "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 #include <utility> 8 #include <utility>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 using namespace test::api::additional_properties; 12 using namespace test::api::additional_properties;
13 13
14 TEST(JsonSchemaCompilerAdditionalPropertiesTest, 14 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
15 AdditionalPropertiesTypePopulate) { 15 AdditionalPropertiesTypePopulate) {
16 { 16 {
17 std::unique_ptr<base::ListValue> list_value(new base::ListValue()); 17 std::unique_ptr<base::ListValue> list_value(new base::ListValue());
18 list_value->AppendString("asdf"); 18 list_value->AppendString("asdf");
19 list_value->AppendInteger(4); 19 list_value->AppendInteger(4);
20 std::unique_ptr<base::DictionaryValue> type_value( 20 std::unique_ptr<base::DictionaryValue> type_value(
21 new base::DictionaryValue()); 21 new base::DictionaryValue());
22 type_value->SetString("string", "value"); 22 type_value->SetString("string", "value");
23 type_value->SetInteger("other", 9); 23 type_value->SetInteger("other", 9);
24 type_value->Set("another", list_value.release()); 24 type_value->Set("another", std::move(list_value));
25 std::unique_ptr<AdditionalPropertiesType> type( 25 std::unique_ptr<AdditionalPropertiesType> type(
26 new AdditionalPropertiesType()); 26 new AdditionalPropertiesType());
27 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get())); 27 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get()));
28 EXPECT_TRUE(type->additional_properties.Equals(type_value.get())); 28 EXPECT_TRUE(type->additional_properties.Equals(type_value.get()));
29 } 29 }
30 { 30 {
31 std::unique_ptr<base::DictionaryValue> type_value( 31 std::unique_ptr<base::DictionaryValue> type_value(
32 new base::DictionaryValue()); 32 new base::DictionaryValue());
33 type_value->SetInteger("string", 3); 33 type_value->SetInteger("string", 3);
34 std::unique_ptr<AdditionalPropertiesType> type( 34 std::unique_ptr<AdditionalPropertiesType> type(
(...skipping 28 matching lines...) Expand all
63 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 63 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
64 dict->SetInteger("integer", 5); 64 dict->SetInteger("integer", 5);
65 dict->SetString("key", "value"); 65 dict->SetString("key", "value");
66 expected.Append(std::move(dict)); 66 expected.Append(std::move(dict));
67 } 67 }
68 68
69 EXPECT_TRUE(base::Value::Equals( 69 EXPECT_TRUE(base::Value::Equals(
70 ReturnAdditionalProperties::Results::Create(result_object).get(), 70 ReturnAdditionalProperties::Results::Create(result_object).get(),
71 &expected)); 71 &expected));
72 } 72 }
OLDNEW
« no previous file with comments | « third_party/dom_distiller_js/test_sample_json_converter.h.golden ('k') | tools/json_schema_compiler/test/arrays_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698