summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 23:07:13 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 23:07:13 +0000
commit07a07899dbc156cbf1273a9f3698a4eeafb8ed5c (patch)
tree6baec4c84f49c29d8c3aaf9f7fbf5df365bfe159 /mojo
parented6fa146fc2ac61fb72ee090de62f1ca4a44d135 (diff)
downloadchromium_src-07a07899dbc156cbf1273a9f3698a4eeafb8ed5c.zip
chromium_src-07a07899dbc156cbf1273a9f3698a4eeafb8ed5c.tar.gz
chromium_src-07a07899dbc156cbf1273a9f3698a4eeafb8ed5c.tar.bz2
Add more test cases for Mojo message validation.
Tests for encoded handles in Mojo messages will be in a separate CL, since the input format needs to be extended to specify the number of handles with the message data. BUG=None TEST=ValidationTest.Conformance Review URL: https://codereview.chromium.org/324363004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277336 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.data2
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.data6
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.data6
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.data4
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.data4
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.data8
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.data7
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.data8
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.data5
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.data6
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.data4
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.data9
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.data7
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.data10
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.data9
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.data10
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.data12
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.data16
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.data10
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.data18
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.data11
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.data32
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.data25
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.data30
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.data32
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.data16
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.data16
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.data18
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.data11
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.data17
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.data10
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.data14
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.data13
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.data19
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.data32
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.data24
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.data30
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.data33
-rw-r--r--mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.expected1
-rw-r--r--mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom22
75 files changed, 594 insertions, 8 deletions
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.data
new file mode 100644
index 0000000..ee5ecdb
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.data
@@ -0,0 +1,2 @@
+[u4]16 // num_bytes: Bigger than the total size of the message.
+[u4]2 // num_fields
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.data
new file mode 100644
index 0000000..9d66188
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.data
@@ -0,0 +1,6 @@
+[dist4]message_header // num_bytes
+[u4]3 // num_fields
+[u4]0x80000000 // name
+[u4]3 // flags: This combination is illegal.
+[u8]1 // request_id
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.expected
new file mode 100644
index 0000000..696c78d
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flags.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.data
new file mode 100644
index 0000000..2414431
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.data
@@ -0,0 +1,6 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0x80000000 // name
+[u4]1 // flags: This is a response message which expects to
+ // have a request ID.
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.expected
new file mode 100644
index 0000000..083db1a
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.data
new file mode 100644
index 0000000..ad3b005
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.data
@@ -0,0 +1,4 @@
+[u4]0xFFFFFFFF // num_bytes: Test whether a huge value will cause overflow.
+[u4]2 // num_fields
+[u4]0x80000000 // name
+[u4]0 // flags
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.data
new file mode 100644
index 0000000..353b4e8
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.data
@@ -0,0 +1,4 @@
+[dist4]message_header // num_bytes: Less than the minimal size of message
+ // header.
+[u4]2 // num_fields
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_min_requirement.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.data
index 169ea04..3a94448 100644
--- a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.data
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.data
@@ -1,4 +1,4 @@
-[u4]0 // num_bytes
-[u4]0 // num_fields
-[u4]0 // name
-[u4]0 // flags
+[u4]0 // num_bytes
+[u4]0 // num_fields
+[u4]0x80000000 // name
+[u4]0 // flags
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.data
new file mode 100644
index 0000000..7e8a714
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.data
@@ -0,0 +1,7 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0x80000000 // name
+[u4]0 // flags
+[u8]0 // Extra bytes that result in mismatched |num_bytes| and
+ // |num_fields|.
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_1.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.data
new file mode 100644
index 0000000..fd8b4b4
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.data
@@ -0,0 +1,8 @@
+[dist4]message_header // num_bytes
+[u4]3 // num_fields
+[u4]0x80000000 // name
+[u4]0 // flags
+[u8]0 // request_id
+[u8]0 // Extra bytes that result in mismatched |num_bytes| and
+ // |num_fields|.
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_2.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.data
new file mode 100644
index 0000000..c4b46ab
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.data
@@ -0,0 +1,5 @@
+[dist4]message_header // num_bytes
+[u4]8 // num_fields: |num_bytes| is too small for |num_fields|.
+[u4]0x80000000 // name
+[u4]0 // flags
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_num_fields_mismatch_3.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.data
new file mode 100644
index 0000000..a94e6ce
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.data
@@ -0,0 +1,6 @@
+[dist4]message_header // num_bytes
+[u4]1 // num_fields: Less than the minimal number of fields
+ // that we expect.
+[u4]0x80000000 // name
+[u4]0 // flags
+[anchr]message_header
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_fields_less_than_min_requirement.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.data
index cf2ac8d..1a5603e 100644
--- a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.data
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.data
@@ -5,5 +5,7 @@
[anchr]message_header
[dist4]method0_params // num_bytes
-[u4]0 // num_fields
+[u4]1 // num_fields
+[f]-1 // param0
+[u4]0 // padding
[anchr]method0_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.data
new file mode 100644
index 0000000..5556808
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.data
@@ -0,0 +1,9 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0 // name
+[u4]0 // flags
+[anchr]message_header
+
+[u4]16 // num_bytes: Incomplete struct.
+[u4]1 // num_fields
+[f]-1 // param0
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.data
new file mode 100644
index 0000000..9a362f6
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.data
@@ -0,0 +1,7 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0 // name
+[u4]0 // flags
+[anchr]message_header
+
+[u4]16 // num_bytes: Incomplete struct header.
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.data
new file mode 100644
index 0000000..52e4540
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.data
@@ -0,0 +1,10 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0 // name
+[u4]0 // flags
+[anchr]message_header
+
+[u4]0xFFFFFFFF // num_bytes: Test whether a huge value will cause overflow.
+[u4]1 // num_fields
+[f]-1 // param0
+[u4]0 // padding
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.data
new file mode 100644
index 0000000..7c966f8
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.data
@@ -0,0 +1,9 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method0_params // num_bytes: Less than the minimal size that we expect.
+[u4]1 // num_fields
+[anchr]method0_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.data
new file mode 100644
index 0000000..af20941
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.data
@@ -0,0 +1,10 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0 // name
+[u4]0 // flags
+[anchr]message_header
+
+[u4]4 // num_bytes: Less than the size of struct header.
+[u4]1 // num_fields
+[f]-1 // param0
+[u4]0 // padding
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.data
new file mode 100644
index 0000000..ffcafd3
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.data
@@ -0,0 +1,12 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]0 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method0_params // num_bytes
+[u4]0 // num_fields: Less than the minimal number of fields
+ // that we expect.
+[f]-1 // param0
+[u4]0 // padding
+[anchr]method0_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.expected
new file mode 100644
index 0000000..25aceee
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_fields_less_than_min_requirement.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.data
new file mode 100644
index 0000000..d67a72f
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.data
@@ -0,0 +1,16 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]1 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method1_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method1_params
+
+[anchr]param0_ptr
+[dist4]struct_a // num_bytes
+[u4]1 // num_fields
+[u8]1234 // i
+[anchr]struct_a
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.expected
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.expected
@@ -0,0 +1 @@
+PASS
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.data
new file mode 100644
index 0000000..be267a103
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.data
@@ -0,0 +1,10 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]1 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method1_params // num_bytes
+[u4]1 // num_fields
+[u8]0 // param0: A null pointer.
+[anchr]method1_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.expected
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good_null_struct.expected
@@ -0,0 +1 @@
+PASS
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.data
new file mode 100644
index 0000000..051dccc
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.data
@@ -0,0 +1,18 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]1 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method1_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method1_params
+
+[u1]0 // Causes the following struct to be misaligned.
+
+[anchr]param0_ptr
+[dist4]struct_a // num_bytes
+[u4]1 // num_fields
+[u8]1234 // i
+[anchr]struct_a
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.expected
new file mode 100644
index 0000000..acca999
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_MISALIGNED_OBJECT
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.data
new file mode 100644
index 0000000..98a21c4d
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.data
@@ -0,0 +1,11 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]1 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method1_params // num_bytes
+[u4]1 // num_fields
+[u8]0xFFFFFFFFFFFFFFFF // param0: Test whether decoding the pointer causes
+ // overflow.
+[anchr]method1_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.expected
new file mode 100644
index 0000000..23abb8c
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_POINTER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.data
new file mode 100644
index 0000000..38e20ab
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.data
@@ -0,0 +1,32 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]2 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method2_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method2_params
+
+[anchr]param0_ptr
+[dist4]struct_b // num_bytes
+[u4]1 // num_fields
+[dist8]struct_a_ptr // struct_a
+[anchr]struct_b
+
+[u8]0 // Having extra bytes in the middle is okay if the following objects are
+ // still properly alignmented.
+
+[anchr]struct_a_ptr
+[dist4]struct_a_member // num_bytes
+[u4]1 // num_fields
+[u8]12345 // i
+[anchr]struct_a_member
+
+[anchr]param1_ptr
+[dist4]struct_a_param // num_bytes
+[u4]1 // num_fields
+[u8]67890 // i
+[anchr]struct_a_param
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.expected
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.expected
@@ -0,0 +1 @@
+PASS
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.data
new file mode 100644
index 0000000..a12121b
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.data
@@ -0,0 +1,25 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]2 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method2_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method2_params
+
+[anchr]param0_ptr
+[dist4]struct_b // num_bytes
+[u4]1 // num_fields
+[dist8]struct_a_ptr // struct_a
+[anchr]struct_b
+
+// There are two pointers pointing to the same struct.
+[anchr]struct_a_ptr
+[anchr]param1_ptr
+[dist4]struct_a // num_bytes
+[u4]1 // num_fields
+[u8]12345 // i
+[anchr]struct_a
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.data
new file mode 100644
index 0000000..a916f03
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.data
@@ -0,0 +1,30 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]2 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method2_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method2_params
+
+[anchr]param0_ptr
+[dist4]struct_b // num_bytes
+[u4]1 // num_fields
+[dist8]struct_a_ptr // struct_a
+[anchr]struct_b
+
+[anchr]struct_a_ptr
+[dist4]struct_a_member // num_bytes
+[u4]1 // num_fields
+
+[anchr]param1_ptr
+// The following |num_bytes| and |num_fields| fields are also the |i| field
+// of the previous struct.
+[dist4]struct_a_param // num_bytes
+[u4]1 // num_fields
+[anchr]struct_a_member
+[u8]67890 // i
+[anchr]struct_a_param
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.data
new file mode 100644
index 0000000..7145ccd
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.data
@@ -0,0 +1,32 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]2 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method2_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method2_params
+
+[anchr]param0_ptr
+[dist4]struct_b // num_bytes
+[u4]1 // num_fields
+[dist8]struct_a_ptr // struct_a
+[anchr]struct_b
+
+// The following two structs are arranged in wrong order.
+
+[anchr]param1_ptr
+[dist4]struct_a_param // num_bytes
+[u4]1 // num_fields
+[u8]67890 // i
+[anchr]struct_a_param
+
+[anchr]struct_a_ptr
+[dist4]struct_a_member // num_bytes
+[u4]1 // num_fields
+[u8]12345 // i
+[anchr]struct_a_member
+
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.data
new file mode 100644
index 0000000..ca7651a
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.data
@@ -0,0 +1,16 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[anchr]param0_ptr
+[u4]0xFFFFFFFF // num_bytes: Test whether a huge value will cause overflow.
+[u4]12 // num_elements
+[b]01010101
+[b]00001111
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.data
new file mode 100644
index 0000000..9bc1fc3
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.data
@@ -0,0 +1,16 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[anchr]param0_ptr
+[u4]7 // num_bytes: Less than the size of array header.
+[u4]12 // num_elements
+[b]01010101
+[b]00001111
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.expected
new file mode 100644
index 0000000..5a1ec4e
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.data
new file mode 100644
index 0000000..bed891c
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.data
@@ -0,0 +1,18 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[anchr]param0_ptr
+[dist4]array // num_bytes: Less than the size needed (array header + 12 boolean
+ // values).
+[u4]12 // num_elements
+[b]01010101
+[anchr]array
+[b]00001111
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.expected
new file mode 100644
index 0000000..5a1ec4e
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.data
new file mode 100644
index 0000000..f8d7644
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.data
@@ -0,0 +1,11 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[u8]0xFFFFFFFFFFFFFFFF // param0: Test whether decoding the pointer causes
+ // overflow.
+[anchr]method3_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.expected
new file mode 100644
index 0000000..23abb8c
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_POINTER
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.data
new file mode 100644
index 0000000..cc7dd38
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.data
@@ -0,0 +1,17 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[anchr]param0_ptr
+[dist4]array // num_bytes
+[u4]12 // num_elements
+[b]01010101
+[b]00001111
+[anchr]array
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.expected
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.expected
@@ -0,0 +1 @@
+PASS
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.data
new file mode 100644
index 0000000..2f73ee5
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.data
@@ -0,0 +1,10 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[u8]0 // param0: A null pointer.
+[anchr]method3_params
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.expected
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good_null_array.expected
@@ -0,0 +1 @@
+PASS
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.data
new file mode 100644
index 0000000..7850893
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.data
@@ -0,0 +1,14 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[anchr]param0_ptr
+[u4]16 // num_bytes
+[u1]0 // num_elements: Incomplete array.
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.data
new file mode 100644
index 0000000..5de9fe6
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.data
@@ -0,0 +1,13 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[anchr]param0_ptr
+[u4]16 // num_bytes: Incomplete array header.
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.data
new file mode 100644
index 0000000..40a13e0
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.data
@@ -0,0 +1,19 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]3 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method3_params // num_bytes
+[u4]1 // num_fields
+[dist8]param0_ptr // param0
+[anchr]method3_params
+
+[u2]0 // Causes the following array to be misaligned.
+
+[anchr]param0_ptr
+[dist4]array // num_bytes
+[u4]12 // num_elements
+[b]01010101
+[b]00001111
+[anchr]array
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.expected
new file mode 100644
index 0000000..acca999
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_MISALIGNED_OBJECT
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.data
new file mode 100644
index 0000000..46f7502
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.data
@@ -0,0 +1,32 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]4 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method4_params // num_bytes: Larger than what we know is okay.
+[u4]3 // num_fields: Larger than what we know is okay.
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[u8]0 // unknown
+[anchr]method4_params
+
+[anchr]param0_ptr
+[dist4]struct_c // num_bytes
+[u4]1 // num_fields
+[dist8]array_ptr // array
+[anchr]struct_c
+
+[anchr]array_ptr
+[dist4]array_member // num_bytes
+[u4]3 // num_elements
+0 1 2
+[anchr]array_member
+
+[u4]0 [u1]0 // Padding to make the next array aligned properly.
+
+[anchr]param1_ptr
+[dist4]array_param // num_bytes
+[u4]10 // num_elements
+0 1 2 3 4 5 6 7 8 9
+[anchr]array_param
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.expected
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.expected
@@ -0,0 +1 @@
+PASS
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.data
new file mode 100644
index 0000000..f3a0e9f
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.data
@@ -0,0 +1,24 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]4 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method4_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method4_params
+
+[anchr]param0_ptr
+[dist4]struct_c // num_bytes
+[u4]1 // num_fields
+[dist8]array_ptr // array
+[anchr]struct_c
+
+[anchr]param1_ptr
+[anchr]array_ptr
+[dist4]array_member // num_bytes
+[u4]3 // num_elements
+0 1 2
+[anchr]array_member
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.data
new file mode 100644
index 0000000..d819857
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.data
@@ -0,0 +1,30 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]4 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method4_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method4_params
+
+[anchr]param0_ptr
+[dist4]struct_c // num_bytes
+[u4]1 // num_fields
+[dist8]array_ptr // array
+[anchr]struct_c
+
+[anchr]array_ptr
+[dist4]array_member // num_bytes
+[u4]3 // num_elements
+
+[anchr]param1_ptr
+// The first three bytes of |num_bytes| are also the elements of the previous
+// array.
+[dist4]array_param // num_bytes
+[u4]10 // num_elements
+0 1 2 3 4 5 6 7 8 9
+[anchr]array_param
+[anchr]array_member
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.data
new file mode 100644
index 0000000..fdc925f
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.data
@@ -0,0 +1,33 @@
+[dist4]message_header // num_bytes
+[u4]2 // num_fields
+[u4]4 // name
+[u4]0 // flags
+[anchr]message_header
+
+[dist4]method4_params // num_bytes
+[u4]2 // num_fields
+[dist8]param0_ptr // param0
+[dist8]param1_ptr // param1
+[anchr]method4_params
+
+[anchr]param0_ptr
+[dist4]struct_c // num_bytes
+[u4]1 // num_fields
+[dist8]array_ptr // array
+[anchr]struct_c
+
+// The following two arrays are arranged in wrong order.
+
+[anchr]param1_ptr
+[dist4]array_param // num_bytes
+[u4]10 // num_elements
+0 1 2 3 4 5 6 7 8 9
+[anchr]array_param
+
+[u4]0 [u2]0 // Padding to make the next array aligned properly.
+
+[anchr]array_ptr
+[dist4]array_member // num_bytes
+[u4]3 // num_elements
+0 1 2
+[anchr]array_member
diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.expected
new file mode 100644
index 0000000..779df88
--- /dev/null
+++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.expected
@@ -0,0 +1 @@
+VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE
diff --git a/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom b/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
index 52ae995..d8d66c3 100644
--- a/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
+++ b/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
@@ -4,12 +4,28 @@
module mojo.test {
-struct BasicStruct {
- int32 a;
+struct StructA {
+ uint64 i;
+};
+
+struct StructB {
+ StructA struct_a;
+};
+
+struct StructC {
+ uint8[] array;
};
interface ConformanceTestInterface {
- Method0();
+ Method0(float param0);
+ Method1(StructA param0);
+ Method2(StructB param0, StructA param1);
+ Method3(bool[] param0);
+ Method4(StructC param0, uint8[] param1);
+};
+
+struct BasicStruct {
+ int32 a;
};
[Client=IntegrationTestInterface2]