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

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

Issue 116543010: Remove the Value class names from the global namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 12 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 | Annotate | Revision Log
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/json_schema_compiler/test/additional_properties.h" 6 #include "tools/json_schema_compiler/test/additional_properties.h"
7 7
8 using namespace test::api::additional_properties; 8 using namespace test::api::additional_properties;
9 9
10 TEST(JsonSchemaCompilerAdditionalPropertiesTest, 10 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
11 AdditionalPropertiesTypePopulate) { 11 AdditionalPropertiesTypePopulate) {
12 { 12 {
13 scoped_ptr<ListValue> list_value(new ListValue()); 13 scoped_ptr<base::ListValue> list_value(new base::ListValue());
14 list_value->Append(Value::CreateStringValue("asdf")); 14 list_value->Append(base::Value::CreateStringValue("asdf"));
15 list_value->Append(Value::CreateIntegerValue(4)); 15 list_value->Append(base::Value::CreateIntegerValue(4));
16 scoped_ptr<DictionaryValue> type_value(new DictionaryValue()); 16 scoped_ptr<base::DictionaryValue> type_value(new base::DictionaryValue());
17 type_value->SetString("string", "value"); 17 type_value->SetString("string", "value");
18 type_value->SetInteger("other", 9); 18 type_value->SetInteger("other", 9);
19 type_value->Set("another", list_value.release()); 19 type_value->Set("another", list_value.release());
20 scoped_ptr<AdditionalPropertiesType> type(new AdditionalPropertiesType()); 20 scoped_ptr<AdditionalPropertiesType> type(new AdditionalPropertiesType());
21 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get())); 21 ASSERT_TRUE(AdditionalPropertiesType::Populate(*type_value, type.get()));
22 EXPECT_TRUE(type->additional_properties.Equals(type_value.get())); 22 EXPECT_TRUE(type->additional_properties.Equals(type_value.get()));
23 } 23 }
24 { 24 {
25 scoped_ptr<DictionaryValue> type_value(new DictionaryValue()); 25 scoped_ptr<base::DictionaryValue> type_value(new base::DictionaryValue());
26 type_value->SetInteger("string", 3); 26 type_value->SetInteger("string", 3);
27 scoped_ptr<AdditionalPropertiesType> type(new AdditionalPropertiesType()); 27 scoped_ptr<AdditionalPropertiesType> type(new AdditionalPropertiesType());
28 EXPECT_FALSE(AdditionalPropertiesType::Populate(*type_value, type.get())); 28 EXPECT_FALSE(AdditionalPropertiesType::Populate(*type_value, type.get()));
29 } 29 }
30 } 30 }
31 31
32 TEST(JsonSchemaCompilerAdditionalPropertiesTest, 32 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
33 AdditionalPropertiesParamsCreate) { 33 AdditionalPropertiesParamsCreate) {
34 scoped_ptr<DictionaryValue> param_object_value(new DictionaryValue()); 34 scoped_ptr<base::DictionaryValue> param_object_value(
35 new base::DictionaryValue());
35 param_object_value->SetString("str", "a"); 36 param_object_value->SetString("str", "a");
36 param_object_value->SetInteger("num", 1); 37 param_object_value->SetInteger("num", 1);
37 scoped_ptr<ListValue> params_value(new ListValue()); 38 scoped_ptr<base::ListValue> params_value(new base::ListValue());
38 params_value->Append(param_object_value->DeepCopy()); 39 params_value->Append(param_object_value->DeepCopy());
39 scoped_ptr<AdditionalProperties::Params> params( 40 scoped_ptr<AdditionalProperties::Params> params(
40 AdditionalProperties::Params::Create(*params_value)); 41 AdditionalProperties::Params::Create(*params_value));
41 EXPECT_TRUE(params.get()); 42 EXPECT_TRUE(params.get());
42 EXPECT_TRUE(params->param_object.additional_properties.Equals( 43 EXPECT_TRUE(params->param_object.additional_properties.Equals(
43 param_object_value.get())); 44 param_object_value.get()));
44 } 45 }
45 46
46 TEST(JsonSchemaCompilerAdditionalPropertiesTest, 47 TEST(JsonSchemaCompilerAdditionalPropertiesTest,
47 ReturnAdditionalPropertiesResultCreate) { 48 ReturnAdditionalPropertiesResultCreate) {
48 ReturnAdditionalProperties::Results::ResultObject result_object; 49 ReturnAdditionalProperties::Results::ResultObject result_object;
49 result_object.integer = 5; 50 result_object.integer = 5;
50 result_object.additional_properties["key"] = "value"; 51 result_object.additional_properties["key"] = "value";
51 52
52 ListValue expected; 53 base::ListValue expected;
53 { 54 {
54 DictionaryValue* dict = new DictionaryValue(); 55 base::DictionaryValue* dict = new base::DictionaryValue();
55 dict->SetInteger("integer", 5); 56 dict->SetInteger("integer", 5);
56 dict->SetString("key", "value"); 57 dict->SetString("key", "value");
57 expected.Append(dict); 58 expected.Append(dict);
58 } 59 }
59 60
60 EXPECT_TRUE(Value::Equals( 61 EXPECT_TRUE(base::Value::Equals(
61 ReturnAdditionalProperties::Results::Create(result_object).get(), 62 ReturnAdditionalProperties::Results::Create(result_object).get(),
62 &expected)); 63 &expected));
63 } 64 }
OLDNEW
« no previous file with comments | « sync/internal_api/public/change_record_unittest.cc ('k') | tools/json_schema_compiler/test/any_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698