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/objects.h" | 5 #include "tools/json_schema_compiler/test/objects.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 using namespace test::api::objects; | 10 using namespace test::api::objects; |
(...skipping 30 matching lines...) Expand all Loading... |
41 scoped_ptr<base::ListValue> params_value(new base::ListValue()); | 41 scoped_ptr<base::ListValue> params_value(new base::ListValue()); |
42 params_value->Append(info_value.release()); | 42 params_value->Append(info_value.release()); |
43 scoped_ptr<ObjectParam::Params> params( | 43 scoped_ptr<ObjectParam::Params> params( |
44 ObjectParam::Params::Create(*params_value)); | 44 ObjectParam::Params::Create(*params_value)); |
45 EXPECT_FALSE(params.get()); | 45 EXPECT_FALSE(params.get()); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { | 49 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { |
50 ReturnsObject::Results::Info info; | 50 ReturnsObject::Results::Info info; |
51 info.state = ReturnsObject::Results::Info::STATE_FOO; | 51 info.state = FIRST_STATE_FOO; |
52 scoped_ptr<base::ListValue> results = ReturnsObject::Results::Create(info); | 52 scoped_ptr<base::ListValue> results = ReturnsObject::Results::Create(info); |
53 | 53 |
54 base::DictionaryValue expected; | 54 base::DictionaryValue expected; |
55 expected.SetString("state", "foo"); | 55 expected.SetString("state", "foo"); |
56 base::DictionaryValue* result = NULL; | 56 base::DictionaryValue* result = NULL; |
57 ASSERT_TRUE(results->GetDictionary(0, &result)); | 57 ASSERT_TRUE(results->GetDictionary(0, &result)); |
58 ASSERT_TRUE(result->Equals(&expected)); | 58 ASSERT_TRUE(result->Equals(&expected)); |
59 } | 59 } |
60 | 60 |
61 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) { | 61 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) { |
62 OnObjectFired::SomeObject object; | 62 OnObjectFired::SomeObject object; |
63 object.state = OnObjectFired::SomeObject::STATE_BAR; | 63 object.state = FIRST_STATE_BAR; |
64 scoped_ptr<base::ListValue> results(OnObjectFired::Create(object)); | 64 scoped_ptr<base::ListValue> results(OnObjectFired::Create(object)); |
65 | 65 |
66 base::DictionaryValue expected; | 66 base::DictionaryValue expected; |
67 expected.SetString("state", "bar"); | 67 expected.SetString("state", "bar"); |
68 base::DictionaryValue* result = NULL; | 68 base::DictionaryValue* result = NULL; |
69 ASSERT_TRUE(results->GetDictionary(0, &result)); | 69 ASSERT_TRUE(results->GetDictionary(0, &result)); |
70 ASSERT_TRUE(result->Equals(&expected)); | 70 ASSERT_TRUE(result->Equals(&expected)); |
71 } | 71 } |
OLD | NEW |