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

Unified Diff: tools/json_schema_compiler/test/simple_api_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, 6 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/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 accf32ea1f605630cd255dc0a7bdc774a2be3d5b..928670224f396c7efc1d03026c0ddc9f81e3a438 100644
--- a/tools/json_schema_compiler/test/simple_api_unittest.cc
+++ b/tools/json_schema_compiler/test/simple_api_unittest.cc
@@ -133,10 +133,63 @@ TEST(JsonSchemaCompilerSimpleTest, TestTypePopulate) {
}
TEST(JsonSchemaCompilerSimpleTest, GetTestType) {
- scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary();
- scoped_ptr<TestType> test_type(new TestType());
- EXPECT_TRUE(TestType::Populate(*value, test_type.get()));
- scoped_ptr<Value> result(GetTestType::Result::Create(*test_type));
- EXPECT_TRUE(value->Equals(result.get()));
+ {
+ scoped_ptr<DictionaryValue> value = CreateTestTypeDictionary();
+ scoped_ptr<TestType> test_type(new TestType());
+ EXPECT_TRUE(TestType::Populate(*value, test_type.get()));
+ scoped_ptr<Value> result(GetTestType::Result::Create(*test_type));
+ EXPECT_TRUE(value->Equals(result.get()));
+ }
+}
+
+TEST(JsonSchemaCompilerSimpleTest, OnIntegerFiredCreate) {
+ {
+ int some_integer = 5;
+ scoped_ptr<Value> result_value(OnIntegerFired::Create(some_integer));
+
+ int result_integer = 0;
+ EXPECT_TRUE(result_value->GetAsInteger(&result_integer));
+ EXPECT_EQ(some_integer, result_integer);
+ }
}
+TEST(JsonSchemaCompilerSimpleTest, OnStringFiredCreate) {
+ {
+ std::string some_string("yo dawg");
+ scoped_ptr<Value> result_value(OnStringFired::Create(some_string));
+
+ std::string result_string;
+ EXPECT_TRUE(result_value->GetAsString(&result_string));
+ EXPECT_EQ(some_string, result_string);
+ }
+}
+
+TEST(JsonSchemaCompilerSimpleTest, OnTestTypeFiredCreate) {
+ {
+ TestType some_test_type;
+ some_test_type.number = 1.1;
+ some_test_type.string = "bling";
+ some_test_type.integer = 4;
+ some_test_type.boolean = true;
not at google - send to devlin 2012/07/03 14:21:39 same comment(s)
+ scoped_ptr<Value> result_value(OnTestTypeFired::Create(some_test_type));
+
+ DictionaryValue* result_dict = NULL;
+ ASSERT_TRUE(result_value->GetAsDictionary(&result_dict));
+
+ double result_number = 0.0;
+ EXPECT_TRUE(result_dict->GetDouble("number", &result_number));
+ EXPECT_EQ(some_test_type.number, result_number);
+
+ std::string result_string;
+ EXPECT_TRUE(result_dict->GetString("string", &result_string));
+ EXPECT_EQ(some_test_type.string, result_string);
+
+ int result_integer = 0;
+ EXPECT_TRUE(result_dict->GetInteger("integer", &result_integer));
+ EXPECT_EQ(some_test_type.integer, result_integer);
+
+ bool result_boolean = false;
+ EXPECT_TRUE(result_dict->GetBoolean("boolean", &result_boolean));
+ EXPECT_EQ(some_test_type.boolean, result_boolean);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698