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

Unified Diff: tools/json_schema_compiler/test/error_generation_unittest.cc

Issue 2843813002: Remove SetWithoutPathExpansion (Closed)
Patch Set: Fix CrOS Error 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 side-by-side diff with in-line comments
Download patch
Index: tools/json_schema_compiler/test/error_generation_unittest.cc
diff --git a/tools/json_schema_compiler/test/error_generation_unittest.cc b/tools/json_schema_compiler/test/error_generation_unittest.cc
index 9c22682bbf1409b6c9b832c417282602d6ff3055..e033ca45ce08012b9d909da11dc28bb54f3d3ecb 100644
--- a/tools/json_schema_compiler/test/error_generation_unittest.cc
+++ b/tools/json_schema_compiler/test/error_generation_unittest.cc
@@ -36,7 +36,7 @@ testing::AssertionResult EqualsUtf16(const std::string& expected,
TEST(JsonSchemaCompilerErrorTest, RequiredPropertyPopulate) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new base::Value("bling"));
+ Dictionary("string", base::MakeUnique<base::Value>("bling"));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value)));
}
{
@@ -64,7 +64,7 @@ TEST(JsonSchemaCompilerErrorTest, UnexpectedTypePopulation) {
TEST(JsonSchemaCompilerErrorTest, TypeIsRequired) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("integers", new Value(5));
+ Dictionary("integers", base::MakeUnique<Value>(5));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ChoiceType>(*value)));
}
{
@@ -112,12 +112,12 @@ TEST(JsonSchemaCompilerErrorTest, ParamIsRequired) {
TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new base::Value("yes"));
+ Dictionary("string", base::MakeUnique<base::Value>("yes"));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new Value(1.1));
+ Dictionary("string", base::MakeUnique<Value>(1.1));
EXPECT_TRUE(EqualsUtf16("'string': expected string, got double",
GetPopulateError<TestType>(*value)));
}
@@ -146,7 +146,7 @@ TEST(JsonSchemaCompilerErrorTest, WrongTypeValueType) {
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("otherType", new Value(1.1));
+ Dictionary("otherType", base::MakeUnique<Value>(1.1));
ObjectType out;
base::string16 error;
EXPECT_TRUE(ObjectType::Populate(*value, &out, &error));
@@ -173,13 +173,13 @@ TEST(JsonSchemaCompilerErrorTest, UnableToPopulateArray) {
TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) {
{
- std::unique_ptr<base::DictionaryValue> value =
- Dictionary("data", new base::Value(base::Value::Type::BINARY));
+ std::unique_ptr<base::DictionaryValue> value = Dictionary(
+ "data", base::MakeUnique<base::Value>(base::Value::Type::BINARY));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<BinaryData>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("data", new Value(1.1));
+ Dictionary("data", base::MakeUnique<Value>(1.1));
EXPECT_TRUE(EqualsUtf16("'data': expected binary, got double",
GetPopulateError<BinaryData>(*value)));
}
@@ -188,12 +188,12 @@ TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) {
TEST(JsonSchemaCompilerErrorTest, ListExpected) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("TheArray", new base::ListValue());
+ Dictionary("TheArray", base::MakeUnique<base::ListValue>());
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("TheArray", new Value(5));
+ Dictionary("TheArray", base::MakeUnique<Value>(5));
EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer",
GetPopulateError<ArrayObject>(*value)));
}
@@ -204,12 +204,12 @@ TEST(JsonSchemaCompilerErrorTest, ListExpected) {
TEST(JsonSchemaCompilerErrorTest, BadEnumValue) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("enumeration", new base::Value("one"));
+ Dictionary("enumeration", base::MakeUnique<base::Value>("one"));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<HasEnumeration>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("enumeration", new base::Value("bad sauce"));
+ Dictionary("enumeration", base::MakeUnique<base::Value>("bad sauce"));
EXPECT_TRUE(EqualsUtf16("'Enumeration': expected \"one\" or \"two\" "
"or \"three\", got \"bad sauce\"",
GetPopulateError<HasEnumeration>(*value)));
@@ -221,12 +221,12 @@ TEST(JsonSchemaCompilerErrorTest, BadEnumValue) {
TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new base::Value("bling"));
+ Dictionary("string", base::MakeUnique<base::Value>("bling"));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalTestType>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new base::Value(1));
+ Dictionary("string", base::MakeUnique<base::Value>(1));
OptionalTestType out;
base::string16 error;
@@ -239,14 +239,14 @@ TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) {
TEST(JsonSchemaCompilerErrorTest, OptionalBinaryTypeFailure) {
{
- std::unique_ptr<base::DictionaryValue> value =
- Dictionary("data", new base::Value(base::Value::Type::BINARY));
+ std::unique_ptr<base::DictionaryValue> value = Dictionary(
+ "data", base::MakeUnique<base::Value>(base::Value::Type::BINARY));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalBinaryData>(*value)));
}
{
// There's a bug with silent failures if the key doesn't exist.
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("data", new base::Value(1));
+ Dictionary("data", base::MakeUnique<base::Value>(1));
OptionalBinaryData out;
base::string16 error;
@@ -260,12 +260,12 @@ TEST(JsonSchemaCompilerErrorTest, OptionalBinaryTypeFailure) {
TEST(JsonSchemaCompilerErrorTest, OptionalArrayTypeFailure) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("TheArray", new base::ListValue());
+ Dictionary("TheArray", base::MakeUnique<base::ListValue>());
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("TheArray", new Value(5));
+ Dictionary("TheArray", base::MakeUnique<Value>(5));
ArrayObject out;
base::string16 error;
EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error));
@@ -298,7 +298,7 @@ TEST(JsonSchemaCompilerErrorTest, OptionalUnableToPopulateArray) {
TEST(JsonSchemaCompilerErrorTest, MultiplePopulationErrors) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("TheArray", new Value(5));
+ Dictionary("TheArray", base::MakeUnique<Value>(5));
ArrayObject out;
base::string16 error;
EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error));
@@ -317,13 +317,13 @@ TEST(JsonSchemaCompilerErrorTest, MultiplePopulationErrors) {
TEST(JsonSchemaCompilerErrorTest, TooManyKeys) {
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new base::Value("yes"));
+ Dictionary("string", base::MakeUnique<base::Value>("yes"));
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value)));
}
{
std::unique_ptr<base::DictionaryValue> value =
- Dictionary("string", new base::Value("yes"), "ohno",
- new base::Value("many values"));
+ Dictionary("string", base::MakeUnique<base::Value>("yes"), "ohno",
+ base::MakeUnique<base::Value>("many values"));
EXPECT_TRUE(EqualsUtf16("found unexpected key 'ohno'",
GetPopulateError<TestType>(*value)));
}
« no previous file with comments | « tools/json_schema_compiler/test/choices_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