Index: tools/json_schema_compiler/test/functions_on_types_unittest.cc |
diff --git a/tools/json_schema_compiler/test/functions_on_types_unittest.cc b/tools/json_schema_compiler/test/functions_on_types_unittest.cc |
index 73a3cf20cb17f1d7906cfbaf0bfb14012b0039ed..eefdadb23e7ae01dc1129b07d185392b1278ed99 100644 |
--- a/tools/json_schema_compiler/test/functions_on_types_unittest.cc |
+++ b/tools/json_schema_compiler/test/functions_on_types_unittest.cc |
@@ -2,10 +2,12 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "tools/json_schema_compiler/test/functions_on_types.h" |
- |
+#include "base/values.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "tools/json_schema_compiler/test/functions_on_types.h" |
+#include "tools/json_schema_compiler/test/test_util.h" |
+using json_schema_compiler::test_util::ValueMapToDictionary; |
using namespace test::api::functions_on_types; |
TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) { |
@@ -13,24 +15,24 @@ TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) { |
scoped_ptr<ListValue> params_value(new ListValue()); |
scoped_ptr<StorageArea::Get::Params> params( |
StorageArea::Get::Params::Create(*params_value)); |
- EXPECT_TRUE(params.get()); |
- EXPECT_EQ(StorageArea::Get::Params::KEYS_NONE, params->keys_type); |
+ ASSERT_TRUE(params); |
+ EXPECT_FALSE(params->keys); |
} |
{ |
scoped_ptr<ListValue> params_value(new ListValue()); |
params_value->Append(Value::CreateIntegerValue(9)); |
scoped_ptr<StorageArea::Get::Params> params( |
StorageArea::Get::Params::Create(*params_value)); |
- EXPECT_FALSE(params.get()); |
+ EXPECT_FALSE(params); |
} |
{ |
scoped_ptr<ListValue> params_value(new ListValue()); |
params_value->Append(Value::CreateStringValue("test")); |
scoped_ptr<StorageArea::Get::Params> params( |
StorageArea::Get::Params::Create(*params_value)); |
- EXPECT_TRUE(params.get()); |
- EXPECT_EQ(StorageArea::Get::Params::KEYS_STRING, params->keys_type); |
- EXPECT_EQ("test", *params->keys_string); |
+ ASSERT_TRUE(params); |
+ ASSERT_TRUE(params->keys); |
+ EXPECT_EQ("test", *params->keys->as_string); |
} |
{ |
scoped_ptr<DictionaryValue> keys_object_value(new DictionaryValue()); |
@@ -40,21 +42,27 @@ TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) { |
params_value->Append(keys_object_value->DeepCopy()); |
scoped_ptr<StorageArea::Get::Params> params( |
StorageArea::Get::Params::Create(*params_value)); |
- EXPECT_TRUE(params.get()); |
- EXPECT_EQ(StorageArea::Get::Params::KEYS_OBJECT, params->keys_type); |
- EXPECT_TRUE( |
- keys_object_value->Equals(¶ms->keys_object->additional_properties)); |
+ ASSERT_TRUE(params); |
+ ASSERT_TRUE(params->keys); |
+ EXPECT_TRUE(Value::Equals( |
+ keys_object_value.get(), |
+ ValueMapToDictionary(params->keys->as_object->additional_properties) |
+ .get())); |
} |
} |
TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetResultCreate) { |
StorageArea::Get::Results::Items items; |
- items.additional_properties.SetDouble("asdf", 0.1); |
- items.additional_properties.SetString("sdfg", "zxcv"); |
+ items.additional_properties["asdf"] = |
+ linked_ptr<base::Value>(new base::FundamentalValue(0.1)); |
+ items.additional_properties["sdfg"] = |
+ linked_ptr<base::Value>(new base::StringValue("zxcv")); |
scoped_ptr<ListValue> results = StorageArea::Get::Results::Create(items); |
DictionaryValue* item_result = NULL; |
results->GetDictionary(0, &item_result); |
- EXPECT_TRUE(item_result->Equals(&items.additional_properties)); |
+ EXPECT_TRUE(Value::Equals( |
+ item_result, |
+ ValueMapToDictionary(items.additional_properties).get())); |
} |
TEST(JsonSchemaCompilerFunctionsOnTypesTest, ChromeSettingGetParamsCreate) { |