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

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

Issue 9491002: json_schema_compiler: any, additionalProperties, functions on types (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove whitespace Created 8 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "tools/json_schema_compiler/test/additionalProperties.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 using namespace test::api::additional_properties;
10
11 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
12 AdditionalPropertiesParamsCreate) {
13 scoped_ptr<DictionaryValue> param_object_value(new DictionaryValue());
14 param_object_value->SetString("str", "a");
15 param_object_value->SetInteger("num", 1);
16 scoped_ptr<ListValue> params_value(new ListValue());
17 params_value->Append(param_object_value.release());
18 scoped_ptr<AdditionalProperties::Params> params(
19 AdditionalProperties::Params::Create(*params_value));
20 EXPECT_TRUE(params.get());
21 int int_temp = 0;
not at google - send to devlin 2012/02/29 03:06:30 you could replace all of this to the bottom with
calamity 2012/03/01 04:47:09 Done.
not at google - send to devlin 2012/03/01 07:09:37 param_object_value still isn't on the stack... I m
22 EXPECT_TRUE(params->param_object.additional_properties.GetInteger(
23 "num", &int_temp));
24 EXPECT_EQ(1, int_temp);
25 std::string string_temp;
26 EXPECT_TRUE(params->param_object.additional_properties.GetString(
27 "str", &string_temp));
28 EXPECT_EQ("a", string_temp);
29 }
30
31 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
32 ReturnAdditionalPropertiesResultCreate) {
33 scoped_ptr<DictionaryValue> result_object_value(new DictionaryValue());
34 result_object_value->SetString("key", "value");
35 scoped_ptr<ReturnAdditionalProperties::Result::ResultObject> result_object(
36 new ReturnAdditionalProperties::Result::ResultObject());
37 result_object->integer = 5;
38 result_object->additional_properties.MergeDictionary(
39 result_object_value.get());
40 scoped_ptr<Value> result(
41 ReturnAdditionalProperties::Result::Create(*result_object));
42 DictionaryValue* result_dict = NULL;
not at google - send to devlin 2012/02/29 03:06:30 same comment as above, try to use Equals on the va
calamity 2012/03/01 04:47:09 Done.
43 EXPECT_TRUE(result->GetAsDictionary(&result_dict));
44 std::string string_temp;
45 EXPECT_TRUE(result_dict->GetString("key", &string_temp));
46 EXPECT_EQ("value", string_temp);
47 int int_temp;
48 EXPECT_TRUE(result_dict->GetInteger("integer", &int_temp));
49 EXPECT_EQ(5, int_temp);
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698