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

Side by Side Diff: tools/json_schema_compiler/test/objects_unittest.cc

Issue 10701012: JSON Schema Compiler: Added event compilation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/json_schema_compiler/test/objects.h" 5 #include "tools/json_schema_compiler/test/objects.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 using namespace test::api::objects; 9 using namespace test::api::objects;
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 scoped_ptr<ListValue> params_value(new ListValue()); 40 scoped_ptr<ListValue> params_value(new ListValue());
41 params_value->Append(info_value.release()); 41 params_value->Append(info_value.release());
42 scoped_ptr<ObjectParam::Params> params( 42 scoped_ptr<ObjectParam::Params> params(
43 ObjectParam::Params::Create(*params_value)); 43 ObjectParam::Params::Create(*params_value));
44 EXPECT_FALSE(params.get()); 44 EXPECT_FALSE(params.get());
45 } 45 }
46 } 46 }
47 47
48 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { 48 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) {
49 scoped_ptr<ReturnsObject::Result::Info> info( 49 ReturnsObject::Results::Info info;
50 new ReturnsObject::Result::Info()); 50 info.state = ReturnsObject::Results::Info::STATE_FOO;
51 info->state = ReturnsObject::Result::Info::STATE_FOO; 51 scoped_ptr<ListValue> results = ReturnsObject::Results::Create(info);
52 scoped_ptr<Value> result_value( 52
53 ReturnsObject::Result::Create(*info)); 53 DictionaryValue expected;
54 DictionaryValue* result_dict = NULL; 54 expected.SetString("state", "foo");
55 EXPECT_TRUE(result_value->GetAsDictionary(&result_dict)); 55 DictionaryValue* result = NULL;
56 std::string state; 56 ASSERT_TRUE(results->GetDictionary(0, &result));
57 EXPECT_TRUE(result_dict->GetString("state", &state)); 57 ASSERT_TRUE(result->Equals(&expected));
58 EXPECT_EQ("foo", state);
59 } 58 }
59
60 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) {
61 OnObjectFired::SomeObject object;
62 object.state = OnObjectFired::SomeObject::STATE_BAR;
63 scoped_ptr<ListValue> results(OnObjectFired::Create(object));
64
65 DictionaryValue expected;
66 expected.SetString("state", "bar");
67 DictionaryValue* result = NULL;
68 ASSERT_TRUE(results->GetDictionary(0, &result));
69 ASSERT_TRUE(result->Equals(&expected));
70 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/objects.json ('k') | tools/json_schema_compiler/test/simple_api.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698