Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1126)

Unified Diff: tools/json_schema_compiler/test/arrays_unittest.cc

Issue 11827026: Overhaul JSON Schema Compiler to support a number of features required to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/test/arrays.json ('k') | tools/json_schema_compiler/test/choices_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/test/arrays_unittest.cc
diff --git a/tools/json_schema_compiler/test/arrays_unittest.cc b/tools/json_schema_compiler/test/arrays_unittest.cc
index c6d1e0630786915816395971cb14a992355e7983..e480c8e0360feb493241f8746a63f8051be43375 100644
--- a/tools/json_schema_compiler/test/arrays_unittest.cc
+++ b/tools/json_schema_compiler/test/arrays_unittest.cc
@@ -46,45 +46,47 @@ TEST(JsonSchemaCompilerArrayTest, BasicArrayType) {
{
scoped_ptr<DictionaryValue> value = CreateBasicArrayTypeDictionary();
scoped_ptr<BasicArrayType> basic_array_type(new BasicArrayType());
- EXPECT_TRUE(BasicArrayType::Populate(*value, basic_array_type.get()));
+ ASSERT_TRUE(BasicArrayType::Populate(*value, basic_array_type.get()));
EXPECT_TRUE(value->Equals(basic_array_type->ToValue().get()));
}
}
TEST(JsonSchemaCompilerArrayTest, EnumArrayType) {
- std::vector<EnumArrayType::TypesElement> enums;
- enums.push_back(EnumArrayType::TYPES_ELEMENT_ONE);
- enums.push_back(EnumArrayType::TYPES_ELEMENT_TWO);
- enums.push_back(EnumArrayType::TYPES_ELEMENT_THREE);
+ std::vector<EnumArrayType::TypesType> enums;
+ enums.push_back(EnumArrayType::TYPES_TYPE_ONE);
+ enums.push_back(EnumArrayType::TYPES_TYPE_TWO);
+ enums.push_back(EnumArrayType::TYPES_TYPE_THREE);
scoped_ptr<ListValue> types(new ListValue());
for (size_t i = 0; i < enums.size(); ++i)
- types->Append(EnumArrayType::CreateEnumValue(enums[i]).release());
+ types->Append(new base::StringValue(EnumArrayType::ToString(enums[i])));
DictionaryValue value;
value.Set("types", types.release());
EnumArrayType enum_array_type;
- EXPECT_TRUE(EnumArrayType::Populate(value, &enum_array_type));
+ ASSERT_TRUE(EnumArrayType::Populate(value, &enum_array_type));
EXPECT_EQ(enums, enum_array_type.types);
}
TEST(JsonSchemaCompilerArrayTest, OptionalEnumArrayType) {
{
- std::vector<OptionalEnumArrayType::TypesElement> enums;
- enums.push_back(OptionalEnumArrayType::TYPES_ELEMENT_ONE);
- enums.push_back(OptionalEnumArrayType::TYPES_ELEMENT_TWO);
- enums.push_back(OptionalEnumArrayType::TYPES_ELEMENT_THREE);
+ std::vector<OptionalEnumArrayType::TypesType> enums;
+ enums.push_back(OptionalEnumArrayType::TYPES_TYPE_ONE);
+ enums.push_back(OptionalEnumArrayType::TYPES_TYPE_TWO);
+ enums.push_back(OptionalEnumArrayType::TYPES_TYPE_THREE);
scoped_ptr<ListValue> types(new ListValue());
- for (size_t i = 0; i < enums.size(); ++i)
- types->Append(OptionalEnumArrayType::CreateEnumValue(enums[i]).release());
+ for (size_t i = 0; i < enums.size(); ++i) {
+ types->Append(new base::StringValue(
+ OptionalEnumArrayType::ToString(enums[i])));
+ }
DictionaryValue value;
value.Set("types", types.release());
OptionalEnumArrayType enum_array_type;
- EXPECT_TRUE(OptionalEnumArrayType::Populate(value, &enum_array_type));
+ ASSERT_TRUE(OptionalEnumArrayType::Populate(value, &enum_array_type));
EXPECT_EQ(enums, *enum_array_type.types);
}
{
@@ -94,7 +96,7 @@ TEST(JsonSchemaCompilerArrayTest, OptionalEnumArrayType) {
value.Set("types", enum_array.release());
OptionalEnumArrayType enum_array_type;
- EXPECT_FALSE(OptionalEnumArrayType::Populate(value, &enum_array_type));
+ ASSERT_FALSE(OptionalEnumArrayType::Populate(value, &enum_array_type));
EXPECT_TRUE(enum_array_type.types->empty());
}
}
@@ -153,7 +155,7 @@ TEST(JsonSchemaCompilerArrayTest, AnyArrayParamsCreate) {
EXPECT_TRUE(params.get());
ASSERT_EQ(3u, params->anys.size());
int int_temp = 0;
- EXPECT_TRUE(params->anys[0]->value().GetAsInteger(&int_temp));
+ EXPECT_TRUE(params->anys[0]->GetAsInteger(&int_temp));
EXPECT_EQ(1, int_temp);
}
@@ -167,13 +169,8 @@ TEST(JsonSchemaCompilerArrayTest, ObjectArrayParamsCreate) {
ObjectArray::Params::Create(*params_value));
EXPECT_TRUE(params.get());
ASSERT_EQ(2u, params->objects.size());
- int object_val = 0;
- EXPECT_TRUE(params->objects[0]->additional_properties.GetInteger(
- "val", &object_val));
- EXPECT_EQ(1, object_val);
- EXPECT_TRUE(params->objects[1]->additional_properties.GetInteger(
- "val", &object_val));
- EXPECT_EQ(2, object_val);
+ EXPECT_EQ(1, params->objects[0]->additional_properties["val"]);
+ EXPECT_EQ(2, params->objects[1]->additional_properties["val"]);
}
TEST(JsonSchemaCompilerArrayTest, RefArrayParamsCreate) {
« no previous file with comments | « tools/json_schema_compiler/test/arrays.json ('k') | tools/json_schema_compiler/test/choices_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698