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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "tools/json_schema_compiler/test/additional_properties.h" | 6 #include "tools/json_schema_compiler/test/additional_properties.h" |
7 | 7 |
8 using namespace test::api::additional_properties; | 8 using namespace test::api::additional_properties; |
9 | 9 |
10 TEST(JsonSchemaCompilerAdditionalPropertiesTest, | 10 TEST(JsonSchemaCompilerAdditionalPropertiesTest, |
11 AdditionalPropertiesTypePopulate) { | 11 AdditionalPropertiesTypePopulate) { |
12 { | 12 { |
13 scoped_ptr<base::ListValue> list_value(new base::ListValue()); | 13 scoped_ptr<base::ListValue> list_value(new base::ListValue()); |
14 list_value->Append(base::Value::CreateStringValue("asdf")); | 14 list_value->Append(new base::StringValue("asdf")); |
15 list_value->Append(new base::FundamentalValue(4)); | 15 list_value->Append(new base::FundamentalValue(4)); |
16 scoped_ptr<base::DictionaryValue> type_value(new base::DictionaryValue()); | 16 scoped_ptr<base::DictionaryValue> type_value(new base::DictionaryValue()); |
17 type_value->SetString("string", "value"); | 17 type_value->SetString("string", "value"); |
18 type_value->SetInteger("other", 9); | 18 type_value->SetInteger("other", 9); |
19 type_value->Set("another", list_value.release()); | 19 type_value->Set("another", list_value.release()); |
20 scoped_ptr<AdditionalPropertiesType> type(new AdditionalPropertiesType()); | 20 scoped_ptr<AdditionalPropertiesType> type(new AdditionalPropertiesType()); |
21 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get())); | 21 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get())); |
22 EXPECT_TRUE(type->additional_properties.Equals(type_value.get())); | 22 EXPECT_TRUE(type->additional_properties.Equals(type_value.get())); |
23 } | 23 } |
24 { | 24 { |
(...skipping 30 matching lines...) Expand all Loading... |
55 base::DictionaryValue* dict = new base::DictionaryValue(); | 55 base::DictionaryValue* dict = new base::DictionaryValue(); |
56 dict->SetInteger("integer", 5); | 56 dict->SetInteger("integer", 5); |
57 dict->SetString("key", "value"); | 57 dict->SetString("key", "value"); |
58 expected.Append(dict); | 58 expected.Append(dict); |
59 } | 59 } |
60 | 60 |
61 EXPECT_TRUE(base::Value::Equals( | 61 EXPECT_TRUE(base::Value::Equals( |
62 ReturnAdditionalProperties::Results::Create(result_object).get(), | 62 ReturnAdditionalProperties::Results::Create(result_object).get(), |
63 &expected)); | 63 &expected)); |
64 } | 64 } |
OLD | NEW |