| 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);
|
| +}
|
|
|