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

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

Issue 10701012: JSON Schema Compiler: Added event compilation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reworked Create functions and lots of tests. 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
Index: tools/json_schema_compiler/test/objects_unittest.cc
diff --git a/tools/json_schema_compiler/test/objects_unittest.cc b/tools/json_schema_compiler/test/objects_unittest.cc
index b0ed54f1ceaf32d22635701e086d1dd7b514e933..e72e91e457d68d62a361f82d999e5063719d4cfb 100644
--- a/tools/json_schema_compiler/test/objects_unittest.cc
+++ b/tools/json_schema_compiler/test/objects_unittest.cc
@@ -46,14 +46,25 @@ TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) {
}
TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) {
- scoped_ptr<ReturnsObject::Result::Info> info(
- new ReturnsObject::Result::Info());
- info->state = ReturnsObject::Result::Info::STATE_FOO;
- scoped_ptr<Value> result_value(
- ReturnsObject::Result::Create(*info));
- DictionaryValue* result_dict = NULL;
- EXPECT_TRUE(result_value->GetAsDictionary(&result_dict));
- std::string state;
- EXPECT_TRUE(result_dict->GetString("state", &state));
- EXPECT_EQ("foo", state);
+ ReturnsObject::Result::Info info;
+ info.state = ReturnsObject::Result::Info::STATE_FOO;
+ scoped_ptr<ListValue> results(ReturnsObject::Result::Create(info));
+
+ DictionaryValue expected;
+ expected.SetString("state", "foo");
+ DictionaryValue* result = NULL;
+ ASSERT_TRUE(results->GetDictionary(0, &result));
+ ASSERT_TRUE(result->Equals(&expected));
+}
+
+TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) {
+ OnObjectFired::SomeObject object;
+ object.state = OnObjectFired::SomeObject::STATE_BAR;
+ scoped_ptr<ListValue> results(OnObjectFired::Create(object));
+
+ DictionaryValue expected;
+ expected.SetString("state", "bar");
+ DictionaryValue* result = NULL;
+ ASSERT_TRUE(results->GetDictionary(0, &result));
+ ASSERT_TRUE(result->Equals(&expected));
}

Powered by Google App Engine
This is Rietveld 408576698