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

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

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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/gn/desc_builder.cc ('k') | tools/json_schema_compiler/test/simple_api_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/error_generation.h" 5 #include "tools/json_schema_compiler/test/error_generation.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // GenerateFunctionParamsCreate errors 94 // GenerateFunctionParamsCreate errors
95 95
96 TEST(JsonSchemaCompilerErrorTest, ParamIsRequired) { 96 TEST(JsonSchemaCompilerErrorTest, ParamIsRequired) {
97 { 97 {
98 std::unique_ptr<base::ListValue> params_value = List(new Value(5)); 98 std::unique_ptr<base::ListValue> params_value = List(new Value(5));
99 base::string16 error; 99 base::string16 error;
100 EXPECT_TRUE(TestFunction::Params::Create(*params_value, &error)); 100 EXPECT_TRUE(TestFunction::Params::Create(*params_value, &error));
101 } 101 }
102 { 102 {
103 std::unique_ptr<base::ListValue> params_value = 103 std::unique_ptr<base::ListValue> params_value = List(new Value());
104 List(base::Value::CreateNullValue().release());
105 base::string16 error; 104 base::string16 error;
106 EXPECT_FALSE(TestFunction::Params::Create(*params_value, &error)); 105 EXPECT_FALSE(TestFunction::Params::Create(*params_value, &error));
107 EXPECT_TRUE(EqualsUtf16("'num' is required", error)); 106 EXPECT_TRUE(EqualsUtf16("'num' is required", error));
108 } 107 }
109 } 108 }
110 109
111 // GeneratePopulateVariableFromValue errors 110 // GeneratePopulateVariableFromValue errors
112 111
113 TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) { 112 TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) {
114 { 113 {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); 321 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value)));
323 } 322 }
324 { 323 {
325 std::unique_ptr<base::DictionaryValue> value = 324 std::unique_ptr<base::DictionaryValue> value =
326 Dictionary("string", new base::Value("yes"), "ohno", 325 Dictionary("string", new base::Value("yes"), "ohno",
327 new base::Value("many values")); 326 new base::Value("many values"));
328 EXPECT_TRUE(EqualsUtf16("found unexpected key 'ohno'", 327 EXPECT_TRUE(EqualsUtf16("found unexpected key 'ohno'",
329 GetPopulateError<TestType>(*value))); 328 GetPopulateError<TestType>(*value)));
330 } 329 }
331 } 330 }
OLDNEW
« no previous file with comments | « tools/gn/desc_builder.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