Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / tools / json_schema_compiler / test / callbacks_unittest.cc
blob001e977bf07a74c1a75105bbe18972acdae2cdbd
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<base::ListValue> results =
15 ReturnsObject::Results::Create(some_object);
17 base::DictionaryValue* expected_dict = new base::DictionaryValue();
18 expected_dict->SetString("state", "foo");
19 base::ListValue expected;
20 expected.Append(expected_dict);
21 EXPECT_TRUE(results->Equals(&expected));
24 TEST(JsonSchemaCompilerCallbacksTest, ReturnsMultipleResultCreate) {
25 ReturnsMultiple::Results::SomeObject some_object;
26 some_object.state = ReturnsMultiple::Results::SomeObject::STATE_FOO;
27 scoped_ptr<base::ListValue> results =
28 ReturnsMultiple::Results::Create(5, some_object);
30 base::DictionaryValue* expected_dict = new base::DictionaryValue();
31 expected_dict->SetString("state", "foo");
32 base::ListValue expected;
33 expected.Append(new base::FundamentalValue(5));
34 expected.Append(expected_dict);
35 EXPECT_TRUE(results->Equals(&expected));