| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 return testing::AssertionSuccess(); | 29 return testing::AssertionSuccess(); |
| 30 return testing::AssertionFailure() << "\n actual: " << actual | 30 return testing::AssertionFailure() << "\n actual: " << actual |
| 31 << "\n expected: " << expected; | 31 << "\n expected: " << expected; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // GenerateTypePopulate errors | 34 // GenerateTypePopulate errors |
| 35 | 35 |
| 36 TEST(JsonSchemaCompilerErrorTest, RequiredPropertyPopulate) { | 36 TEST(JsonSchemaCompilerErrorTest, RequiredPropertyPopulate) { |
| 37 { | 37 { |
| 38 std::unique_ptr<base::DictionaryValue> value = | 38 std::unique_ptr<base::DictionaryValue> value = |
| 39 Dictionary("string", new base::Value("bling")); | 39 Dictionary("string", base::MakeUnique<base::Value>("bling")); |
| 40 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); | 40 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); |
| 41 } | 41 } |
| 42 { | 42 { |
| 43 auto value = base::MakeUnique<base::Value>(base::Value::Type::BINARY); | 43 auto value = base::MakeUnique<base::Value>(base::Value::Type::BINARY); |
| 44 EXPECT_TRUE(EqualsUtf16("expected dictionary, got binary", | 44 EXPECT_TRUE(EqualsUtf16("expected dictionary, got binary", |
| 45 GetPopulateError<TestType>(*value))); | 45 GetPopulateError<TestType>(*value))); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST(JsonSchemaCompilerErrorTest, UnexpectedTypePopulation) { | 49 TEST(JsonSchemaCompilerErrorTest, UnexpectedTypePopulation) { |
| 50 { | 50 { |
| 51 std::unique_ptr<base::ListValue> value(new base::ListValue()); | 51 std::unique_ptr<base::ListValue> value(new base::ListValue()); |
| 52 EXPECT_TRUE(EqualsUtf16("", | 52 EXPECT_TRUE(EqualsUtf16("", |
| 53 GetPopulateError<ChoiceType::Integers>(*value))); | 53 GetPopulateError<ChoiceType::Integers>(*value))); |
| 54 } | 54 } |
| 55 { | 55 { |
| 56 auto value = base::MakeUnique<base::Value>(base::Value::Type::BINARY); | 56 auto value = base::MakeUnique<base::Value>(base::Value::Type::BINARY); |
| 57 EXPECT_TRUE(EqualsUtf16("expected integers or integer, got binary", | 57 EXPECT_TRUE(EqualsUtf16("expected integers or integer, got binary", |
| 58 GetPopulateError<ChoiceType::Integers>(*value))); | 58 GetPopulateError<ChoiceType::Integers>(*value))); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 // GenerateTypePopulateProperty errors | 62 // GenerateTypePopulateProperty errors |
| 63 | 63 |
| 64 TEST(JsonSchemaCompilerErrorTest, TypeIsRequired) { | 64 TEST(JsonSchemaCompilerErrorTest, TypeIsRequired) { |
| 65 { | 65 { |
| 66 std::unique_ptr<base::DictionaryValue> value = | 66 std::unique_ptr<base::DictionaryValue> value = |
| 67 Dictionary("integers", new Value(5)); | 67 Dictionary("integers", base::MakeUnique<Value>(5)); |
| 68 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ChoiceType>(*value))); | 68 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ChoiceType>(*value))); |
| 69 } | 69 } |
| 70 { | 70 { |
| 71 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 71 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 72 EXPECT_TRUE(EqualsUtf16("'integers' is required", | 72 EXPECT_TRUE(EqualsUtf16("'integers' is required", |
| 73 GetPopulateError<ChoiceType>(*value))); | 73 GetPopulateError<ChoiceType>(*value))); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 // GenerateParamsCheck errors | 77 // GenerateParamsCheck errors |
| (...skipping 27 matching lines...) Expand all Loading... |
| 105 EXPECT_FALSE(TestFunction::Params::Create(*params_value, &error)); | 105 EXPECT_FALSE(TestFunction::Params::Create(*params_value, &error)); |
| 106 EXPECT_TRUE(EqualsUtf16("'num' is required", error)); | 106 EXPECT_TRUE(EqualsUtf16("'num' is required", error)); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 // GeneratePopulateVariableFromValue errors | 110 // GeneratePopulateVariableFromValue errors |
| 111 | 111 |
| 112 TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) { | 112 TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) { |
| 113 { | 113 { |
| 114 std::unique_ptr<base::DictionaryValue> value = | 114 std::unique_ptr<base::DictionaryValue> value = |
| 115 Dictionary("string", new base::Value("yes")); | 115 Dictionary("string", base::MakeUnique<base::Value>("yes")); |
| 116 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); | 116 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); |
| 117 } | 117 } |
| 118 { | 118 { |
| 119 std::unique_ptr<base::DictionaryValue> value = | 119 std::unique_ptr<base::DictionaryValue> value = |
| 120 Dictionary("string", new Value(1.1)); | 120 Dictionary("string", base::MakeUnique<Value>(1.1)); |
| 121 EXPECT_TRUE(EqualsUtf16("'string': expected string, got double", | 121 EXPECT_TRUE(EqualsUtf16("'string': expected string, got double", |
| 122 GetPopulateError<TestType>(*value))); | 122 GetPopulateError<TestType>(*value))); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 TEST(JsonSchemaCompilerErrorTest, WrongParameterCreationType) { | 126 TEST(JsonSchemaCompilerErrorTest, WrongParameterCreationType) { |
| 127 { | 127 { |
| 128 base::string16 error; | 128 base::string16 error; |
| 129 std::unique_ptr<base::ListValue> params_value = | 129 std::unique_ptr<base::ListValue> params_value = |
| 130 List(new base::Value("Yeah!")); | 130 List(new base::Value("Yeah!")); |
| 131 EXPECT_TRUE(TestString::Params::Create(*params_value, &error)); | 131 EXPECT_TRUE(TestString::Params::Create(*params_value, &error)); |
| 132 } | 132 } |
| 133 { | 133 { |
| 134 std::unique_ptr<base::ListValue> params_value = List(new Value(5)); | 134 std::unique_ptr<base::ListValue> params_value = List(new Value(5)); |
| 135 base::string16 error; | 135 base::string16 error; |
| 136 EXPECT_FALSE(TestTypeInObject::Params::Create(*params_value, &error)); | 136 EXPECT_FALSE(TestTypeInObject::Params::Create(*params_value, &error)); |
| 137 EXPECT_TRUE(EqualsUtf16("'paramObject': expected dictionary, got integer", | 137 EXPECT_TRUE(EqualsUtf16("'paramObject': expected dictionary, got integer", |
| 138 error)); | 138 error)); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 TEST(JsonSchemaCompilerErrorTest, WrongTypeValueType) { | 142 TEST(JsonSchemaCompilerErrorTest, WrongTypeValueType) { |
| 143 { | 143 { |
| 144 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 144 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 145 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ObjectType>(*value))); | 145 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ObjectType>(*value))); |
| 146 } | 146 } |
| 147 { | 147 { |
| 148 std::unique_ptr<base::DictionaryValue> value = | 148 std::unique_ptr<base::DictionaryValue> value = |
| 149 Dictionary("otherType", new Value(1.1)); | 149 Dictionary("otherType", base::MakeUnique<Value>(1.1)); |
| 150 ObjectType out; | 150 ObjectType out; |
| 151 base::string16 error; | 151 base::string16 error; |
| 152 EXPECT_TRUE(ObjectType::Populate(*value, &out, &error)); | 152 EXPECT_TRUE(ObjectType::Populate(*value, &out, &error)); |
| 153 EXPECT_TRUE(EqualsUtf16("'otherType': expected dictionary, got double", | 153 EXPECT_TRUE(EqualsUtf16("'otherType': expected dictionary, got double", |
| 154 error)); | 154 error)); |
| 155 EXPECT_EQ(NULL, out.other_type.get()); | 155 EXPECT_EQ(NULL, out.other_type.get()); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 TEST(JsonSchemaCompilerErrorTest, UnableToPopulateArray) { | 159 TEST(JsonSchemaCompilerErrorTest, UnableToPopulateArray) { |
| 160 { | 160 { |
| 161 std::unique_ptr<base::ListValue> params_value = List(new Value(5)); | 161 std::unique_ptr<base::ListValue> params_value = List(new Value(5)); |
| 162 EXPECT_TRUE(EqualsUtf16("", | 162 EXPECT_TRUE(EqualsUtf16("", |
| 163 GetPopulateError<ChoiceType::Integers>(*params_value))); | 163 GetPopulateError<ChoiceType::Integers>(*params_value))); |
| 164 } | 164 } |
| 165 { | 165 { |
| 166 std::unique_ptr<base::ListValue> params_value = | 166 std::unique_ptr<base::ListValue> params_value = |
| 167 List(new Value(5), new Value(false)); | 167 List(new Value(5), new Value(false)); |
| 168 EXPECT_TRUE(EqualsUtf16( | 168 EXPECT_TRUE(EqualsUtf16( |
| 169 "expected integer, got boolean; unable to populate array 'integers'", | 169 "expected integer, got boolean; unable to populate array 'integers'", |
| 170 GetPopulateError<ChoiceType::Integers>(*params_value))); | 170 GetPopulateError<ChoiceType::Integers>(*params_value))); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) { | 174 TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) { |
| 175 { | 175 { |
| 176 std::unique_ptr<base::DictionaryValue> value = | 176 std::unique_ptr<base::DictionaryValue> value = Dictionary( |
| 177 Dictionary("data", new base::Value(base::Value::Type::BINARY)); | 177 "data", base::MakeUnique<base::Value>(base::Value::Type::BINARY)); |
| 178 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<BinaryData>(*value))); | 178 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<BinaryData>(*value))); |
| 179 } | 179 } |
| 180 { | 180 { |
| 181 std::unique_ptr<base::DictionaryValue> value = | 181 std::unique_ptr<base::DictionaryValue> value = |
| 182 Dictionary("data", new Value(1.1)); | 182 Dictionary("data", base::MakeUnique<Value>(1.1)); |
| 183 EXPECT_TRUE(EqualsUtf16("'data': expected binary, got double", | 183 EXPECT_TRUE(EqualsUtf16("'data': expected binary, got double", |
| 184 GetPopulateError<BinaryData>(*value))); | 184 GetPopulateError<BinaryData>(*value))); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 TEST(JsonSchemaCompilerErrorTest, ListExpected) { | 188 TEST(JsonSchemaCompilerErrorTest, ListExpected) { |
| 189 { | 189 { |
| 190 std::unique_ptr<base::DictionaryValue> value = | 190 std::unique_ptr<base::DictionaryValue> value = |
| 191 Dictionary("TheArray", new base::ListValue()); | 191 Dictionary("TheArray", base::MakeUnique<base::ListValue>()); |
| 192 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value))); | 192 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value))); |
| 193 } | 193 } |
| 194 { | 194 { |
| 195 std::unique_ptr<base::DictionaryValue> value = | 195 std::unique_ptr<base::DictionaryValue> value = |
| 196 Dictionary("TheArray", new Value(5)); | 196 Dictionary("TheArray", base::MakeUnique<Value>(5)); |
| 197 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", | 197 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", |
| 198 GetPopulateError<ArrayObject>(*value))); | 198 GetPopulateError<ArrayObject>(*value))); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 // GenerateStringToEnumConversion errors | 202 // GenerateStringToEnumConversion errors |
| 203 | 203 |
| 204 TEST(JsonSchemaCompilerErrorTest, BadEnumValue) { | 204 TEST(JsonSchemaCompilerErrorTest, BadEnumValue) { |
| 205 { | 205 { |
| 206 std::unique_ptr<base::DictionaryValue> value = | 206 std::unique_ptr<base::DictionaryValue> value = |
| 207 Dictionary("enumeration", new base::Value("one")); | 207 Dictionary("enumeration", base::MakeUnique<base::Value>("one")); |
| 208 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<HasEnumeration>(*value))); | 208 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<HasEnumeration>(*value))); |
| 209 } | 209 } |
| 210 { | 210 { |
| 211 std::unique_ptr<base::DictionaryValue> value = | 211 std::unique_ptr<base::DictionaryValue> value = |
| 212 Dictionary("enumeration", new base::Value("bad sauce")); | 212 Dictionary("enumeration", base::MakeUnique<base::Value>("bad sauce")); |
| 213 EXPECT_TRUE(EqualsUtf16("'Enumeration': expected \"one\" or \"two\" " | 213 EXPECT_TRUE(EqualsUtf16("'Enumeration': expected \"one\" or \"two\" " |
| 214 "or \"three\", got \"bad sauce\"", | 214 "or \"three\", got \"bad sauce\"", |
| 215 GetPopulateError<HasEnumeration>(*value))); | 215 GetPopulateError<HasEnumeration>(*value))); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 // Warn but don't fail out errors | 219 // Warn but don't fail out errors |
| 220 | 220 |
| 221 TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) { | 221 TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) { |
| 222 { | 222 { |
| 223 std::unique_ptr<base::DictionaryValue> value = | 223 std::unique_ptr<base::DictionaryValue> value = |
| 224 Dictionary("string", new base::Value("bling")); | 224 Dictionary("string", base::MakeUnique<base::Value>("bling")); |
| 225 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalTestType>(*value))); | 225 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalTestType>(*value))); |
| 226 } | 226 } |
| 227 { | 227 { |
| 228 std::unique_ptr<base::DictionaryValue> value = | 228 std::unique_ptr<base::DictionaryValue> value = |
| 229 Dictionary("string", new base::Value(1)); | 229 Dictionary("string", base::MakeUnique<base::Value>(1)); |
| 230 | 230 |
| 231 OptionalTestType out; | 231 OptionalTestType out; |
| 232 base::string16 error; | 232 base::string16 error; |
| 233 EXPECT_TRUE(OptionalTestType::Populate(*value, &out, &error)); | 233 EXPECT_TRUE(OptionalTestType::Populate(*value, &out, &error)); |
| 234 EXPECT_TRUE(EqualsUtf16("'string': expected string, got integer", | 234 EXPECT_TRUE(EqualsUtf16("'string': expected string, got integer", |
| 235 error)); | 235 error)); |
| 236 EXPECT_EQ(NULL, out.string.get()); | 236 EXPECT_EQ(NULL, out.string.get()); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 TEST(JsonSchemaCompilerErrorTest, OptionalBinaryTypeFailure) { | 240 TEST(JsonSchemaCompilerErrorTest, OptionalBinaryTypeFailure) { |
| 241 { | 241 { |
| 242 std::unique_ptr<base::DictionaryValue> value = | 242 std::unique_ptr<base::DictionaryValue> value = Dictionary( |
| 243 Dictionary("data", new base::Value(base::Value::Type::BINARY)); | 243 "data", base::MakeUnique<base::Value>(base::Value::Type::BINARY)); |
| 244 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalBinaryData>(*value))); | 244 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<OptionalBinaryData>(*value))); |
| 245 } | 245 } |
| 246 { | 246 { |
| 247 // There's a bug with silent failures if the key doesn't exist. | 247 // There's a bug with silent failures if the key doesn't exist. |
| 248 std::unique_ptr<base::DictionaryValue> value = | 248 std::unique_ptr<base::DictionaryValue> value = |
| 249 Dictionary("data", new base::Value(1)); | 249 Dictionary("data", base::MakeUnique<base::Value>(1)); |
| 250 | 250 |
| 251 OptionalBinaryData out; | 251 OptionalBinaryData out; |
| 252 base::string16 error; | 252 base::string16 error; |
| 253 EXPECT_TRUE(OptionalBinaryData::Populate(*value, &out, &error)); | 253 EXPECT_TRUE(OptionalBinaryData::Populate(*value, &out, &error)); |
| 254 EXPECT_TRUE(EqualsUtf16("'data': expected binary, got integer", | 254 EXPECT_TRUE(EqualsUtf16("'data': expected binary, got integer", |
| 255 error)); | 255 error)); |
| 256 EXPECT_EQ(NULL, out.data.get()); | 256 EXPECT_EQ(NULL, out.data.get()); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 TEST(JsonSchemaCompilerErrorTest, OptionalArrayTypeFailure) { | 260 TEST(JsonSchemaCompilerErrorTest, OptionalArrayTypeFailure) { |
| 261 { | 261 { |
| 262 std::unique_ptr<base::DictionaryValue> value = | 262 std::unique_ptr<base::DictionaryValue> value = |
| 263 Dictionary("TheArray", new base::ListValue()); | 263 Dictionary("TheArray", base::MakeUnique<base::ListValue>()); |
| 264 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value))); | 264 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<ArrayObject>(*value))); |
| 265 } | 265 } |
| 266 { | 266 { |
| 267 std::unique_ptr<base::DictionaryValue> value = | 267 std::unique_ptr<base::DictionaryValue> value = |
| 268 Dictionary("TheArray", new Value(5)); | 268 Dictionary("TheArray", base::MakeUnique<Value>(5)); |
| 269 ArrayObject out; | 269 ArrayObject out; |
| 270 base::string16 error; | 270 base::string16 error; |
| 271 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); | 271 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); |
| 272 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", | 272 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", |
| 273 error)); | 273 error)); |
| 274 EXPECT_EQ(NULL, out.the_array.get()); | 274 EXPECT_EQ(NULL, out.the_array.get()); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 TEST(JsonSchemaCompilerErrorTest, OptionalUnableToPopulateArray) { | 278 TEST(JsonSchemaCompilerErrorTest, OptionalUnableToPopulateArray) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 291 EXPECT_TRUE(EqualsUtf16( | 291 EXPECT_TRUE(EqualsUtf16( |
| 292 "expected integer, got boolean; unable to populate array 'integers'", | 292 "expected integer, got boolean; unable to populate array 'integers'", |
| 293 error)); | 293 error)); |
| 294 EXPECT_EQ(NULL, out.as_integer.get()); | 294 EXPECT_EQ(NULL, out.as_integer.get()); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 TEST(JsonSchemaCompilerErrorTest, MultiplePopulationErrors) { | 298 TEST(JsonSchemaCompilerErrorTest, MultiplePopulationErrors) { |
| 299 { | 299 { |
| 300 std::unique_ptr<base::DictionaryValue> value = | 300 std::unique_ptr<base::DictionaryValue> value = |
| 301 Dictionary("TheArray", new Value(5)); | 301 Dictionary("TheArray", base::MakeUnique<Value>(5)); |
| 302 ArrayObject out; | 302 ArrayObject out; |
| 303 base::string16 error; | 303 base::string16 error; |
| 304 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); | 304 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); |
| 305 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", | 305 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer", |
| 306 error)); | 306 error)); |
| 307 EXPECT_EQ(NULL, out.the_array.get()); | 307 EXPECT_EQ(NULL, out.the_array.get()); |
| 308 | 308 |
| 309 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); | 309 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); |
| 310 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer; " | 310 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer; " |
| 311 "'TheArray': expected list, got integer", | 311 "'TheArray': expected list, got integer", |
| 312 error)); | 312 error)); |
| 313 EXPECT_EQ(NULL, out.the_array.get()); | 313 EXPECT_EQ(NULL, out.the_array.get()); |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 TEST(JsonSchemaCompilerErrorTest, TooManyKeys) { | 317 TEST(JsonSchemaCompilerErrorTest, TooManyKeys) { |
| 318 { | 318 { |
| 319 std::unique_ptr<base::DictionaryValue> value = | 319 std::unique_ptr<base::DictionaryValue> value = |
| 320 Dictionary("string", new base::Value("yes")); | 320 Dictionary("string", base::MakeUnique<base::Value>("yes")); |
| 321 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); | 321 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<TestType>(*value))); |
| 322 } | 322 } |
| 323 { | 323 { |
| 324 std::unique_ptr<base::DictionaryValue> value = | 324 std::unique_ptr<base::DictionaryValue> value = |
| 325 Dictionary("string", new base::Value("yes"), "ohno", | 325 Dictionary("string", base::MakeUnique<base::Value>("yes"), "ohno", |
| 326 new base::Value("many values")); | 326 base::MakeUnique<base::Value>("many values")); |
| 327 EXPECT_TRUE(EqualsUtf16("found unexpected key 'ohno'", | 327 EXPECT_TRUE(EqualsUtf16("found unexpected key 'ohno'", |
| 328 GetPopulateError<TestType>(*value))); | 328 GetPopulateError<TestType>(*value))); |
| 329 } | 329 } |
| 330 } | 330 } |
| OLD | NEW |