| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |