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

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: Added more testing for event compilation. 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 } 46 }
47 47
48 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { 48 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) {
49 scoped_ptr<ReturnsObject::Result::Info> info( 49 scoped_ptr<ReturnsObject::Result::Info> info(
50 new ReturnsObject::Result::Info()); 50 new ReturnsObject::Result::Info());
51 info->state = ReturnsObject::Result::Info::STATE_FOO; 51 info->state = ReturnsObject::Result::Info::STATE_FOO;
52 scoped_ptr<Value> result_value( 52 scoped_ptr<Value> result_value(
53 ReturnsObject::Result::Create(*info)); 53 ReturnsObject::Result::Create(*info));
54 DictionaryValue* result_dict = NULL; 54 DictionaryValue* result_dict = NULL;
55 EXPECT_TRUE(result_value->GetAsDictionary(&result_dict)); 55 ASSERT_TRUE(result_value->GetAsDictionary(&result_dict));
56 std::string state; 56 std::string state;
57 EXPECT_TRUE(result_dict->GetString("state", &state)); 57 EXPECT_TRUE(result_dict->GetString("state", &state));
58 EXPECT_EQ("foo", state); 58 EXPECT_EQ("foo", state);
59 } 59 }
60
61 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) {
62 OnObjectFired::SomeObject object;
63 object.state = OnObjectFired::SomeObject::STATE_BAR;
64 scoped_ptr<Value> result_value(OnObjectFired::Create(object));
65
66 DictionaryValue* result_dict = NULL;
67 ASSERT_TRUE(result_value->GetAsDictionary(&result_dict));
68 std::string state;
69 EXPECT_TRUE(result_dict->GetString("state", &state));
70 EXPECT_EQ("bar", state);
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698