summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 22:21:43 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 22:21:43 +0000
commit639e6714392efe8d0e568359ab91c9c90ad9f32d (patch)
tree347302a1d2194622033b2555fc6f126269ba2fd3 /chrome/test
parentabb26096d64316448c4203de724e02a3258a2dce (diff)
downloadchromium_src-639e6714392efe8d0e568359ab91c9c90ad9f32d.zip
chromium_src-639e6714392efe8d0e568359ab91c9c90ad9f32d.tar.gz
chromium_src-639e6714392efe8d0e568359ab91c9c90ad9f32d.tar.bz2
Implements a C++ version of JSONSchemaValidator.
BUG=none TEST=covered by unit tests Review URL: http://codereview.chromium.org/4673001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/json_schema_validator/array_tuple_schema.json11
-rw-r--r--chrome/test/data/json_schema_validator/choices_schema.json7
-rw-r--r--chrome/test/data/json_schema_validator/complex_instance.json9
-rw-r--r--chrome/test/data/json_schema_validator/complex_schema.json33
-rw-r--r--chrome/test/data/json_schema_validator/enum_schema.json3
-rw-r--r--chrome/test/data/json_schema_validator/reference_types.json12
6 files changed, 75 insertions, 0 deletions
diff --git a/chrome/test/data/json_schema_validator/array_tuple_schema.json b/chrome/test/data/json_schema_validator/array_tuple_schema.json
new file mode 100644
index 0000000..a9bea68
--- /dev/null
+++ b/chrome/test/data/json_schema_validator/array_tuple_schema.json
@@ -0,0 +1,11 @@
+{
+ "type": "array",
+ "items": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "integer"
+ }
+ ]
+}
diff --git a/chrome/test/data/json_schema_validator/choices_schema.json b/chrome/test/data/json_schema_validator/choices_schema.json
new file mode 100644
index 0000000..bd0f1a5
--- /dev/null
+++ b/chrome/test/data/json_schema_validator/choices_schema.json
@@ -0,0 +1,7 @@
+{
+ "choices": [
+ { "type": "null" },
+ { "type": "integer", "minimum": 42, "maximum": 43 },
+ { "type": "object", "properties": { "foo": { "type": "string" } } }
+ ]
+}
diff --git a/chrome/test/data/json_schema_validator/complex_instance.json b/chrome/test/data/json_schema_validator/complex_instance.json
new file mode 100644
index 0000000..1fb193b
--- /dev/null
+++ b/chrome/test/data/json_schema_validator/complex_instance.json
@@ -0,0 +1,9 @@
+[
+ {
+ "id": 42,
+ "url": "google.com",
+ "index": 2,
+ "selected": true
+ },
+ 88.8
+]
diff --git a/chrome/test/data/json_schema_validator/complex_schema.json b/chrome/test/data/json_schema_validator/complex_schema.json
new file mode 100644
index 0000000..bf0d6b8
--- /dev/null
+++ b/chrome/test/data/json_schema_validator/complex_schema.json
@@ -0,0 +1,33 @@
+{
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "url": {
+ "type": "string",
+ "maxLength": 10,
+ "optional": true
+ },
+ "index": {
+ "type": "integer",
+ "minimum": 0,
+ "optional": true
+ },
+ "selected": {
+ "type": "boolean",
+ "optional": true
+ }
+ }
+ },
+ {
+ "type": "number",
+ "optional": true
+ }
+ ]
+}
+
diff --git a/chrome/test/data/json_schema_validator/enum_schema.json b/chrome/test/data/json_schema_validator/enum_schema.json
new file mode 100644
index 0000000..ae0c12a
--- /dev/null
+++ b/chrome/test/data/json_schema_validator/enum_schema.json
@@ -0,0 +1,3 @@
+{
+ "enum": ["foo", 42, false]
+}
diff --git a/chrome/test/data/json_schema_validator/reference_types.json b/chrome/test/data/json_schema_validator/reference_types.json
new file mode 100644
index 0000000..8f77334
--- /dev/null
+++ b/chrome/test/data/json_schema_validator/reference_types.json
@@ -0,0 +1,12 @@
+[
+ {
+ "id": "MinLengthString",
+ "type": "string",
+ "minLength": 2
+ },
+ {
+ "id": "Max10Int",
+ "type": "integer",
+ "maximum": 10
+ }
+]