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/choices.h" | 5 #include "tools/json_schema_compiler/test/choices.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "tools/json_schema_compiler/test/test_util.h" | 9 #include "tools/json_schema_compiler/test/test_util.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 using namespace test::api::choices; | 13 using namespace test::api::choices; |
14 using json_schema_compiler::test_util::Dictionary; | 14 using json_schema_compiler::test_util::Dictionary; |
15 using json_schema_compiler::test_util::List; | 15 using json_schema_compiler::test_util::List; |
16 using json_schema_compiler::test_util::ReadJson; | 16 using json_schema_compiler::test_util::ReadJson; |
17 using json_schema_compiler::test_util::Vector; | 17 using json_schema_compiler::test_util::Vector; |
18 | 18 |
19 TEST(JsonSchemaCompilerChoicesTest, TakesIntegersParamsCreate) { | 19 TEST(JsonSchemaCompilerChoicesTest, TakesIntegersParamsCreate) { |
20 { | 20 { |
21 scoped_ptr<TakesIntegers::Params> params(TakesIntegers::Params::Create( | 21 scoped_ptr<TakesIntegers::Params> params( |
22 *List(base::Value::CreateBooleanValue(true)))); | 22 TakesIntegers::Params::Create(*List(new base::FundamentalValue(true)))); |
23 EXPECT_FALSE(params); | 23 EXPECT_FALSE(params); |
24 } | 24 } |
25 { | 25 { |
26 scoped_ptr<TakesIntegers::Params> params( | 26 scoped_ptr<TakesIntegers::Params> params( |
27 TakesIntegers::Params::Create(*List(new base::FundamentalValue(6)))); | 27 TakesIntegers::Params::Create(*List(new base::FundamentalValue(6)))); |
28 ASSERT_TRUE(params); | 28 ASSERT_TRUE(params); |
29 EXPECT_FALSE(params->nums.as_integers); | 29 EXPECT_FALSE(params->nums.as_integers); |
30 EXPECT_EQ(6, *params->nums.as_integer); | 30 EXPECT_EQ(6, *params->nums.as_integer); |
31 } | 31 } |
32 { | 32 { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 obj->as_choice2->as_choice_types.get(); | 283 obj->as_choice2->as_choice_types.get(); |
284 // Bleh too much effort to test everything. | 284 // Bleh too much effort to test everything. |
285 ASSERT_EQ(2u, choice_types->size()); | 285 ASSERT_EQ(2u, choice_types->size()); |
286 } | 286 } |
287 | 287 |
288 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 288 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 } // namespace | 292 } // namespace |
OLD | NEW |