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

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

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 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
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/objects.h" 5 #include "tools/json_schema_compiler/test/objects.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "tools/json_schema_compiler/test/objects_movable.h" 13 #include "tools/json_schema_compiler/test/objects_movable.h"
14 #include "tools/json_schema_compiler/test/objects_movable_json.h" 14 #include "tools/json_schema_compiler/test/objects_movable_json.h"
15 15
16 using namespace test::api::objects; 16 using namespace test::api::objects;
17 using namespace test::api::objects_movable; 17 using namespace test::api::objects_movable;
18 using namespace test::api::objects_movable_json; 18 using namespace test::api::objects_movable_json;
19 19
20 TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) { 20 TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) {
21 { 21 {
22 std::unique_ptr<base::ListValue> strings(new base::ListValue()); 22 std::unique_ptr<base::ListValue> strings(new base::ListValue());
23 strings->AppendString("one"); 23 strings->AppendString("one");
24 strings->AppendString("two"); 24 strings->AppendString("two");
25 std::unique_ptr<base::DictionaryValue> info_value( 25 std::unique_ptr<base::DictionaryValue> info_value(
26 new base::DictionaryValue()); 26 new base::DictionaryValue());
27 info_value->Set("strings", strings.release()); 27 info_value->Set("strings", strings.release());
28 info_value->Set("integer", new base::FundamentalValue(5)); 28 info_value->Set("integer", new base::Value(5));
29 info_value->Set("boolean", new base::FundamentalValue(true)); 29 info_value->Set("boolean", new base::Value(true));
30 30
31 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 31 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
32 params_value->Append(std::move(info_value)); 32 params_value->Append(std::move(info_value));
33 std::unique_ptr<ObjectParam::Params> params( 33 std::unique_ptr<ObjectParam::Params> params(
34 ObjectParam::Params::Create(*params_value)); 34 ObjectParam::Params::Create(*params_value));
35 EXPECT_TRUE(params.get()); 35 EXPECT_TRUE(params.get());
36 EXPECT_EQ((size_t) 2, params->info.strings.size()); 36 EXPECT_EQ((size_t) 2, params->info.strings.size());
37 EXPECT_EQ("one", params->info.strings[0]); 37 EXPECT_EQ("one", params->info.strings[0]);
38 EXPECT_EQ("two", params->info.strings[1]); 38 EXPECT_EQ("two", params->info.strings[1]);
39 EXPECT_EQ(5, params->info.integer); 39 EXPECT_EQ(5, params->info.integer);
40 EXPECT_TRUE(params->info.boolean); 40 EXPECT_TRUE(params->info.boolean);
41 } 41 }
42 { 42 {
43 std::unique_ptr<base::ListValue> strings(new base::ListValue()); 43 std::unique_ptr<base::ListValue> strings(new base::ListValue());
44 strings->AppendString("one"); 44 strings->AppendString("one");
45 strings->AppendString("two"); 45 strings->AppendString("two");
46 std::unique_ptr<base::DictionaryValue> info_value( 46 std::unique_ptr<base::DictionaryValue> info_value(
47 new base::DictionaryValue()); 47 new base::DictionaryValue());
48 info_value->Set("strings", strings.release()); 48 info_value->Set("strings", strings.release());
49 info_value->Set("integer", new base::FundamentalValue(5)); 49 info_value->Set("integer", new base::Value(5));
50 50
51 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 51 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
52 params_value->Append(std::move(info_value)); 52 params_value->Append(std::move(info_value));
53 std::unique_ptr<ObjectParam::Params> params( 53 std::unique_ptr<ObjectParam::Params> params(
54 ObjectParam::Params::Create(*params_value)); 54 ObjectParam::Params::Create(*params_value));
55 EXPECT_FALSE(params.get()); 55 EXPECT_FALSE(params.get());
56 } 56 }
57 } 57 }
58 58
59 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) { 59 TEST(JsonSchemaCompilerObjectsTest, ReturnsObjectResultCreate) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 vals2.push_back("vals2a"); 155 vals2.push_back("vals2a");
156 vals2.push_back("vals2b"); 156 vals2.push_back("vals2b");
157 with_additional.additional_properties["key2"] = vals2; 157 with_additional.additional_properties["key2"] = vals2;
158 158
159 MovableWithAdditional with_additional2(std::move(with_additional)); 159 MovableWithAdditional with_additional2(std::move(with_additional));
160 EXPECT_EQ("str", with_additional2.str); 160 EXPECT_EQ("str", with_additional2.str);
161 EXPECT_EQ(2u, with_additional2.additional_properties.size()); 161 EXPECT_EQ(2u, with_additional2.additional_properties.size());
162 EXPECT_EQ(vals1, with_additional2.additional_properties["key1"]); 162 EXPECT_EQ(vals1, with_additional2.additional_properties["key1"]);
163 EXPECT_EQ(vals2, with_additional2.additional_properties["key2"]); 163 EXPECT_EQ(vals2, with_additional2.additional_properties["key2"]);
164 } 164 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/idl_schemas_unittest.cc ('k') | tools/json_schema_compiler/test/simple_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698