| 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/simple_api.h" | 5 #include "tools/json_schema_compiler/test/simple_api.h" |
| 6 #include "tools/json_schema_compiler/test/crossref.h" | 6 #include "tools/json_schema_compiler/test/crossref.h" |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using namespace test::api::crossref; | 10 using namespace test::api::crossref; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 TestTypeOptionalParam::Params::Create(*params_value)); | 53 TestTypeOptionalParam::Params::Create(*params_value)); |
| 54 EXPECT_FALSE(params.get()); | 54 EXPECT_FALSE(params.get()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 TEST(JsonSchemaCompilerCrossrefTest, GetTestType) { | 57 TEST(JsonSchemaCompilerCrossrefTest, GetTestType) { |
| 58 scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary(); | 58 scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary(); |
| 59 scoped_ptr<test::api::simple_api::TestType> test_type( | 59 scoped_ptr<test::api::simple_api::TestType> test_type( |
| 60 new test::api::simple_api::TestType()); | 60 new test::api::simple_api::TestType()); |
| 61 EXPECT_TRUE( | 61 EXPECT_TRUE( |
| 62 test::api::simple_api::TestType::Populate(*value, test_type.get())); | 62 test::api::simple_api::TestType::Populate(*value, test_type.get())); |
| 63 scoped_ptr<Value> result(GetTestType::Result::Create(*test_type)); | 63 |
| 64 EXPECT_TRUE(value->Equals(result.get())); | 64 scoped_ptr<ListValue> results = GetTestType::Results::Create(*test_type); |
| 65 DictionaryValue* result_dict = NULL; |
| 66 results->GetDictionary(0, &result_dict); |
| 67 EXPECT_TRUE(value->Equals(result_dict)); |
| 65 } | 68 } |
| 66 | 69 |
| 67 TEST(JsonSchemaCompilerCrossrefTest, TestTypeInObjectParamsCreate) { | 70 TEST(JsonSchemaCompilerCrossrefTest, TestTypeInObjectParamsCreate) { |
| 68 { | 71 { |
| 69 scoped_ptr<ListValue> params_value(new ListValue()); | 72 scoped_ptr<ListValue> params_value(new ListValue()); |
| 70 scoped_ptr<DictionaryValue> param_object_value(new DictionaryValue()); | 73 scoped_ptr<DictionaryValue> param_object_value(new DictionaryValue()); |
| 71 param_object_value->Set("testType", CreateTestTypeDictionary().release()); | 74 param_object_value->Set("testType", CreateTestTypeDictionary().release()); |
| 72 param_object_value->Set("boolean", Value::CreateBooleanValue(true)); | 75 param_object_value->Set("boolean", Value::CreateBooleanValue(true)); |
| 73 params_value->Append(param_object_value.release()); | 76 params_value->Append(param_object_value.release()); |
| 74 scoped_ptr<TestTypeInObject::Params> params( | 77 scoped_ptr<TestTypeInObject::Params> params( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 103 { | 106 { |
| 104 scoped_ptr<ListValue> params_value(new ListValue()); | 107 scoped_ptr<ListValue> params_value(new ListValue()); |
| 105 scoped_ptr<DictionaryValue> param_object_value(new DictionaryValue()); | 108 scoped_ptr<DictionaryValue> param_object_value(new DictionaryValue()); |
| 106 param_object_value->Set("testType", CreateTestTypeDictionary().release()); | 109 param_object_value->Set("testType", CreateTestTypeDictionary().release()); |
| 107 params_value->Append(param_object_value.release()); | 110 params_value->Append(param_object_value.release()); |
| 108 scoped_ptr<TestTypeInObject::Params> params( | 111 scoped_ptr<TestTypeInObject::Params> params( |
| 109 TestTypeInObject::Params::Create(*params_value)); | 112 TestTypeInObject::Params::Create(*params_value)); |
| 110 EXPECT_FALSE(params.get()); | 113 EXPECT_FALSE(params.get()); |
| 111 } | 114 } |
| 112 } | 115 } |
| OLD | NEW |