Revert 224458 "Enabling MediaStreamInfoBarTest.DenyingCameraDoes..."
[chromium-blink-merge.git] / tools / json_schema_compiler / test / callbacks_unittest.cc
blob163a6c0e3cdc2f1e9dbfff9c427159e75697acc9
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "tools/json_schema_compiler/test/callbacks.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 using namespace test::api::callbacks;
11 TEST(JsonSchemaCompilerCallbacksTest, ReturnsObjectResultCreate) {
12 ReturnsObject::Results::SomeObject some_object;
13 some_object.state = ReturnsObject::Results::SomeObject::STATE_FOO;
14 scoped_ptr<ListValue> results = ReturnsObject::Results::Create(some_object);
16 DictionaryValue* expected_dict = new DictionaryValue();
17 expected_dict->SetString("state", "foo");
18 ListValue expected;
19 expected.Append(expected_dict);
20 EXPECT_TRUE(results->Equals(&expected));
23 TEST(JsonSchemaCompilerCallbacksTest, ReturnsMultipleResultCreate) {
24 ReturnsMultiple::Results::SomeObject some_object;
25 some_object.state = ReturnsMultiple::Results::SomeObject::STATE_FOO;
26 scoped_ptr<ListValue> results =
27 ReturnsMultiple::Results::Create(5, some_object);
29 DictionaryValue* expected_dict = new DictionaryValue();
30 expected_dict->SetString("state", "foo");
31 ListValue expected;
32 expected.Append(Value::CreateIntegerValue(5));
33 expected.Append(expected_dict);
34 EXPECT_TRUE(results->Equals(&expected));