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

Side by Side Diff: tools/json_schema_compiler/test/any_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: add any in arrays to util.h 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
« no previous file with comments | « tools/json_schema_compiler/test/any.json ('k') | tools/json_schema_compiler/test/arrays.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/any.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 using namespace test::api::any;
10
11 TEST(JsonSchemaCompilerAnyTest, AnyTypePopulate) {
12 {
13 AnyType any_type;
14 scoped_ptr<DictionaryValue> any_type_value(new DictionaryValue());
15 any_type_value->SetString("any", "value");
16 EXPECT_TRUE(AnyType::Populate(*any_type_value, &any_type));
17 scoped_ptr<Value> any_type_to_value(any_type.ToValue());
18 EXPECT_TRUE(any_type_value->Equals(any_type_to_value.get()));
19 }
20 {
21 AnyType any_type;
22 scoped_ptr<DictionaryValue> any_type_value(new DictionaryValue());
23 any_type_value->SetInteger("any", 5);
24 EXPECT_TRUE(AnyType::Populate(*any_type_value, &any_type));
25 scoped_ptr<Value> any_type_to_value(any_type.ToValue());
26 EXPECT_TRUE(any_type_value->Equals(any_type_to_value.get()));
27 }
28 }
29
30 TEST(JsonSchemaCompilerAnyTest, OptionalAnyParamsCreate) {
31 {
32 scoped_ptr<ListValue> params_value(new ListValue());
33 scoped_ptr<OptionalAny::Params> params(
34 OptionalAny::Params::Create(*params_value));
35 EXPECT_TRUE(params.get());
36 EXPECT_FALSE(params->any.get());
37 }
38 {
39 scoped_ptr<ListValue> params_value(new ListValue());
40 scoped_ptr<Value> param(Value::CreateStringValue("asdf"));
41 params_value->Append(param->DeepCopy());
42 scoped_ptr<OptionalAny::Params> params(
43 OptionalAny::Params::Create(*params_value));
44 EXPECT_TRUE(params.get());
45 EXPECT_TRUE(params->any.get());
46 EXPECT_TRUE(params->any->value().Equals(param.get()));
47 }
48 {
49 scoped_ptr<ListValue> params_value(new ListValue());
50 scoped_ptr<Value> param(Value::CreateBooleanValue(true));
51 params_value->Append(param->DeepCopy());
52 scoped_ptr<OptionalAny::Params> params(
53 OptionalAny::Params::Create(*params_value));
54 EXPECT_TRUE(params.get());
55 EXPECT_TRUE(params->any.get());
56 EXPECT_TRUE(params->any.get());
57 EXPECT_TRUE(params->any->value().Equals(param.get()));
58 }
59 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/any.json ('k') | tools/json_schema_compiler/test/arrays.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698