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

Unified Diff: tools/json_schema_compiler/test/enums_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/enums_unittest.cc
diff --git a/tools/json_schema_compiler/test/enums_unittest.cc b/tools/json_schema_compiler/test/enums_unittest.cc
index 14eece27c1dbfb587de45bf3be88953460945765..7e8d6dcc1859d70b84c47b093d8e4553917f8db4 100644
--- a/tools/json_schema_compiler/test/enums_unittest.cc
+++ b/tools/json_schema_compiler/test/enums_unittest.cc
@@ -25,6 +25,23 @@ TEST(JsonSchemaCompilerEnumsTest, EnumTypePopulate) {
}
}
+TEST(JsonSchemaCompilerEnumsTest, ReturnsEnumCreate) {
+ {
+ ReturnsEnum::Result::State state = ReturnsEnum::Result::STATE_FOO;
+ scoped_ptr<Value> state_value = ReturnsEnum::Result::CreateEnumValue(state);
+ std::string result;
+ state_value->GetAsString(&result);
+ EXPECT_EQ("foo", result);
+ }
+ {
+ ReturnsEnum::Result::State state = ReturnsEnum::Result::STATE_FOO;
+ scoped_ptr<Value> state_value(ReturnsEnum::Result::Create(state));
+ std::string result;
+ state_value->GetAsString(&result);
+ EXPECT_EQ("foo", result);
+ }
+}
+
TEST(JsonSchemaCompilerEnumsTest, OptionalEnumTypePopulate) {
{
scoped_ptr<OptionalEnumType> enum_type(new OptionalEnumType());
@@ -129,3 +146,20 @@ TEST(JsonSchemaCompilerEnumsTest, TakesMultipleOptionalEnumsParamsCreate) {
EXPECT_FALSE(params.get());
}
}
+
+TEST(JsonSchemaCompilerEnumsTest, OnEnumFiredCreate) {
+ {
+ OnEnumFired::SomeEnum some_enum = OnEnumFired::SOME_ENUM_FOO;
+ scoped_ptr<Value> some_enum_value = OnEnumFired::CreateEnumValue(some_enum);
+ std::string result;
+ some_enum_value->GetAsString(&result);
+ EXPECT_EQ("foo", result);
+ }
+ {
+ OnEnumFired::SomeEnum some_enum = OnEnumFired::SOME_ENUM_FOO;
+ scoped_ptr<Value> some_enum_value(OnEnumFired::Create(some_enum));
+ std::string result;
+ some_enum_value->GetAsString(&result);
+ EXPECT_EQ("foo", result);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698