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

Unified Diff: tools/json_schema_compiler/test/callbacks_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/callbacks_unittest.cc
diff --git a/tools/json_schema_compiler/test/callbacks_unittest.cc b/tools/json_schema_compiler/test/callbacks_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..03da98b31437e066cbb92cd199220a2317f9ac6a
--- /dev/null
+++ b/tools/json_schema_compiler/test/callbacks_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/json_schema_compiler/test/objects.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+using namespace test::api::callbacks;
+
+TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) {
+ ReturnsObject::Result::SomeObject some_object;
+ some_object.state = ReturnsObject::Result::Info::STATE_FOO;
+ scoped_ptr<Value> result_value(ReturnsObject::Result::Create(some_object));
+
+ 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);
+}
+
+TEST(JsonSchemaCompilerObjectsTest, ReturnsMultipleResultCreate) {
+ ReturnsMultiple::Result::Info some_object;
+ some_object.state = ReturnsMultiple::Result::Info::STATE_FOO;
+ scoped_ptr<Value> result_value(ReturnsObject::Result::Create(some_object));
+
+ 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);
+}

Powered by Google App Engine
This is Rietveld 408576698