Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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); | |
|
not at google - send to devlin
2012/07/03 14:21:39
Another alternative to this is to build up the exp
| |
| 71 } | |
| OLD | NEW |