| 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 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 using namespace test::api::simple_api; | 9 using namespace test::api::simple_api; |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 static scoped_ptr<base::DictionaryValue> CreateTestTypeDictionary() { | 13 static scoped_ptr<base::DictionaryValue> CreateTestTypeDictionary() { |
| 14 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 14 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 15 value->SetWithoutPathExpansion("number", | 15 value->SetWithoutPathExpansion("number", |
| 16 base::Value::CreateDoubleValue(1.1)); | 16 base::Value::CreateDoubleValue(1.1)); |
| 17 value->SetWithoutPathExpansion("integer", | 17 value->SetWithoutPathExpansion("integer", |
| 18 base::Value::CreateIntegerValue(4)); | 18 base::Value::CreateIntegerValue(4)); |
| 19 value->SetWithoutPathExpansion("string", | 19 value->SetWithoutPathExpansion("string", |
| 20 base::Value::CreateStringValue("bling")); | 20 base::Value::CreateStringValue("bling")); |
| 21 value->SetWithoutPathExpansion("boolean", | 21 value->SetWithoutPathExpansion("boolean", new base::FundamentalValue(true)); |
| 22 base::Value::CreateBooleanValue(true)); | |
| 23 return value.Pass(); | 22 return value.Pass(); |
| 24 } | 23 } |
| 25 | 24 |
| 26 } // namespace | 25 } // namespace |
| 27 | 26 |
| 28 TEST(JsonSchemaCompilerSimpleTest, IncrementIntegerResultCreate) { | 27 TEST(JsonSchemaCompilerSimpleTest, IncrementIntegerResultCreate) { |
| 29 scoped_ptr<base::ListValue> results = IncrementInteger::Results::Create(5); | 28 scoped_ptr<base::ListValue> results = IncrementInteger::Results::Create(5); |
| 30 base::ListValue expected; | 29 base::ListValue expected; |
| 31 expected.Append(base::Value::CreateIntegerValue(5)); | 30 expected.Append(base::Value::CreateIntegerValue(5)); |
| 32 EXPECT_TRUE(results->Equals(&expected)); | 31 EXPECT_TRUE(results->Equals(&expected)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 ASSERT_TRUE(expected->GetInteger("integer", &some_test_type.integer)); | 176 ASSERT_TRUE(expected->GetInteger("integer", &some_test_type.integer)); |
| 178 ASSERT_TRUE(expected->GetBoolean("boolean", &some_test_type.boolean)); | 177 ASSERT_TRUE(expected->GetBoolean("boolean", &some_test_type.boolean)); |
| 179 | 178 |
| 180 scoped_ptr<base::ListValue> results( | 179 scoped_ptr<base::ListValue> results( |
| 181 OnTestTypeFired::Create(some_test_type)); | 180 OnTestTypeFired::Create(some_test_type)); |
| 182 base::DictionaryValue* result = NULL; | 181 base::DictionaryValue* result = NULL; |
| 183 results->GetDictionary(0, &result); | 182 results->GetDictionary(0, &result); |
| 184 EXPECT_TRUE(result->Equals(expected.get())); | 183 EXPECT_TRUE(result->Equals(expected.get())); |
| 185 } | 184 } |
| 186 } | 185 } |
| OLD | NEW |