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/enums.h" | 5 #include "tools/json_schema_compiler/test/enums.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/test_util.h" | 8 #include "tools/json_schema_compiler/test/test_util.h" |
9 | 9 |
10 using namespace test::api::enums; | 10 using namespace test::api::enums; |
(...skipping 24 matching lines...) Expand all Loading... |
35 scoped_ptr<TakesEnumAsType::Params> params( | 35 scoped_ptr<TakesEnumAsType::Params> params( |
36 TakesEnumAsType::Params::Create(args)); | 36 TakesEnumAsType::Params::Create(args)); |
37 ASSERT_TRUE(params.get()); | 37 ASSERT_TRUE(params.get()); |
38 EXPECT_EQ(ENUMERATION_ONE, params->enumeration); | 38 EXPECT_EQ(ENUMERATION_ONE, params->enumeration); |
39 | 39 |
40 EXPECT_TRUE(args.Equals(ReturnsEnumAsType::Results::Create( | 40 EXPECT_TRUE(args.Equals(ReturnsEnumAsType::Results::Create( |
41 ENUMERATION_ONE).get())); | 41 ENUMERATION_ONE).get())); |
42 } | 42 } |
43 { | 43 { |
44 HasEnumeration enumeration; | 44 HasEnumeration enumeration; |
| 45 EXPECT_EQ(ENUMERATION_NONE, enumeration.enumeration); |
| 46 EXPECT_EQ(ENUMERATION_NONE, enumeration.optional_enumeration); |
| 47 } |
| 48 { |
| 49 HasEnumeration enumeration; |
45 base::DictionaryValue value; | 50 base::DictionaryValue value; |
46 ASSERT_FALSE(HasEnumeration::Populate(value, &enumeration)); | 51 ASSERT_FALSE(HasEnumeration::Populate(value, &enumeration)); |
47 | 52 |
48 value.Set("enumeration", base::Value::CreateStringValue("one")); | 53 value.Set("enumeration", base::Value::CreateStringValue("one")); |
49 ASSERT_TRUE(HasEnumeration::Populate(value, &enumeration)); | 54 ASSERT_TRUE(HasEnumeration::Populate(value, &enumeration)); |
50 EXPECT_TRUE(value.Equals(enumeration.ToValue().get())); | 55 EXPECT_TRUE(value.Equals(enumeration.ToValue().get())); |
51 | 56 |
52 value.Set("optional_enumeration", base::Value::CreateStringValue("two")); | 57 value.Set("optional_enumeration", base::Value::CreateStringValue("two")); |
53 ASSERT_TRUE(HasEnumeration::Populate(value, &enumeration)); | 58 ASSERT_TRUE(HasEnumeration::Populate(value, &enumeration)); |
54 EXPECT_TRUE(value.Equals(enumeration.ToValue().get())); | 59 EXPECT_TRUE(value.Equals(enumeration.ToValue().get())); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 { | 271 { |
267 scoped_ptr<base::Value> results(OnTwoEnumsFired::Create( | 272 scoped_ptr<base::Value> results(OnTwoEnumsFired::Create( |
268 OnTwoEnumsFired::FIRST_ENUM_FOO, | 273 OnTwoEnumsFired::FIRST_ENUM_FOO, |
269 OnTwoEnumsFired::SECOND_ENUM_HAM)); | 274 OnTwoEnumsFired::SECOND_ENUM_HAM)); |
270 base::ListValue expected; | 275 base::ListValue expected; |
271 expected.Append(base::Value::CreateStringValue("foo")); | 276 expected.Append(base::Value::CreateStringValue("foo")); |
272 expected.Append(base::Value::CreateStringValue("ham")); | 277 expected.Append(base::Value::CreateStringValue("ham")); |
273 EXPECT_TRUE(results->Equals(&expected)); | 278 EXPECT_TRUE(results->Equals(&expected)); |
274 } | 279 } |
275 } | 280 } |
OLD | NEW |