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

Unified Diff: components/json_schema/json_schema_validator_unittest.cc

Issue 94043003: Ignore unknown attributes when parsing JSON schemas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added Options enum Created 7 years 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
« no previous file with comments | « components/json_schema/json_schema_validator.cc ('k') | components/policy/core/common/schema.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/json_schema/json_schema_validator_unittest.cc
diff --git a/components/json_schema/json_schema_validator_unittest.cc b/components/json_schema/json_schema_validator_unittest.cc
index 6372032c13576b29f56a860d255c19c18c057edd..73809de5c860fd2b52a5b23a862fcc7e36994cfe 100644
--- a/components/json_schema/json_schema_validator_unittest.cc
+++ b/components/json_schema/json_schema_validator_unittest.cc
@@ -83,8 +83,7 @@ TEST(JSONSchemaValidator, IsValidSchema) {
"{"
" \"type\": \"string\","
" \"enum\": [ { \"name\": {} } ]" // "enum" name must be a simple value.
- "}",
- &error));
+ "}", &error));
EXPECT_FALSE(JSONSchemaValidator::IsValidSchema(
"{"
" \"type\": \"array\","
@@ -132,4 +131,16 @@ TEST(JSONSchemaValidator, IsValidSchema) {
" \"type\": \"any\""
" }"
"}", &error)) << error;
+ EXPECT_TRUE(JSONSchemaValidator::IsValidSchema(
+ "{"
+ " \"type\": \"object\","
+ " \"unknown attribute\": \"that should just be ignored\""
+ "}",
+ JSONSchemaValidator::OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES,
+ &error)) << error;
+ EXPECT_FALSE(JSONSchemaValidator::IsValidSchema(
+ "{"
+ " \"type\": \"object\","
+ " \"unknown attribute\": \"that will cause a failure\""
+ "}", 0, &error)) << error;
}
« no previous file with comments | « components/json_schema/json_schema_validator.cc ('k') | components/policy/core/common/schema.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698