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

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

Powered by Google App Engine
This is Rietveld 408576698