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

Side by Side Diff: tools/json_schema_compiler/test/additional_properties_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/additional_properties.h" 5 #include "tools/json_schema_compiler/test/additional_properties.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::additional_properties; 9 using namespace test::api::additional_properties;
10 10
(...skipping 30 matching lines...) Expand all
41 params_value->Append(param_object_value->DeepCopy()); 41 params_value->Append(param_object_value->DeepCopy());
42 scoped_ptr<AdditionalProperties::Params> params( 42 scoped_ptr<AdditionalProperties::Params> params(
43 AdditionalProperties::Params::Create(*params_value)); 43 AdditionalProperties::Params::Create(*params_value));
44 EXPECT_TRUE(params.get()); 44 EXPECT_TRUE(params.get());
45 EXPECT_TRUE(params->param_object.additional_properties.Equals( 45 EXPECT_TRUE(params->param_object.additional_properties.Equals(
46 param_object_value.get())); 46 param_object_value.get()));
47 } 47 }
48 48
49 TEST(JsonSchemaCompilerAdditionalPropertiesTest, 49 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
50 ReturnAdditionalPropertiesResultCreate) { 50 ReturnAdditionalPropertiesResultCreate) {
51 scoped_ptr<DictionaryValue> result_object_value(new DictionaryValue()); 51 DictionaryValue additional;
52 result_object_value->SetString("key", "value"); 52 additional.SetString("key", "value");
53 scoped_ptr<ReturnAdditionalProperties::Result::ResultObject> result_object( 53 ReturnAdditionalProperties::Results::ResultObject result_object;
54 new ReturnAdditionalProperties::Result::ResultObject()); 54 result_object.integer = 5;
55 result_object->integer = 5; 55 result_object.additional_properties.MergeDictionary(&additional);
56 result_object->additional_properties.MergeDictionary( 56 scoped_ptr<ListValue> results =
57 result_object_value.get()); 57 ReturnAdditionalProperties::Results::Create(result_object);
58 scoped_ptr<Value> result(
59 ReturnAdditionalProperties::Result::Create(*result_object));
60 DictionaryValue* result_dict = NULL; 58 DictionaryValue* result_dict = NULL;
61 EXPECT_TRUE(result->GetAsDictionary(&result_dict)); 59 EXPECT_TRUE(results->GetDictionary(0, &result_dict));
62 60
63 Value* int_temp_value_out = NULL; 61 Value* int_temp_value_out = NULL;
64 int int_temp = 0; 62 int int_temp = 0;
65 EXPECT_TRUE(result_dict->Remove("integer", &int_temp_value_out)); 63 EXPECT_TRUE(result_dict->Remove("integer", &int_temp_value_out));
66 scoped_ptr<Value> int_temp_value(int_temp_value_out); 64 scoped_ptr<Value> int_temp_value(int_temp_value_out);
67 EXPECT_TRUE(int_temp_value->GetAsInteger(&int_temp)); 65 EXPECT_TRUE(int_temp_value->GetAsInteger(&int_temp));
68 EXPECT_EQ(5, int_temp); 66 EXPECT_EQ(5, int_temp);
69 67
70 EXPECT_TRUE(result_dict->Equals(result_object_value.get())); 68 EXPECT_TRUE(result_dict->Equals(&additional));
71 } 69 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/schema_bundle_generator.py ('k') | tools/json_schema_compiler/test/any.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698