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

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

Issue 10796114: Added ToJson to JSON schema compiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed scope Created 8 years, 4 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
« no previous file with comments | « tools/json_schema_compiler/test/content_settings.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/json/json_writer.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 using namespace test::api::objects; 10 using namespace test::api::objects;
10 11
11 TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) { 12 TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) {
12 { 13 {
13 scoped_ptr<ListValue> strings(new ListValue()); 14 scoped_ptr<ListValue> strings(new ListValue());
14 strings->Append(Value::CreateStringValue("one")); 15 strings->Append(Value::CreateStringValue("one"));
15 strings->Append(Value::CreateStringValue("two")); 16 strings->Append(Value::CreateStringValue("two"));
16 scoped_ptr<DictionaryValue> info_value(new DictionaryValue()); 17 scoped_ptr<DictionaryValue> info_value(new DictionaryValue());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) { 61 TEST(JsonSchemaCompilerObjectsTest, OnObjectFiredCreate) {
61 OnObjectFired::SomeObject object; 62 OnObjectFired::SomeObject object;
62 object.state = OnObjectFired::SomeObject::STATE_BAR; 63 object.state = OnObjectFired::SomeObject::STATE_BAR;
63 scoped_ptr<ListValue> results(OnObjectFired::Create(object)); 64 scoped_ptr<ListValue> results(OnObjectFired::Create(object));
64 65
65 DictionaryValue expected; 66 DictionaryValue expected;
66 expected.SetString("state", "bar"); 67 expected.SetString("state", "bar");
67 DictionaryValue* result = NULL; 68 DictionaryValue* result = NULL;
68 ASSERT_TRUE(results->GetDictionary(0, &result)); 69 ASSERT_TRUE(results->GetDictionary(0, &result));
69 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);
70 } 76 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/content_settings.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698