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/arrays.h" | 5 #include "tools/json_schema_compiler/test/arrays.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "tools/json_schema_compiler/test/enums.h" | 8 #include "tools/json_schema_compiler/test/enums.h" |
9 | 9 |
10 using namespace test::api::arrays; | 10 using namespace test::api::arrays; |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // TODO(calamity): Change to AppendString etc once kalman's patch goes through | 14 // TODO(calamity): Change to AppendString etc once kalman's patch goes through |
15 static scoped_ptr<base::DictionaryValue> CreateBasicArrayTypeDictionary() { | 15 static scoped_ptr<base::DictionaryValue> CreateBasicArrayTypeDictionary() { |
16 base::DictionaryValue* value = new base::DictionaryValue(); | 16 base::DictionaryValue* value = new base::DictionaryValue(); |
17 base::ListValue* strings_value = new base::ListValue(); | 17 base::ListValue* strings_value = new base::ListValue(); |
18 strings_value->Append(new base::StringValue("a")); | 18 strings_value->Append(new base::StringValue("a")); |
19 strings_value->Append(new base::StringValue("b")); | 19 strings_value->Append(new base::StringValue("b")); |
20 strings_value->Append(new base::StringValue("c")); | 20 strings_value->Append(new base::StringValue("c")); |
21 strings_value->Append(new base::StringValue("it's easy as")); | 21 strings_value->Append(new base::StringValue("it's easy as")); |
22 base::ListValue* integers_value = new base::ListValue(); | 22 base::ListValue* integers_value = new base::ListValue(); |
23 integers_value->Append(new base::FundamentalValue(1)); | 23 integers_value->Append(new base::FundamentalValue(1)); |
24 integers_value->Append(new base::FundamentalValue(2)); | 24 integers_value->Append(new base::FundamentalValue(2)); |
25 integers_value->Append(new base::FundamentalValue(3)); | 25 integers_value->Append(new base::FundamentalValue(3)); |
26 base::ListValue* booleans_value = new base::ListValue(); | 26 base::ListValue* booleans_value = new base::ListValue(); |
27 booleans_value->Append(new base::FundamentalValue(false)); | 27 booleans_value->Append(new base::FundamentalValue(false)); |
28 booleans_value->Append(new base::FundamentalValue(true)); | 28 booleans_value->Append(new base::FundamentalValue(true)); |
29 base::ListValue* numbers_value = new base::ListValue(); | 29 base::ListValue* numbers_value = new base::ListValue(); |
30 numbers_value->Append(base::Value::CreateDoubleValue(6.1)); | 30 numbers_value->Append(new base::FundamentalValue(6.1)); |
31 value->Set("numbers", numbers_value); | 31 value->Set("numbers", numbers_value); |
32 value->Set("booleans", booleans_value); | 32 value->Set("booleans", booleans_value); |
33 value->Set("strings", strings_value); | 33 value->Set("strings", strings_value); |
34 value->Set("integers", integers_value); | 34 value->Set("integers", integers_value); |
35 return scoped_ptr<base::DictionaryValue>(value); | 35 return scoped_ptr<base::DictionaryValue>(value); |
36 } | 36 } |
37 | 37 |
38 static base::Value* CreateItemValue(int val) { | 38 static base::Value* CreateItemValue(int val) { |
39 base::DictionaryValue* value(new base::DictionaryValue()); | 39 base::DictionaryValue* value(new base::DictionaryValue()); |
40 value->Set("val", new base::FundamentalValue(val)); | 40 value->Set("val", new base::FundamentalValue(val)); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 base::ListValue* expected_argument = new base::ListValue(); | 308 base::ListValue* expected_argument = new base::ListValue(); |
309 base::DictionaryValue* first = new base::DictionaryValue(); | 309 base::DictionaryValue* first = new base::DictionaryValue(); |
310 first->SetInteger("val", 1); | 310 first->SetInteger("val", 1); |
311 expected_argument->Append(first); | 311 expected_argument->Append(first); |
312 base::DictionaryValue* second = new base::DictionaryValue(); | 312 base::DictionaryValue* second = new base::DictionaryValue(); |
313 second->SetInteger("val", 2); | 313 second->SetInteger("val", 2); |
314 expected_argument->Append(second); | 314 expected_argument->Append(second); |
315 expected.Append(expected_argument); | 315 expected.Append(expected_argument); |
316 EXPECT_TRUE(results->Equals(&expected)); | 316 EXPECT_TRUE(results->Equals(&expected)); |
317 } | 317 } |
OLD | NEW |