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 025874055f1d0602ec16f9788633496e6356fb05..5f7480180d816411d56ddb649158e063729935e4 100644 |
--- a/tools/json_schema_compiler/test/error_generation_unittest.cc |
+++ b/tools/json_schema_compiler/test/error_generation_unittest.cc |
@@ -33,12 +33,12 @@ testing::AssertionResult EqualsUtf16(const std::string& expected, |
TEST(JsonSchemaCompilerErrorTest, RequiredPropertyPopulate) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new base::StringValue("bling")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new base::StringValue("bling")); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); |
} |
{ |
- scoped_ptr<base::BinaryValue> value(new base::BinaryValue()); |
+ std::unique_ptr<base::BinaryValue> value(new base::BinaryValue()); |
EXPECT_TRUE(EqualsUtf16("expected dictionary, got binary", |
GetPopulateError<TestType>(*value))); |
} |
@@ -46,12 +46,12 @@ TEST(JsonSchemaCompilerErrorTest, RequiredPropertyPopulate) { |
TEST(JsonSchemaCompilerErrorTest, UnexpectedTypePopulation) { |
{ |
- scoped_ptr<base::ListValue> value(new base::ListValue()); |
+ std::unique_ptr<base::ListValue> value(new base::ListValue()); |
EXPECT_TRUE(EqualsUtf16("", |
GetPopulateError<ChoiceType::Integers>(*value))); |
} |
{ |
- scoped_ptr<base::BinaryValue> value(new base::BinaryValue()); |
+ std::unique_ptr<base::BinaryValue> value(new base::BinaryValue()); |
EXPECT_TRUE(EqualsUtf16("expected integers or integer, got binary", |
GetPopulateError<ChoiceType::Integers>(*value))); |
} |
@@ -61,12 +61,12 @@ TEST(JsonSchemaCompilerErrorTest, UnexpectedTypePopulation) { |
TEST(JsonSchemaCompilerErrorTest, TypeIsRequired) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "integers", new FundamentalValue(5)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("integers", new FundamentalValue(5)); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ChoiceType>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
+ std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
EXPECT_TRUE(EqualsUtf16("'integers' is required", |
GetPopulateError<ChoiceType>(*value))); |
} |
@@ -76,15 +76,14 @@ TEST(JsonSchemaCompilerErrorTest, TypeIsRequired) { |
TEST(JsonSchemaCompilerErrorTest, TooManyParameters) { |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5)); |
base::string16 error; |
EXPECT_TRUE(TestFunction::Params::Create(*params_value, &error)); |
} |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5), |
- new FundamentalValue(5)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5), new FundamentalValue(5)); |
base::string16 error; |
EXPECT_FALSE(TestFunction::Params::Create(*params_value, &error)); |
EXPECT_TRUE(EqualsUtf16("expected 1 arguments, got 2", error)); |
@@ -95,13 +94,13 @@ TEST(JsonSchemaCompilerErrorTest, TooManyParameters) { |
TEST(JsonSchemaCompilerErrorTest, ParamIsRequired) { |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5)); |
base::string16 error; |
EXPECT_TRUE(TestFunction::Params::Create(*params_value, &error)); |
} |
{ |
- scoped_ptr<base::ListValue> params_value = |
+ std::unique_ptr<base::ListValue> params_value = |
List(base::Value::CreateNullValue().release()); |
base::string16 error; |
EXPECT_FALSE(TestFunction::Params::Create(*params_value, &error)); |
@@ -113,13 +112,13 @@ TEST(JsonSchemaCompilerErrorTest, ParamIsRequired) { |
TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new base::StringValue("yes")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new base::StringValue("yes")); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new FundamentalValue(1.1)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new FundamentalValue(1.1)); |
EXPECT_TRUE(EqualsUtf16("'string': expected string, got number", |
GetPopulateError<TestType>(*value))); |
} |
@@ -128,13 +127,13 @@ TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) { |
TEST(JsonSchemaCompilerErrorTest, WrongParameterCreationType) { |
{ |
base::string16 error; |
- scoped_ptr<base::ListValue> params_value = List( |
- new base::StringValue("Yeah!")); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new base::StringValue("Yeah!")); |
EXPECT_TRUE(TestString::Params::Create(*params_value, &error)); |
} |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5)); |
base::string16 error; |
EXPECT_FALSE(TestTypeInObject::Params::Create(*params_value, &error)); |
EXPECT_TRUE(EqualsUtf16("'paramObject': expected dictionary, got integer", |
@@ -144,12 +143,12 @@ TEST(JsonSchemaCompilerErrorTest, WrongParameterCreationType) { |
TEST(JsonSchemaCompilerErrorTest, WrongTypeValueType) { |
{ |
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
+ std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ObjectType>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "otherType", new FundamentalValue(1.1)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("otherType", new FundamentalValue(1.1)); |
ObjectType out; |
base::string16 error; |
EXPECT_TRUE(ObjectType::Populate(*value, &out, &error)); |
@@ -161,15 +160,14 @@ TEST(JsonSchemaCompilerErrorTest, WrongTypeValueType) { |
TEST(JsonSchemaCompilerErrorTest, UnableToPopulateArray) { |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5)); |
EXPECT_TRUE(EqualsUtf16("", |
GetPopulateError<ChoiceType::Integers>(*params_value))); |
} |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5), |
- new FundamentalValue(false)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5), new FundamentalValue(false)); |
EXPECT_TRUE(EqualsUtf16( |
"expected integer, got boolean; unable to populate array 'integers'", |
GetPopulateError<ChoiceType::Integers>(*params_value))); |
@@ -178,13 +176,13 @@ TEST(JsonSchemaCompilerErrorTest, UnableToPopulateArray) { |
TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "data", new base::BinaryValue()); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("data", new base::BinaryValue()); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<BinaryData>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "data", new FundamentalValue(1.1)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("data", new FundamentalValue(1.1)); |
EXPECT_TRUE(EqualsUtf16("'data': expected binary, got number", |
GetPopulateError<BinaryData>(*value))); |
} |
@@ -192,13 +190,13 @@ TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) { |
TEST(JsonSchemaCompilerErrorTest, ListExpected) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "TheArray", new base::ListValue()); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("TheArray", new base::ListValue()); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "TheArray", new FundamentalValue(5)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("TheArray", new FundamentalValue(5)); |
EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", |
GetPopulateError<ArrayObject>(*value))); |
} |
@@ -208,13 +206,13 @@ TEST(JsonSchemaCompilerErrorTest, ListExpected) { |
TEST(JsonSchemaCompilerErrorTest, BadEnumValue) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "enumeration", new base::StringValue("one")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("enumeration", new base::StringValue("one")); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<HasEnumeration>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "enumeration", new base::StringValue("bad sauce")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("enumeration", new base::StringValue("bad sauce")); |
EXPECT_TRUE(EqualsUtf16("'Enumeration': expected \"one\" or \"two\" " |
"or \"three\", got \"bad sauce\"", |
GetPopulateError<HasEnumeration>(*value))); |
@@ -225,13 +223,13 @@ TEST(JsonSchemaCompilerErrorTest, BadEnumValue) { |
TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new base::StringValue("bling")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new base::StringValue("bling")); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalTestType>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new base::FundamentalValue(1)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new base::FundamentalValue(1)); |
OptionalTestType out; |
base::string16 error; |
@@ -244,14 +242,14 @@ TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) { |
TEST(JsonSchemaCompilerErrorTest, OptionalBinaryTypeFailure) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "data", new base::BinaryValue()); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("data", new base::BinaryValue()); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalBinaryData>(*value))); |
} |
{ |
// There's a bug with silent failures if the key doesn't exist. |
- scoped_ptr<base::DictionaryValue> value = Dictionary("data", |
- new base::FundamentalValue(1)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("data", new base::FundamentalValue(1)); |
OptionalBinaryData out; |
base::string16 error; |
@@ -264,13 +262,13 @@ TEST(JsonSchemaCompilerErrorTest, OptionalBinaryTypeFailure) { |
TEST(JsonSchemaCompilerErrorTest, OptionalArrayTypeFailure) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "TheArray", new base::ListValue()); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("TheArray", new base::ListValue()); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "TheArray", new FundamentalValue(5)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("TheArray", new FundamentalValue(5)); |
ArrayObject out; |
base::string16 error; |
EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); |
@@ -282,15 +280,14 @@ TEST(JsonSchemaCompilerErrorTest, OptionalArrayTypeFailure) { |
TEST(JsonSchemaCompilerErrorTest, OptionalUnableToPopulateArray) { |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5)); |
EXPECT_TRUE(EqualsUtf16("", |
GetPopulateError<OptionalChoiceType::Integers>(*params_value))); |
} |
{ |
- scoped_ptr<base::ListValue> params_value = List( |
- new FundamentalValue(5), |
- new FundamentalValue(false)); |
+ std::unique_ptr<base::ListValue> params_value = |
+ List(new FundamentalValue(5), new FundamentalValue(false)); |
OptionalChoiceType::Integers out; |
base::string16 error; |
EXPECT_TRUE(OptionalChoiceType::Integers::Populate(*params_value, &out, |
@@ -304,9 +301,8 @@ TEST(JsonSchemaCompilerErrorTest, OptionalUnableToPopulateArray) { |
TEST(JsonSchemaCompilerErrorTest, MultiplePopulationErrors) { |
{ |
- |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "TheArray", new FundamentalValue(5)); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("TheArray", new FundamentalValue(5)); |
ArrayObject out; |
base::string16 error; |
EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); |
@@ -324,14 +320,14 @@ TEST(JsonSchemaCompilerErrorTest, MultiplePopulationErrors) { |
TEST(JsonSchemaCompilerErrorTest, TooManyKeys) { |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new base::StringValue("yes")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new base::StringValue("yes")); |
EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); |
} |
{ |
- scoped_ptr<base::DictionaryValue> value = Dictionary( |
- "string", new base::StringValue("yes"), |
- "ohno", new base::StringValue("many values")); |
+ std::unique_ptr<base::DictionaryValue> value = |
+ Dictionary("string", new base::StringValue("yes"), "ohno", |
+ new base::StringValue("many values")); |
EXPECT_TRUE(EqualsUtf16("found unexpected key 'ohno'", |
GetPopulateError<TestType>(*value))); |
} |