| 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 #include <utility> |
| 8 | 9 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 11 |
| 11 using namespace test::api::additional_properties; | 12 using namespace test::api::additional_properties; |
| 12 | 13 |
| 13 TEST(JsonSchemaCompilerAdditionalPropertiesTest, | 14 TEST(JsonSchemaCompilerAdditionalPropertiesTest, |
| 14 AdditionalPropertiesTypePopulate) { | 15 AdditionalPropertiesTypePopulate) { |
| 15 { | 16 { |
| 16 std::unique_ptr<base::ListValue> list_value(new base::ListValue()); | 17 std::unique_ptr<base::ListValue> list_value(new base::ListValue()); |
| 17 list_value->AppendString("asdf"); | 18 list_value->AppendString("asdf"); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 53 } |
| 53 | 54 |
| 54 TEST(JsonSchemaCompilerAdditionalPropertiesTest, | 55 TEST(JsonSchemaCompilerAdditionalPropertiesTest, |
| 55 ReturnAdditionalPropertiesResultCreate) { | 56 ReturnAdditionalPropertiesResultCreate) { |
| 56 ReturnAdditionalProperties::Results::ResultObject result_object; | 57 ReturnAdditionalProperties::Results::ResultObject result_object; |
| 57 result_object.integer = 5; | 58 result_object.integer = 5; |
| 58 result_object.additional_properties["key"] = "value"; | 59 result_object.additional_properties["key"] = "value"; |
| 59 | 60 |
| 60 base::ListValue expected; | 61 base::ListValue expected; |
| 61 { | 62 { |
| 62 base::DictionaryValue* dict = new base::DictionaryValue(); | 63 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 63 dict->SetInteger("integer", 5); | 64 dict->SetInteger("integer", 5); |
| 64 dict->SetString("key", "value"); | 65 dict->SetString("key", "value"); |
| 65 expected.Append(dict); | 66 expected.Append(std::move(dict)); |
| 66 } | 67 } |
| 67 | 68 |
| 68 EXPECT_TRUE(base::Value::Equals( | 69 EXPECT_TRUE(base::Value::Equals( |
| 69 ReturnAdditionalProperties::Results::Create(result_object).get(), | 70 ReturnAdditionalProperties::Results::Create(result_object).get(), |
| 70 &expected)); | 71 &expected)); |
| 71 } | 72 } |
| OLD | NEW |