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 "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 using namespace test::api::objects; | 10 using namespace test::api::objects; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) { | 61 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) { |
62 OnObjectFired::SomeObject object; | 62 OnObjectFired::SomeObject object; |
63 object.state = OnObjectFired::SomeObject::STATE_BAR; | 63 object.state = OnObjectFired::SomeObject::STATE_BAR; |
64 scoped_ptr<ListValue> results(OnObjectFired::Create(object)); | 64 scoped_ptr<ListValue> results(OnObjectFired::Create(object)); |
65 | 65 |
66 DictionaryValue expected; | 66 DictionaryValue expected; |
67 expected.SetString("state", "bar"); | 67 expected.SetString("state", "bar"); |
68 DictionaryValue* result = NULL; | 68 DictionaryValue* result = NULL; |
69 ASSERT_TRUE(results->GetDictionary(0, &result)); | 69 ASSERT_TRUE(results->GetDictionary(0, &result)); |
70 ASSERT_TRUE(result->Equals(&expected)); | 70 ASSERT_TRUE(result->Equals(&expected)); |
71 | |
72 std::string json1 = OnObjectFired::ToJson(object); | |
73 std::string json2; | |
74 base::JSONWriter::Write(results.get(), &json2); | |
75 ASSERT_EQ(json1, json2); | |
76 } | 71 } |
OLD | NEW |