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

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

Issue 10701012: JSON Schema Compiler: Added event compilation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. Created 8 years, 5 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/any.json ('k') | tools/json_schema_compiler/test/callbacks.json » ('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 070967779a8a52936ba514220ec6743380a44006..c6d1e0630786915816395971cb14a992355e7983 100644
--- a/tools/json_schema_compiler/test/arrays_unittest.cc
+++ b/tools/json_schema_compiler/test/arrays_unittest.cc
@@ -194,15 +194,14 @@ TEST(JsonSchemaCompilerArrayTest, ReturnIntegerArrayResultCreate) {
std::vector<int> integers;
integers.push_back(1);
integers.push_back(2);
- scoped_ptr<Value> result(ReturnIntegerArray::Result::Create(integers));
- ListValue* list = NULL;
- EXPECT_TRUE(result->GetAsList(&list));
- int temp;
- ASSERT_EQ(2u, list->GetSize());
- EXPECT_TRUE(list->GetInteger(0, &temp));
- EXPECT_EQ(1, temp);
- EXPECT_TRUE(list->GetInteger(1, &temp));
- EXPECT_EQ(2, temp);
+ scoped_ptr<ListValue> results = ReturnIntegerArray::Results::Create(integers);
+
+ ListValue expected;
+ ListValue* expected_argument = new ListValue();
+ expected_argument->Append(Value::CreateIntegerValue(1));
+ expected_argument->Append(Value::CreateIntegerValue(2));
+ expected.Append(expected_argument);
+ EXPECT_TRUE(results->Equals(&expected));
}
TEST(JsonSchemaCompilerArrayTest, ReturnRefArrayResultCreate) {
@@ -211,16 +210,16 @@ TEST(JsonSchemaCompilerArrayTest, ReturnRefArrayResultCreate) {
items.push_back(linked_ptr<Item>(new Item()));
items[0]->val = 1;
items[1]->val = 2;
- scoped_ptr<Value> result(ReturnRefArray::Result::Create(items));
- ListValue* list = NULL;
- EXPECT_TRUE(result->GetAsList(&list));
- ASSERT_EQ(2u, list->GetSize());
- DictionaryValue* item_value = NULL;
- int temp;
- EXPECT_TRUE(list->GetDictionary(0, &item_value));
- EXPECT_TRUE(item_value->GetInteger("val", &temp));
- EXPECT_EQ(1, temp);
- EXPECT_TRUE(list->GetDictionary(1, &item_value));
- EXPECT_TRUE(item_value->GetInteger("val", &temp));
- EXPECT_EQ(2, temp);
+ scoped_ptr<ListValue> results = ReturnRefArray::Results::Create(items);
+
+ ListValue expected;
+ ListValue* expected_argument = new ListValue();
+ DictionaryValue* first = new DictionaryValue();
+ first->SetInteger("val", 1);
+ expected_argument->Append(first);
+ DictionaryValue* second = new DictionaryValue();
+ second->SetInteger("val", 2);
+ expected_argument->Append(second);
+ expected.Append(expected_argument);
+ EXPECT_TRUE(results->Equals(&expected));
}
« no previous file with comments | « tools/json_schema_compiler/test/any.json ('k') | tools/json_schema_compiler/test/callbacks.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698