| Index: tools/json_schema_compiler/test/simple_api_unittest.cc
|
| diff --git a/tools/json_schema_compiler/test/simple_api_unittest.cc b/tools/json_schema_compiler/test/simple_api_unittest.cc
|
| index bce18384b1f17ecb794edad4ec94db6837769f39..f34b9fc258201e02554b59bebe55119e846f29ea 100644
|
| --- a/tools/json_schema_compiler/test/simple_api_unittest.cc
|
| +++ b/tools/json_schema_compiler/test/simple_api_unittest.cc
|
| @@ -10,27 +10,31 @@ using namespace test::api::simple_api;
|
|
|
| namespace {
|
|
|
| -static scoped_ptr<DictionaryValue> CreateTestTypeDictionary() {
|
| - scoped_ptr<DictionaryValue> value(new DictionaryValue());
|
| - value->SetWithoutPathExpansion("number", Value::CreateDoubleValue(1.1));
|
| - value->SetWithoutPathExpansion("integer", Value::CreateIntegerValue(4));
|
| - value->SetWithoutPathExpansion("string", Value::CreateStringValue("bling"));
|
| - value->SetWithoutPathExpansion("boolean", Value::CreateBooleanValue(true));
|
| +static scoped_ptr<base::DictionaryValue> CreateTestTypeDictionary() {
|
| + scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
|
| + value->SetWithoutPathExpansion("number",
|
| + base::Value::CreateDoubleValue(1.1));
|
| + value->SetWithoutPathExpansion("integer",
|
| + base::Value::CreateIntegerValue(4));
|
| + value->SetWithoutPathExpansion("string",
|
| + base::Value::CreateStringValue("bling"));
|
| + value->SetWithoutPathExpansion("boolean",
|
| + base::Value::CreateBooleanValue(true));
|
| return value.Pass();
|
| }
|
|
|
| } // namespace
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, IncrementIntegerResultCreate) {
|
| - scoped_ptr<ListValue> results = IncrementInteger::Results::Create(5);
|
| - ListValue expected;
|
| - expected.Append(Value::CreateIntegerValue(5));
|
| + scoped_ptr<base::ListValue> results = IncrementInteger::Results::Create(5);
|
| + base::ListValue expected;
|
| + expected.Append(base::Value::CreateIntegerValue(5));
|
| EXPECT_TRUE(results->Equals(&expected));
|
| }
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, IncrementIntegerParamsCreate) {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| - params_value->Append(Value::CreateIntegerValue(6));
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| + params_value->Append(base::Value::CreateIntegerValue(6));
|
| scoped_ptr<IncrementInteger::Params> params(
|
| IncrementInteger::Params::Create(*params_value));
|
| EXPECT_TRUE(params.get());
|
| @@ -39,15 +43,15 @@ TEST(JsonSchemaCompilerSimpleTest, IncrementIntegerParamsCreate) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, NumberOfParams) {
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| - params_value->Append(Value::CreateStringValue("text"));
|
| - params_value->Append(Value::CreateStringValue("text"));
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| + params_value->Append(base::Value::CreateStringValue("text"));
|
| + params_value->Append(base::Value::CreateStringValue("text"));
|
| scoped_ptr<OptionalString::Params> params(
|
| OptionalString::Params::Create(*params_value));
|
| EXPECT_FALSE(params.get());
|
| }
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| scoped_ptr<IncrementInteger::Params> params(
|
| IncrementInteger::Params::Create(*params_value));
|
| EXPECT_FALSE(params.get());
|
| @@ -56,15 +60,15 @@ TEST(JsonSchemaCompilerSimpleTest, NumberOfParams) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, OptionalStringParamsCreate) {
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| scoped_ptr<OptionalString::Params> params(
|
| OptionalString::Params::Create(*params_value));
|
| EXPECT_TRUE(params.get());
|
| EXPECT_FALSE(params->str.get());
|
| }
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| - params_value->Append(Value::CreateStringValue("asdf"));
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| + params_value->Append(base::Value::CreateStringValue("asdf"));
|
| scoped_ptr<OptionalString::Params> params(
|
| OptionalString::Params::Create(*params_value));
|
| EXPECT_TRUE(params.get());
|
| @@ -75,8 +79,8 @@ TEST(JsonSchemaCompilerSimpleTest, OptionalStringParamsCreate) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, OptionalParamsTakingNull) {
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| - params_value->Append(Value::CreateNullValue());
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| + params_value->Append(base::Value::CreateNullValue());
|
| scoped_ptr<OptionalString::Params> params(
|
| OptionalString::Params::Create(*params_value));
|
| EXPECT_TRUE(params.get());
|
| @@ -86,8 +90,8 @@ TEST(JsonSchemaCompilerSimpleTest, OptionalParamsTakingNull) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, OptionalStringParamsWrongType) {
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| - params_value->Append(Value::CreateIntegerValue(5));
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| + params_value->Append(base::Value::CreateIntegerValue(5));
|
| scoped_ptr<OptionalString::Params> params(
|
| OptionalString::Params::Create(*params_value));
|
| EXPECT_FALSE(params.get());
|
| @@ -96,9 +100,9 @@ TEST(JsonSchemaCompilerSimpleTest, OptionalStringParamsWrongType) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, OptionalBeforeRequired) {
|
| {
|
| - scoped_ptr<ListValue> params_value(new ListValue());
|
| - params_value->Append(Value::CreateNullValue());
|
| - params_value->Append(Value::CreateStringValue("asdf"));
|
| + scoped_ptr<base::ListValue> params_value(new base::ListValue());
|
| + params_value->Append(base::Value::CreateNullValue());
|
| + params_value->Append(base::Value::CreateStringValue("asdf"));
|
| scoped_ptr<OptionalBeforeRequired::Params> params(
|
| OptionalBeforeRequired::Params::Create(*params_value));
|
| EXPECT_TRUE(params.get());
|
| @@ -108,15 +112,15 @@ TEST(JsonSchemaCompilerSimpleTest, OptionalBeforeRequired) {
|
| }
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, NoParamsResultCreate) {
|
| - scoped_ptr<ListValue> results = OptionalString::Results::Create();
|
| - ListValue expected;
|
| + scoped_ptr<base::ListValue> results = OptionalString::Results::Create();
|
| + base::ListValue expected;
|
| EXPECT_TRUE(results->Equals(&expected));
|
| }
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, TestTypePopulate) {
|
| {
|
| scoped_ptr<TestType> test_type(new TestType());
|
| - scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary();
|
| + scoped_ptr<base::DictionaryValue> value = CreateTestTypeDictionary();
|
| EXPECT_TRUE(TestType::Populate(*value, test_type.get()));
|
| EXPECT_EQ("bling", test_type->string);
|
| EXPECT_EQ(1.1, test_type->number);
|
| @@ -126,7 +130,7 @@ TEST(JsonSchemaCompilerSimpleTest, TestTypePopulate) {
|
| }
|
| {
|
| scoped_ptr<TestType> test_type(new TestType());
|
| - scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary();
|
| + scoped_ptr<base::DictionaryValue> value = CreateTestTypeDictionary();
|
| value->Remove("number", NULL);
|
| EXPECT_FALSE(TestType::Populate(*value, test_type.get()));
|
| }
|
| @@ -134,12 +138,13 @@ TEST(JsonSchemaCompilerSimpleTest, TestTypePopulate) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, GetTestType) {
|
| {
|
| - scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary();
|
| + scoped_ptr<base::DictionaryValue> value = CreateTestTypeDictionary();
|
| scoped_ptr<TestType> test_type(new TestType());
|
| EXPECT_TRUE(TestType::Populate(*value, test_type.get()));
|
| - scoped_ptr<ListValue> results = GetTestType::Results::Create(*test_type);
|
| + scoped_ptr<base::ListValue> results =
|
| + GetTestType::Results::Create(*test_type);
|
|
|
| - DictionaryValue* result = NULL;
|
| + base::DictionaryValue* result = NULL;
|
| results->GetDictionary(0, &result);
|
| EXPECT_TRUE(result->Equals(value.get()));
|
| }
|
| @@ -147,18 +152,18 @@ TEST(JsonSchemaCompilerSimpleTest, GetTestType) {
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, OnIntegerFiredCreate) {
|
| {
|
| - scoped_ptr<ListValue> results(OnIntegerFired::Create(5));
|
| - ListValue expected;
|
| - expected.Append(Value::CreateIntegerValue(5));
|
| + scoped_ptr<base::ListValue> results(OnIntegerFired::Create(5));
|
| + base::ListValue expected;
|
| + expected.Append(base::Value::CreateIntegerValue(5));
|
| EXPECT_TRUE(results->Equals(&expected));
|
| }
|
| }
|
|
|
| TEST(JsonSchemaCompilerSimpleTest, OnStringFiredCreate) {
|
| {
|
| - scoped_ptr<ListValue> results(OnStringFired::Create("yo dawg"));
|
| - ListValue expected;
|
| - expected.Append(Value::CreateStringValue("yo dawg"));
|
| + scoped_ptr<base::ListValue> results(OnStringFired::Create("yo dawg"));
|
| + base::ListValue expected;
|
| + expected.Append(base::Value::CreateStringValue("yo dawg"));
|
| EXPECT_TRUE(results->Equals(&expected));
|
| }
|
| }
|
| @@ -166,14 +171,15 @@ TEST(JsonSchemaCompilerSimpleTest, OnStringFiredCreate) {
|
| TEST(JsonSchemaCompilerSimpleTest, OnTestTypeFiredCreate) {
|
| {
|
| TestType some_test_type;
|
| - scoped_ptr<DictionaryValue> expected = CreateTestTypeDictionary();
|
| + scoped_ptr<base::DictionaryValue> expected = CreateTestTypeDictionary();
|
| ASSERT_TRUE(expected->GetDouble("number", &some_test_type.number));
|
| ASSERT_TRUE(expected->GetString("string", &some_test_type.string));
|
| ASSERT_TRUE(expected->GetInteger("integer", &some_test_type.integer));
|
| ASSERT_TRUE(expected->GetBoolean("boolean", &some_test_type.boolean));
|
|
|
| - scoped_ptr<ListValue> results(OnTestTypeFired::Create(some_test_type));
|
| - DictionaryValue* result = NULL;
|
| + scoped_ptr<base::ListValue> results(
|
| + OnTestTypeFired::Create(some_test_type));
|
| + base::DictionaryValue* result = NULL;
|
| results->GetDictionary(0, &result);
|
| EXPECT_TRUE(result->Equals(expected.get()));
|
| }
|
|
|