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

Side by Side Diff: chrome/common/json_schema_validator_unittest_base.cc

Issue 10696034: Share JSON schema constants. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 3 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 | « chrome/common/json_schema_validator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/common/json_schema_validator_unittest_base.h" 5 #include "chrome/common/json_schema_validator_unittest_base.h"
6 6
7 #include <cfloat> 7 #include <cfloat>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_file_value_serializer.h" 12 #include "base/json/json_file_value_serializer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/json_schema_constants.h"
19 #include "chrome/common/json_schema_validator.h" 20 #include "chrome/common/json_schema_validator.h"
20 21
22 namespace schema = json_schema_constants;
23
21 namespace { 24 namespace {
22 25
23 #define TEST_SOURCE base::StringPrintf("%s:%i", __FILE__, __LINE__) 26 #define TEST_SOURCE base::StringPrintf("%s:%i", __FILE__, __LINE__)
24 27
25 Value* LoadValue(const std::string& filename) { 28 Value* LoadValue(const std::string& filename) {
26 FilePath path; 29 FilePath path;
27 PathService::Get(chrome::DIR_TEST_DATA, &path); 30 PathService::Get(chrome::DIR_TEST_DATA, &path);
28 path = path.AppendASCII("json_schema_validator").AppendASCII(filename); 31 path = path.AppendASCII("json_schema_validator").AppendASCII(filename);
29 EXPECT_TRUE(file_util::PathExists(path)); 32 EXPECT_TRUE(file_util::PathExists(path));
30 33
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 90
88 ASSERT_TRUE(schema.get()); 91 ASSERT_TRUE(schema.get());
89 ASSERT_TRUE(instance.get()); 92 ASSERT_TRUE(instance.get());
90 93
91 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 94 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
92 instance->Remove(instance->GetSize() - 1, NULL); 95 instance->Remove(instance->GetSize() - 1, NULL);
93 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 96 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
94 instance->Append(new DictionaryValue()); 97 instance->Append(new DictionaryValue());
95 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1", 98 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
96 JSONSchemaValidator::FormatErrorMessage( 99 JSONSchemaValidator::FormatErrorMessage(
97 JSONSchemaValidator::kInvalidType, "number", "object")); 100 JSONSchemaValidator::kInvalidType,
101 schema::kNumber,
102 schema::kObject));
98 instance->Remove(instance->GetSize() - 1, NULL); 103 instance->Remove(instance->GetSize() - 1, NULL);
99 104
100 DictionaryValue* item = NULL; 105 DictionaryValue* item = NULL;
101 ASSERT_TRUE(instance->GetDictionary(0, &item)); 106 ASSERT_TRUE(instance->GetDictionary(0, &item));
102 item->SetString("url", "xxxxxxxxxxx"); 107 item->SetString("url", "xxxxxxxxxxx");
103 108
104 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, 109 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
105 "0.url", 110 "0.url",
106 JSONSchemaValidator::FormatErrorMessage( 111 JSONSchemaValidator::FormatErrorMessage(
107 JSONSchemaValidator::kStringMaxLength, "10")); 112 JSONSchemaValidator::kStringMaxLength, "10"));
108 } 113 }
109 114
110 void JSONSchemaValidatorTestBase::TestStringPattern() { 115 void JSONSchemaValidatorTestBase::TestStringPattern() {
111 // Regex patterns not supported in CPP validator. 116 // Regex patterns not supported in CPP validator.
112 if (type_ == CPP) 117 if (type_ == CPP)
113 return; 118 return;
114 119
115 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 120 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
116 schema->SetString("type", "string"); 121 schema->SetString(schema::kType, schema::kString);
117 schema->SetString("pattern", "foo+"); 122 schema->SetString(schema::kPattern, "foo+");
118 123
119 ExpectValid(TEST_SOURCE, 124 ExpectValid(TEST_SOURCE,
120 scoped_ptr<Value>(Value::CreateStringValue("foo")).get(), 125 scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
121 schema.get(), NULL); 126 schema.get(), NULL);
122 ExpectValid(TEST_SOURCE, 127 ExpectValid(TEST_SOURCE,
123 scoped_ptr<Value>(Value::CreateStringValue("foooooo")).get(), 128 scoped_ptr<Value>(Value::CreateStringValue("foooooo")).get(),
124 schema.get(), NULL); 129 schema.get(), NULL);
125 ExpectNotValid(TEST_SOURCE, 130 ExpectNotValid(TEST_SOURCE,
126 scoped_ptr<Value>(Value::CreateStringValue("bar")).get(), 131 scoped_ptr<Value>(Value::CreateStringValue("bar")).get(),
127 schema.get(), NULL, "", 132 schema.get(), NULL, "",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ExpectNotValid(TEST_SOURCE, instance.get(), 180 ExpectNotValid(TEST_SOURCE, instance.get(),
176 schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice); 181 schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
177 } 182 }
178 183
179 void JSONSchemaValidatorTestBase::TestExtends() { 184 void JSONSchemaValidatorTestBase::TestExtends() {
180 // TODO(aa): JS only 185 // TODO(aa): JS only
181 } 186 }
182 187
183 void JSONSchemaValidatorTestBase::TestObject() { 188 void JSONSchemaValidatorTestBase::TestObject() {
184 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 189 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
185 schema->SetString("type", "object"); 190 schema->SetString(schema::kType, schema::kObject);
186 schema->SetString("properties.foo.type", "string"); 191 schema->SetString("properties.foo.type", schema::kString);
187 schema->SetString("properties.bar.type", "integer"); 192 schema->SetString("properties.bar.type", schema::kInteger);
188 193
189 scoped_ptr<DictionaryValue> instance(new DictionaryValue()); 194 scoped_ptr<DictionaryValue> instance(new DictionaryValue());
190 instance->SetString("foo", "foo"); 195 instance->SetString("foo", "foo");
191 instance->SetInteger("bar", 42); 196 instance->SetInteger("bar", 42);
192 197
193 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 198 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
194 199
195 instance->SetBoolean("extra", true); 200 instance->SetBoolean("extra", true);
196 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, 201 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
197 "extra", JSONSchemaValidator::kUnexpectedProperty); 202 "extra", JSONSchemaValidator::kUnexpectedProperty);
198 203
199 instance->Remove("extra", NULL); 204 instance->Remove("extra", NULL);
200 instance->Remove("bar", NULL); 205 instance->Remove("bar", NULL);
201 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "bar", 206 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "bar",
202 JSONSchemaValidator::kObjectPropertyIsRequired); 207 JSONSchemaValidator::kObjectPropertyIsRequired);
203 208
204 instance->SetString("bar", "42"); 209 instance->SetString("bar", "42");
205 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "bar", 210 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "bar",
206 JSONSchemaValidator::FormatErrorMessage( 211 JSONSchemaValidator::FormatErrorMessage(
207 JSONSchemaValidator::kInvalidType, "integer", "string")); 212 JSONSchemaValidator::kInvalidType,
213 schema::kInteger,
214 schema::kString));
208 215
209 DictionaryValue* additional_properties = new DictionaryValue(); 216 DictionaryValue* additional_properties = new DictionaryValue();
210 additional_properties->SetString("type", "any"); 217 additional_properties->SetString(schema::kType, schema::kAny);
211 schema->Set("additionalProperties", additional_properties); 218 schema->Set(schema::kAdditionalProperties, additional_properties);
212 219
213 instance->SetInteger("bar", 42); 220 instance->SetInteger("bar", 42);
214 instance->SetBoolean("extra", true); 221 instance->SetBoolean("extra", true);
215 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 222 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
216 223
217 instance->SetString("extra", "foo"); 224 instance->SetString("extra", "foo");
218 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 225 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
219 226
220 additional_properties->SetString("type", "boolean"); 227 additional_properties->SetString(schema::kType, schema::kBoolean);
221 instance->SetBoolean("extra", true); 228 instance->SetBoolean("extra", true);
222 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 229 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
223 230
224 instance->SetString("extra", "foo"); 231 instance->SetString("extra", "foo");
225 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, 232 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
226 "extra", JSONSchemaValidator::FormatErrorMessage( 233 "extra", JSONSchemaValidator::FormatErrorMessage(
227 JSONSchemaValidator::kInvalidType, "boolean", "string")); 234 JSONSchemaValidator::kInvalidType,
235 schema::kBoolean,
236 schema::kString));
228 237
229 DictionaryValue* properties = NULL; 238 DictionaryValue* properties = NULL;
230 DictionaryValue* bar_property = NULL; 239 DictionaryValue* bar_property = NULL;
231 ASSERT_TRUE(schema->GetDictionary("properties", &properties)); 240 ASSERT_TRUE(schema->GetDictionary(schema::kProperties, &properties));
232 ASSERT_TRUE(properties->GetDictionary("bar", &bar_property)); 241 ASSERT_TRUE(properties->GetDictionary("bar", &bar_property));
233 242
234 bar_property->SetBoolean("optional", true); 243 bar_property->SetBoolean(schema::kOptional, true);
235 instance->Remove("extra", NULL); 244 instance->Remove("extra", NULL);
236 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 245 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
237 instance->Remove("bar", NULL); 246 instance->Remove("bar", NULL);
238 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 247 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
239 instance->Set("bar", Value::CreateNullValue()); 248 instance->Set("bar", Value::CreateNullValue());
240 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, 249 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
241 "bar", JSONSchemaValidator::FormatErrorMessage( 250 "bar", JSONSchemaValidator::FormatErrorMessage(
242 JSONSchemaValidator::kInvalidType, "integer", "null")); 251 JSONSchemaValidator::kInvalidType,
252 schema::kInteger,
253 schema::kNull));
243 instance->SetString("bar", "42"); 254 instance->SetString("bar", "42");
244 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, 255 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
245 "bar", JSONSchemaValidator::FormatErrorMessage( 256 "bar", JSONSchemaValidator::FormatErrorMessage(
246 JSONSchemaValidator::kInvalidType, "integer", "string")); 257 JSONSchemaValidator::kInvalidType,
258 schema::kInteger,
259 schema::kString));
247 } 260 }
248 261
249 void JSONSchemaValidatorTestBase::TestTypeReference() { 262 void JSONSchemaValidatorTestBase::TestTypeReference() {
250 scoped_ptr<ListValue> types(LoadList("reference_types.json")); 263 scoped_ptr<ListValue> types(LoadList("reference_types.json"));
251 ASSERT_TRUE(types.get()); 264 ASSERT_TRUE(types.get());
252 265
253 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 266 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
254 schema->SetString("type", "object"); 267 schema->SetString(schema::kType, schema::kObject);
255 schema->SetString("properties.foo.type", "string"); 268 schema->SetString("properties.foo.type", schema::kString);
256 schema->SetString("properties.bar.$ref", "Max10Int"); 269 schema->SetString("properties.bar.$ref", "Max10Int");
257 schema->SetString("properties.baz.$ref", "MinLengthString"); 270 schema->SetString("properties.baz.$ref", "MinLengthString");
258 271
259 scoped_ptr<DictionaryValue> schema_inline(new DictionaryValue()); 272 scoped_ptr<DictionaryValue> schema_inline(new DictionaryValue());
260 schema_inline->SetString("type", "object"); 273 schema_inline->SetString(schema::kType, schema::kObject);
261 schema_inline->SetString("properties.foo.type", "string"); 274 schema_inline->SetString("properties.foo.type", schema::kString);
262 schema_inline->SetString("properties.bar.id", "NegativeInt"); 275 schema_inline->SetString("properties.bar.id", "NegativeInt");
263 schema_inline->SetString("properties.bar.type", "integer"); 276 schema_inline->SetString("properties.bar.type", schema::kInteger);
264 schema_inline->SetInteger("properties.bar.maximum", 0); 277 schema_inline->SetInteger("properties.bar.maximum", 0);
265 schema_inline->SetString("properties.baz.$ref", "NegativeInt"); 278 schema_inline->SetString("properties.baz.$ref", "NegativeInt");
266 279
267 scoped_ptr<DictionaryValue> instance(new DictionaryValue()); 280 scoped_ptr<DictionaryValue> instance(new DictionaryValue());
268 instance->SetString("foo", "foo"); 281 instance->SetString("foo", "foo");
269 instance->SetInteger("bar", 4); 282 instance->SetInteger("bar", 4);
270 instance->SetString("baz", "ab"); 283 instance->SetString("baz", "ab");
271 284
272 scoped_ptr<DictionaryValue> instance_inline(new DictionaryValue()); 285 scoped_ptr<DictionaryValue> instance_inline(new DictionaryValue());
273 instance_inline->SetString("foo", "foo"); 286 instance_inline->SetString("foo", "foo");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 335
323 instance->Remove(1, NULL); 336 instance->Remove(1, NULL);
324 instance->Remove(1, NULL); 337 instance->Remove(1, NULL);
325 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1", 338 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
326 JSONSchemaValidator::kArrayItemRequired); 339 JSONSchemaValidator::kArrayItemRequired);
327 340
328 instance->Set(0, Value::CreateIntegerValue(42)); 341 instance->Set(0, Value::CreateIntegerValue(42));
329 instance->Append(Value::CreateIntegerValue(42)); 342 instance->Append(Value::CreateIntegerValue(42));
330 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0", 343 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0",
331 JSONSchemaValidator::FormatErrorMessage( 344 JSONSchemaValidator::FormatErrorMessage(
332 JSONSchemaValidator::kInvalidType, "string", "integer")); 345 JSONSchemaValidator::kInvalidType,
346 schema::kString,
347 schema::kInteger));
333 348
334 DictionaryValue* additional_properties = new DictionaryValue(); 349 DictionaryValue* additional_properties = new DictionaryValue();
335 additional_properties->SetString("type", "any"); 350 additional_properties->SetString(schema::kType, schema::kAny);
336 schema->Set("additionalProperties", additional_properties); 351 schema->Set(schema::kAdditionalProperties, additional_properties);
337 instance->Set(0, Value::CreateStringValue("42")); 352 instance->Set(0, Value::CreateStringValue("42"));
338 instance->Append(Value::CreateStringValue("anything")); 353 instance->Append(Value::CreateStringValue("anything"));
339 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 354 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
340 instance->Set(2, new ListValue()); 355 instance->Set(2, new ListValue());
341 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 356 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
342 357
343 additional_properties->SetString("type", "boolean"); 358 additional_properties->SetString(schema::kType, schema::kBoolean);
344 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "2", 359 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "2",
345 JSONSchemaValidator::FormatErrorMessage( 360 JSONSchemaValidator::FormatErrorMessage(
346 JSONSchemaValidator::kInvalidType, "boolean", "array")); 361 JSONSchemaValidator::kInvalidType,
362 schema::kBoolean,
363 schema::kArray));
347 instance->Set(2, Value::CreateBooleanValue(false)); 364 instance->Set(2, Value::CreateBooleanValue(false));
348 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 365 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
349 366
350 ListValue* items_schema = NULL; 367 ListValue* items_schema = NULL;
351 DictionaryValue* item0_schema = NULL; 368 DictionaryValue* item0_schema = NULL;
352 ASSERT_TRUE(schema->GetList("items", &items_schema)); 369 ASSERT_TRUE(schema->GetList(schema::kItems, &items_schema));
353 ASSERT_TRUE(items_schema->GetDictionary(0, &item0_schema)); 370 ASSERT_TRUE(items_schema->GetDictionary(0, &item0_schema));
354 item0_schema->SetBoolean("optional", true); 371 item0_schema->SetBoolean(schema::kOptional, true);
355 instance->Remove(2, NULL); 372 instance->Remove(2, NULL);
356 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 373 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
357 // TODO(aa): I think this is inconsistent with the handling of NULL+optional 374 // TODO(aa): I think this is inconsistent with the handling of NULL+optional
358 // for objects. 375 // for objects.
359 instance->Set(0, Value::CreateNullValue()); 376 instance->Set(0, Value::CreateNullValue());
360 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 377 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
361 instance->Set(0, Value::CreateIntegerValue(42)); 378 instance->Set(0, Value::CreateIntegerValue(42));
362 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0", 379 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0",
363 JSONSchemaValidator::FormatErrorMessage( 380 JSONSchemaValidator::FormatErrorMessage(
364 JSONSchemaValidator::kInvalidType, "string", "integer")); 381 JSONSchemaValidator::kInvalidType,
382 schema::kString,
383 schema::kInteger));
365 } 384 }
366 385
367 void JSONSchemaValidatorTestBase::TestArrayNonTuple() { 386 void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
368 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 387 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
369 schema->SetString("type", "array"); 388 schema->SetString(schema::kType, schema::kArray);
370 schema->SetString("items.type", "string"); 389 schema->SetString("items.type", schema::kString);
371 schema->SetInteger("minItems", 2); 390 schema->SetInteger(schema::kMinItems, 2);
372 schema->SetInteger("maxItems", 3); 391 schema->SetInteger(schema::kMaxItems, 3);
373 392
374 scoped_ptr<ListValue> instance(new ListValue()); 393 scoped_ptr<ListValue> instance(new ListValue());
375 instance->Append(Value::CreateStringValue("x")); 394 instance->Append(Value::CreateStringValue("x"));
376 instance->Append(Value::CreateStringValue("x")); 395 instance->Append(Value::CreateStringValue("x"));
377 396
378 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 397 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
379 instance->Append(Value::CreateStringValue("x")); 398 instance->Append(Value::CreateStringValue("x"));
380 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); 399 ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
381 400
382 instance->Append(Value::CreateStringValue("x")); 401 instance->Append(Value::CreateStringValue("x"));
383 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "", 402 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
384 JSONSchemaValidator::FormatErrorMessage( 403 JSONSchemaValidator::FormatErrorMessage(
385 JSONSchemaValidator::kArrayMaxItems, "3")); 404 JSONSchemaValidator::kArrayMaxItems, "3"));
386 instance->Remove(1, NULL); 405 instance->Remove(1, NULL);
387 instance->Remove(1, NULL); 406 instance->Remove(1, NULL);
388 instance->Remove(1, NULL); 407 instance->Remove(1, NULL);
389 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "", 408 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
390 JSONSchemaValidator::FormatErrorMessage( 409 JSONSchemaValidator::FormatErrorMessage(
391 JSONSchemaValidator::kArrayMinItems, "2")); 410 JSONSchemaValidator::kArrayMinItems, "2"));
392 411
393 instance->Remove(1, NULL); 412 instance->Remove(1, NULL);
394 instance->Append(Value::CreateIntegerValue(42)); 413 instance->Append(Value::CreateIntegerValue(42));
395 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1", 414 ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
396 JSONSchemaValidator::FormatErrorMessage( 415 JSONSchemaValidator::FormatErrorMessage(
397 JSONSchemaValidator::kInvalidType, "string", "integer")); 416 JSONSchemaValidator::kInvalidType,
417 schema::kString,
418 schema::kInteger));
398 } 419 }
399 420
400 void JSONSchemaValidatorTestBase::TestString() { 421 void JSONSchemaValidatorTestBase::TestString() {
401 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 422 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
402 schema->SetString("type", "string"); 423 schema->SetString(schema::kType, schema::kString);
403 schema->SetInteger("minLength", 1); 424 schema->SetInteger(schema::kMinLength, 1);
404 schema->SetInteger("maxLength", 10); 425 schema->SetInteger(schema::kMaxLength, 10);
405 426
406 ExpectValid(TEST_SOURCE, 427 ExpectValid(TEST_SOURCE,
407 scoped_ptr<Value>(Value::CreateStringValue("x")).get(), 428 scoped_ptr<Value>(Value::CreateStringValue("x")).get(),
408 schema.get(), NULL); 429 schema.get(), NULL);
409 ExpectValid(TEST_SOURCE, 430 ExpectValid(TEST_SOURCE,
410 scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxx")).get(), 431 scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxx")).get(),
411 schema.get(), NULL); 432 schema.get(), NULL);
412 433
413 ExpectNotValid(TEST_SOURCE, 434 ExpectNotValid(TEST_SOURCE,
414 scoped_ptr<Value>(Value::CreateStringValue("")).get(), 435 scoped_ptr<Value>(Value::CreateStringValue("")).get(),
415 schema.get(), NULL, "", 436 schema.get(), NULL, "",
416 JSONSchemaValidator::FormatErrorMessage( 437 JSONSchemaValidator::FormatErrorMessage(
417 JSONSchemaValidator::kStringMinLength, "1")); 438 JSONSchemaValidator::kStringMinLength, "1"));
418 ExpectNotValid( 439 ExpectNotValid(
419 TEST_SOURCE, 440 TEST_SOURCE,
420 scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxxx")).get(), 441 scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxxx")).get(),
421 schema.get(), NULL, "", 442 schema.get(), NULL, "",
422 JSONSchemaValidator::FormatErrorMessage( 443 JSONSchemaValidator::FormatErrorMessage(
423 JSONSchemaValidator::kStringMaxLength, "10")); 444 JSONSchemaValidator::kStringMaxLength, "10"));
424 445
425 } 446 }
426 447
427 void JSONSchemaValidatorTestBase::TestNumber() { 448 void JSONSchemaValidatorTestBase::TestNumber() {
428 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 449 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
429 schema->SetString("type", "number"); 450 schema->SetString(schema::kType, schema::kNumber);
430 schema->SetInteger("minimum", 1); 451 schema->SetInteger(schema::kMinimum, 1);
431 schema->SetInteger("maximum", 100); 452 schema->SetInteger(schema::kMaximum, 100);
432 schema->SetInteger("maxDecimal", 2); 453 schema->SetInteger("maxDecimal", 2);
433 454
434 ExpectValid(TEST_SOURCE, 455 ExpectValid(TEST_SOURCE,
435 scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(), 456 scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(),
436 schema.get(), NULL); 457 schema.get(), NULL);
437 ExpectValid(TEST_SOURCE, 458 ExpectValid(TEST_SOURCE,
438 scoped_ptr<Value>(Value::CreateIntegerValue(50)).get(), 459 scoped_ptr<Value>(Value::CreateIntegerValue(50)).get(),
439 schema.get(), NULL); 460 schema.get(), NULL);
440 ExpectValid(TEST_SOURCE, 461 ExpectValid(TEST_SOURCE,
441 scoped_ptr<Value>(Value::CreateIntegerValue(100)).get(), 462 scoped_ptr<Value>(Value::CreateIntegerValue(100)).get(),
(...skipping 10 matching lines...) Expand all
452 JSONSchemaValidator::kNumberMinimum, "1")); 473 JSONSchemaValidator::kNumberMinimum, "1"));
453 ExpectNotValid( 474 ExpectNotValid(
454 TEST_SOURCE, 475 TEST_SOURCE,
455 scoped_ptr<Value>(Value::CreateDoubleValue(100.1)).get(), 476 scoped_ptr<Value>(Value::CreateDoubleValue(100.1)).get(),
456 schema.get(), NULL, "", 477 schema.get(), NULL, "",
457 JSONSchemaValidator::FormatErrorMessage( 478 JSONSchemaValidator::FormatErrorMessage(
458 JSONSchemaValidator::kNumberMaximum, "100")); 479 JSONSchemaValidator::kNumberMaximum, "100"));
459 } 480 }
460 481
461 void JSONSchemaValidatorTestBase::TestTypeClassifier() { 482 void JSONSchemaValidatorTestBase::TestTypeClassifier() {
462 EXPECT_EQ("boolean", JSONSchemaValidator::GetJSONSchemaType( 483 EXPECT_EQ(std::string(schema::kBoolean),
463 scoped_ptr<Value>(Value::CreateBooleanValue(true)).get())); 484 JSONSchemaValidator::GetJSONSchemaType(
464 EXPECT_EQ("boolean", JSONSchemaValidator::GetJSONSchemaType( 485 scoped_ptr<Value>(Value::CreateBooleanValue(true)).get()));
465 scoped_ptr<Value>(Value::CreateBooleanValue(false)).get())); 486 EXPECT_EQ(std::string(schema::kBoolean),
487 JSONSchemaValidator::GetJSONSchemaType(
488 scoped_ptr<Value>(Value::CreateBooleanValue(false)).get()));
466 489
467 // It doesn't matter whether the C++ type is 'integer' or 'real'. If the 490 // It doesn't matter whether the C++ type is 'integer' or 'real'. If the
468 // number is integral and within the representable range of integers in 491 // number is integral and within the representable range of integers in
469 // double, it's classified as 'integer'. 492 // double, it's classified as 'integer'.
470 EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( 493 EXPECT_EQ(std::string(schema::kInteger),
471 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get())); 494 JSONSchemaValidator::GetJSONSchemaType(
472 EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( 495 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get()));
473 scoped_ptr<Value>(Value::CreateIntegerValue(0)).get())); 496 EXPECT_EQ(std::string(schema::kInteger),
474 EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( 497 JSONSchemaValidator::GetJSONSchemaType(
475 scoped_ptr<Value>(Value::CreateDoubleValue(42)).get())); 498 scoped_ptr<Value>(Value::CreateIntegerValue(0)).get()));
476 EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( 499 EXPECT_EQ(std::string(schema::kInteger),
477 scoped_ptr<Value>( 500 JSONSchemaValidator::GetJSONSchemaType(
478 Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get())); 501 scoped_ptr<Value>(Value::CreateDoubleValue(42)).get()));
479 EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( 502 EXPECT_EQ(std::string(schema::kInteger),
480 scoped_ptr<Value>( 503 JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
481 Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get())); 504 Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get()));
505 EXPECT_EQ(std::string(schema::kInteger),
506 JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
507 Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get()));
482 508
483 // "number" is only used for non-integral numbers, or numbers beyond what 509 // "number" is only used for non-integral numbers, or numbers beyond what
484 // double can accurately represent. 510 // double can accurately represent.
485 EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType( 511 EXPECT_EQ(std::string(schema::kNumber),
486 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get())); 512 JSONSchemaValidator::GetJSONSchemaType(
487 EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType( 513 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get()));
488 scoped_ptr<Value>(Value::CreateDoubleValue( 514 EXPECT_EQ(std::string(schema::kNumber),
489 pow(2.0, DBL_MANT_DIG) * 2)).get())); 515 JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
490 EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType( 516 Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG) * 2)).get()));
491 scoped_ptr<Value>(Value::CreateDoubleValue( 517 EXPECT_EQ(std::string(schema::kNumber),
492 pow(-2.0, DBL_MANT_DIG) * 2)).get())); 518 JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
519 Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG) * 2)).get()));
493 520
494 EXPECT_EQ("string", JSONSchemaValidator::GetJSONSchemaType( 521 EXPECT_EQ(std::string(schema::kString),
495 scoped_ptr<Value>(Value::CreateStringValue("foo")).get())); 522 JSONSchemaValidator::GetJSONSchemaType(
496 EXPECT_EQ("array", JSONSchemaValidator::GetJSONSchemaType( 523 scoped_ptr<Value>(Value::CreateStringValue("foo")).get()));
497 scoped_ptr<Value>(new ListValue()).get())); 524 EXPECT_EQ(std::string(schema::kArray),
498 EXPECT_EQ("object", JSONSchemaValidator::GetJSONSchemaType( 525 JSONSchemaValidator::GetJSONSchemaType(
499 scoped_ptr<Value>(new DictionaryValue()).get())); 526 scoped_ptr<Value>(new ListValue()).get()));
500 EXPECT_EQ("null", JSONSchemaValidator::GetJSONSchemaType( 527 EXPECT_EQ(std::string(schema::kObject),
501 scoped_ptr<Value>(Value::CreateNullValue()).get())); 528 JSONSchemaValidator::GetJSONSchemaType(
529 scoped_ptr<Value>(new DictionaryValue()).get()));
530 EXPECT_EQ(std::string(schema::kNull),
531 JSONSchemaValidator::GetJSONSchemaType(
532 scoped_ptr<Value>(Value::CreateNullValue()).get()));
502 } 533 }
503 534
504 void JSONSchemaValidatorTestBase::TestTypes() { 535 void JSONSchemaValidatorTestBase::TestTypes() {
505 scoped_ptr<DictionaryValue> schema(new DictionaryValue()); 536 scoped_ptr<DictionaryValue> schema(new DictionaryValue());
506 537
507 // valid 538 // valid
508 schema->SetString("type", "object"); 539 schema->SetString(schema::kType, schema::kObject);
509 ExpectValid(TEST_SOURCE, scoped_ptr<Value>(new DictionaryValue()).get(), 540 ExpectValid(TEST_SOURCE, scoped_ptr<Value>(new DictionaryValue()).get(),
510 schema.get(), NULL); 541 schema.get(), NULL);
511 542
512 schema->SetString("type", "array"); 543 schema->SetString(schema::kType, schema::kArray);
513 ExpectValid(TEST_SOURCE, scoped_ptr<Value>(new ListValue()).get(), 544 ExpectValid(TEST_SOURCE, scoped_ptr<Value>(new ListValue()).get(),
514 schema.get(), NULL); 545 schema.get(), NULL);
515 546
516 schema->SetString("type", "string"); 547 schema->SetString(schema::kType, schema::kString);
517 ExpectValid(TEST_SOURCE, 548 ExpectValid(TEST_SOURCE,
518 scoped_ptr<Value>(Value::CreateStringValue("foobar")).get(), 549 scoped_ptr<Value>(Value::CreateStringValue("foobar")).get(),
519 schema.get(), NULL); 550 schema.get(), NULL);
520 551
521 schema->SetString("type", "number"); 552 schema->SetString(schema::kType, schema::kNumber);
522 ExpectValid(TEST_SOURCE, 553 ExpectValid(TEST_SOURCE,
523 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(), 554 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
524 schema.get(), NULL); 555 schema.get(), NULL);
525 ExpectValid(TEST_SOURCE, 556 ExpectValid(TEST_SOURCE,
526 scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(), 557 scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(),
527 schema.get(), NULL); 558 schema.get(), NULL);
528 ExpectValid(TEST_SOURCE, 559 ExpectValid(TEST_SOURCE,
529 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(), 560 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
530 schema.get(), NULL); 561 schema.get(), NULL);
531 ExpectValid(TEST_SOURCE, 562 ExpectValid(TEST_SOURCE,
532 scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(), 563 scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(),
533 schema.get(), NULL); 564 schema.get(), NULL);
534 565
535 schema->SetString("type", "integer"); 566 schema->SetString(schema::kType, schema::kInteger);
536 ExpectValid(TEST_SOURCE, 567 ExpectValid(TEST_SOURCE,
537 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(), 568 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
538 schema.get(), NULL); 569 schema.get(), NULL);
539 ExpectValid(TEST_SOURCE, 570 ExpectValid(TEST_SOURCE,
540 scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(), 571 scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(),
541 schema.get(), NULL); 572 schema.get(), NULL);
542 ExpectValid(TEST_SOURCE, 573 ExpectValid(TEST_SOURCE,
543 scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(), 574 scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(),
544 schema.get(), NULL); 575 schema.get(), NULL);
545 ExpectValid(TEST_SOURCE, 576 ExpectValid(TEST_SOURCE,
546 scoped_ptr<Value>( 577 scoped_ptr<Value>(
547 Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get(), 578 Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get(),
548 schema.get(), NULL); 579 schema.get(), NULL);
549 ExpectValid(TEST_SOURCE, 580 ExpectValid(TEST_SOURCE,
550 scoped_ptr<Value>( 581 scoped_ptr<Value>(
551 Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get(), 582 Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get(),
552 schema.get(), NULL); 583 schema.get(), NULL);
553 584
554 schema->SetString("type", "boolean"); 585 schema->SetString(schema::kType, schema::kBoolean);
555 ExpectValid(TEST_SOURCE, 586 ExpectValid(TEST_SOURCE,
556 scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(), 587 scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
557 schema.get(), NULL); 588 schema.get(), NULL);
558 ExpectValid(TEST_SOURCE, 589 ExpectValid(TEST_SOURCE,
559 scoped_ptr<Value>(Value::CreateBooleanValue(true)).get(), 590 scoped_ptr<Value>(Value::CreateBooleanValue(true)).get(),
560 schema.get(), NULL); 591 schema.get(), NULL);
561 592
562 schema->SetString("type", "null"); 593 schema->SetString(schema::kType, schema::kNull);
563 ExpectValid(TEST_SOURCE, 594 ExpectValid(TEST_SOURCE,
564 scoped_ptr<Value>(Value::CreateNullValue()).get(), 595 scoped_ptr<Value>(Value::CreateNullValue()).get(),
565 schema.get(), NULL); 596 schema.get(), NULL);
566 597
567 // not valid 598 // not valid
568 schema->SetString("type", "object"); 599 schema->SetString(schema::kType, schema::kObject);
569 ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(new ListValue()).get(), 600 ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(new ListValue()).get(),
570 schema.get(), NULL, "", 601 schema.get(), NULL, "",
571 JSONSchemaValidator::FormatErrorMessage( 602 JSONSchemaValidator::FormatErrorMessage(
572 JSONSchemaValidator::kInvalidType, "object", "array")); 603 JSONSchemaValidator::kInvalidType,
604 schema::kObject,
605 schema::kArray));
573 606
574 schema->SetString("type", "object"); 607 schema->SetString(schema::kType, schema::kObject);
575 ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(Value::CreateNullValue()).get(), 608 ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(Value::CreateNullValue()).get(),
576 schema.get(), NULL, "", 609 schema.get(), NULL, "",
577 JSONSchemaValidator::FormatErrorMessage( 610 JSONSchemaValidator::FormatErrorMessage(
578 JSONSchemaValidator::kInvalidType, "object", "null")); 611 JSONSchemaValidator::kInvalidType,
612 schema::kObject,
613 schema::kNull));
579 614
580 schema->SetString("type", "array"); 615 schema->SetString(schema::kType, schema::kArray);
581 ExpectNotValid(TEST_SOURCE, 616 ExpectNotValid(TEST_SOURCE,
582 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(), 617 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
583 schema.get(), NULL, "", 618 schema.get(), NULL, "",
584 JSONSchemaValidator::FormatErrorMessage( 619 JSONSchemaValidator::FormatErrorMessage(
585 JSONSchemaValidator::kInvalidType, "array", "integer")); 620 JSONSchemaValidator::kInvalidType,
621 schema::kArray,
622 schema::kInteger));
586 623
587 schema->SetString("type", "string"); 624 schema->SetString(schema::kType, schema::kString);
588 ExpectNotValid(TEST_SOURCE, 625 ExpectNotValid(TEST_SOURCE,
589 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(), 626 scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
590 schema.get(), NULL, "", 627 schema.get(), NULL, "",
591 JSONSchemaValidator::FormatErrorMessage( 628 JSONSchemaValidator::FormatErrorMessage(
592 JSONSchemaValidator::kInvalidType, "string", "integer")); 629 JSONSchemaValidator::kInvalidType,
630 schema::kString,
631 schema::kInteger));
593 632
594 schema->SetString("type", "number"); 633 schema->SetString(schema::kType, schema::kNumber);
595 ExpectNotValid(TEST_SOURCE, 634 ExpectNotValid(TEST_SOURCE,
596 scoped_ptr<Value>(Value::CreateStringValue("42")).get(), 635 scoped_ptr<Value>(Value::CreateStringValue("42")).get(),
597 schema.get(), NULL, "", 636 schema.get(), NULL, "",
598 JSONSchemaValidator::FormatErrorMessage( 637 JSONSchemaValidator::FormatErrorMessage(
599 JSONSchemaValidator::kInvalidType, "number", "string")); 638 JSONSchemaValidator::kInvalidType,
639 schema::kNumber,
640 schema::kString));
600 641
601 schema->SetString("type", "integer"); 642 schema->SetString(schema::kType, schema::kInteger);
602 ExpectNotValid(TEST_SOURCE, 643 ExpectNotValid(TEST_SOURCE,
603 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(), 644 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
604 schema.get(), NULL, "", 645 schema.get(), NULL, "",
605 JSONSchemaValidator::FormatErrorMessage( 646 JSONSchemaValidator::FormatErrorMessage(
606 JSONSchemaValidator::kInvalidType, "integer", "number")); 647 JSONSchemaValidator::kInvalidType,
648 schema::kInteger,
649 schema::kNumber));
607 650
608 schema->SetString("type", "integer"); 651 schema->SetString(schema::kType, schema::kInteger);
609 ExpectNotValid(TEST_SOURCE, 652 ExpectNotValid(TEST_SOURCE,
610 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(), 653 scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
611 schema.get(), NULL, "", 654 schema.get(), NULL, "",
612 JSONSchemaValidator::FormatErrorMessage( 655 JSONSchemaValidator::FormatErrorMessage(
613 JSONSchemaValidator::kInvalidType, "integer", "number")); 656 JSONSchemaValidator::kInvalidType,
657 schema::kInteger,
658 schema::kNumber));
614 659
615 schema->SetString("type", "boolean"); 660 schema->SetString(schema::kType, schema::kBoolean);
616 ExpectNotValid(TEST_SOURCE, 661 ExpectNotValid(TEST_SOURCE,
617 scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(), 662 scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(),
618 schema.get(), NULL, "", 663 schema.get(), NULL, "",
619 JSONSchemaValidator::FormatErrorMessage( 664 JSONSchemaValidator::FormatErrorMessage(
620 JSONSchemaValidator::kInvalidType, "boolean", "integer")); 665 JSONSchemaValidator::kInvalidType,
666 schema::kBoolean,
667 schema::kInteger));
621 668
622 schema->SetString("type", "null"); 669 schema->SetString(schema::kType, schema::kNull);
623 ExpectNotValid(TEST_SOURCE, 670 ExpectNotValid(TEST_SOURCE,
624 scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(), 671 scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
625 schema.get(), NULL, "", 672 schema.get(), NULL, "",
626 JSONSchemaValidator::FormatErrorMessage( 673 JSONSchemaValidator::FormatErrorMessage(
627 JSONSchemaValidator::kInvalidType, "null", "boolean")); 674 JSONSchemaValidator::kInvalidType,
675 schema::kNull,
676 schema::kBoolean));
628 } 677 }
OLDNEW
« no previous file with comments | « chrome/common/json_schema_validator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698