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

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: Tested GetAllPossibleParameterLists better. 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..12539a9b032aa041508cfce02da47ca02844c875
--- /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/callbacks.h"
+
+#include "chrome/common/extensions/value_builder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using namespace test::api::callbacks;
+using namespace extensions;
+
+TEST(JsonSchemaCompilerCallbacksTest, ReturnsObjectResultCreate) {
+ ReturnsObject::Result::SomeObject some_object;
+ some_object.state = ReturnsObject::Result::SomeObject::STATE_FOO;
+ scoped_ptr<ListValue> results(ReturnsObject::Result::Create(some_object));
+
+ scoped_ptr<ListValue> expected_results(
+ ListBuilder().Append(DictionaryBuilder().Set("state", "foo")).Build());
+ EXPECT_TRUE(results->Equals(expected_results.get()));
+}
+
+TEST(JsonSchemaCompilerCallbacksTest, ReturnsMultipleResultCreate) {
+ ReturnsMultiple::Result::SomeObject some_object;
+ some_object.state = ReturnsMultiple::Result::SomeObject::STATE_FOO;
+ scoped_ptr<ListValue> results(
+ ReturnsMultiple::Result::Create(5, some_object));
+
+ scoped_ptr<ListValue> expected_results(
+ ListBuilder().Append(5)
+ .Append(DictionaryBuilder().Set("state", "foo")).Build());
+ EXPECT_TRUE(results->Equals(expected_results.get()));
+}

Powered by Google App Engine
This is Rietveld 408576698