diff options
author | Hidehiko Abe <hidehiko@google.com> | 2018-04-24 01:37:19 +0900 |
---|---|---|
committer | Hidehiko Abe <hidehiko@google.com> | 2018-04-24 03:09:01 +0900 |
commit | b268b43ac6fdbc4f3a2ed1429b99ace424906090 (patch) | |
tree | bd2d04362f66c36d4279f7a9735ba21ea3a2a021 /mojo/public/interfaces/bindings | |
parent | 4a54b98aa445f521c6945e4f4a1e0ea788fa7da8 (diff) | |
download | libchrome-b268b43ac6fdbc4f3a2ed1429b99ace424906090.tar.gz |
Migrate libmojo repository into libchrome, part 2.
This CL moves following files.
- .gitignore
- Android.bp is merged into libchrome's Android.bp.
- base/android/*
- build/* except build_config.h which is exactly same with libchrome's.
- ipc/*
- mojo/* except mojo/public/tools/bindings/generators/__init__.py
which is unused and not in chrome repository.
- soong/* into libchrome_tools/
- third_party/{catapult,jinja2,markupsafe,ply}/*
- ui/gfx/{geometry,range}/mojo/*
Then, update several paths/build rules to be adapted.
Bug: 73606903
Test: Built locally. Ran on DUT.
Change-Id: I2a532a42aa68dcb215dbd71d8673192311509726
Diffstat (limited to 'mojo/public/interfaces/bindings')
269 files changed, 5339 insertions, 0 deletions
diff --git a/mojo/public/interfaces/bindings/BUILD.gn b/mojo/public/interfaces/bindings/BUILD.gn new file mode 100644 index 0000000000..c2cadcd736 --- /dev/null +++ b/mojo/public/interfaces/bindings/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("../../tools/bindings/mojom.gni") + +mojom("bindings") { + visibility = [] + sources = [ + "interface_control_messages.mojom", + "pipe_control_messages.mojom", + ] + + export_class_attribute = "MOJO_CPP_BINDINGS_EXPORT" + export_define = "MOJO_CPP_BINDINGS_IMPLEMENTATION" + export_header = "mojo/public/cpp/bindings/bindings_export.h" +} + +# TODO(yzshen): Remove this target and use the one above once +# |use_new_js_bindings| becomes true by default. +mojom("new_bindings") { + visibility = [] + sources = [ + "new_bindings/interface_control_messages.mojom", + "new_bindings/pipe_control_messages.mojom", + ] + + use_new_js_bindings = true +} diff --git a/mojo/public/interfaces/bindings/interface_control_messages.mojom b/mojo/public/interfaces/bindings/interface_control_messages.mojom new file mode 100644 index 0000000000..0a1904206a --- /dev/null +++ b/mojo/public/interfaces/bindings/interface_control_messages.mojom @@ -0,0 +1,67 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.interfacecontrol"] +module mojo.interface_control; + +// For each user-defined interface, some control functions are provided by the +// interface endpoints at both sides. + +//////////////////////////////////////////////////////////////////////////////// +// Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); +// +// This control function runs the input command. If the command is not +// supported, |output| is set to null; otherwise |output| stores the result, +// whose type depends on the input. + +const uint32 kRunMessageId = 0xFFFFFFFF; + +struct RunMessageParams { + RunInput input; +}; +union RunInput { + QueryVersion query_version; + FlushForTesting flush_for_testing; +}; + +struct RunResponseMessageParams { + RunOutput? output; +}; +union RunOutput { + QueryVersionResult query_version_result; +}; + +// Queries the max supported version of the user-defined interface. +// Sent by the interface client side. +struct QueryVersion { +}; +struct QueryVersionResult { + uint32 version; +}; + +// Sent by either side of the interface. +struct FlushForTesting { +}; + +//////////////////////////////////////////////////////////////////////////////// +// RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); +// +// This control function runs the input command. If the operation fails or the +// command is not supported, the message pipe is closed. + +const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; + +struct RunOrClosePipeMessageParams { + RunOrClosePipeInput input; +}; +union RunOrClosePipeInput { + RequireVersion require_version; +}; + +// If the specified version of the user-defined interface is not supported, the +// function fails and the pipe is closed. +// Sent by the interface client side. +struct RequireVersion { + uint32 version; +}; diff --git a/mojo/public/interfaces/bindings/new_bindings/interface_control_messages.mojom b/mojo/public/interfaces/bindings/new_bindings/interface_control_messages.mojom new file mode 100644 index 0000000000..e03ffd6589 --- /dev/null +++ b/mojo/public/interfaces/bindings/new_bindings/interface_control_messages.mojom @@ -0,0 +1,67 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.interfacecontrol"] +module mojo.interface_control2; + +// For each user-defined interface, some control functions are provided by the +// interface endpoints at both sides. + +//////////////////////////////////////////////////////////////////////////////// +// Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); +// +// This control function runs the input command. If the command is not +// supported, |output| is set to null; otherwise |output| stores the result, +// whose type depends on the input. + +const uint32 kRunMessageId = 0xFFFFFFFF; + +struct RunMessageParams { + RunInput input; +}; +union RunInput { + QueryVersion query_version; + FlushForTesting flush_for_testing; +}; + +struct RunResponseMessageParams { + RunOutput? output; +}; +union RunOutput { + QueryVersionResult query_version_result; +}; + +// Queries the max supported version of the user-defined interface. +// Sent by the interface client side. +struct QueryVersion { +}; +struct QueryVersionResult { + uint32 version; +}; + +// Sent by either side of the interface. +struct FlushForTesting { +}; + +//////////////////////////////////////////////////////////////////////////////// +// RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); +// +// This control function runs the input command. If the operation fails or the +// command is not supported, the message pipe is closed. + +const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; + +struct RunOrClosePipeMessageParams { + RunOrClosePipeInput input; +}; +union RunOrClosePipeInput { + RequireVersion require_version; +}; + +// If the specified version of the user-defined interface is not supported, the +// function fails and the pipe is closed. +// Sent by the interface client side. +struct RequireVersion { + uint32 version; +}; diff --git a/mojo/public/interfaces/bindings/new_bindings/pipe_control_messages.mojom b/mojo/public/interfaces/bindings/new_bindings/pipe_control_messages.mojom new file mode 100644 index 0000000000..69975fc1c0 --- /dev/null +++ b/mojo/public/interfaces/bindings/new_bindings/pipe_control_messages.mojom @@ -0,0 +1,46 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.pipecontrol"] +module mojo.pipe_control2; + +// For each message pipe running user-defined interfaces, some control +// functions are provided and used by the routers at both ends of the pipe, so +// that they can coordinate to manage interface endpoints. +// All these control messages will have the interface ID field in the message +// header set to invalid. + +//////////////////////////////////////////////////////////////////////////////// +// RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); +// +// This control function runs the input command. If the operation fails or the +// command is not supported, the message pipe is closed. + +const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; + +struct RunOrClosePipeMessageParams { + RunOrClosePipeInput input; +}; + +union RunOrClosePipeInput { + PeerAssociatedEndpointClosedEvent peer_associated_endpoint_closed_event; +}; + +// A user-defined reason about why the interface is disconnected. +struct DisconnectReason { + uint32 custom_reason; + string description; +}; + +// An event to notify that an interface endpoint set up at the message sender +// side has been closed. +// +// This event is omitted if the endpoint belongs to the master interface and +// there is no disconnect reason specified. +struct PeerAssociatedEndpointClosedEvent { + // The interface ID. + uint32 id; + DisconnectReason? disconnect_reason; +}; + diff --git a/mojo/public/interfaces/bindings/pipe_control_messages.mojom b/mojo/public/interfaces/bindings/pipe_control_messages.mojom new file mode 100644 index 0000000000..74e9cc7657 --- /dev/null +++ b/mojo/public/interfaces/bindings/pipe_control_messages.mojom @@ -0,0 +1,46 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.pipecontrol"] +module mojo.pipe_control; + +// For each message pipe running user-defined interfaces, some control +// functions are provided and used by the routers at both ends of the pipe, so +// that they can coordinate to manage interface endpoints. +// All these control messages will have the interface ID field in the message +// header set to invalid. + +//////////////////////////////////////////////////////////////////////////////// +// RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); +// +// This control function runs the input command. If the operation fails or the +// command is not supported, the message pipe is closed. + +const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; + +struct RunOrClosePipeMessageParams { + RunOrClosePipeInput input; +}; + +union RunOrClosePipeInput { + PeerAssociatedEndpointClosedEvent peer_associated_endpoint_closed_event; +}; + +// A user-defined reason about why the interface is disconnected. +struct DisconnectReason { + uint32 custom_reason; + string description; +}; + +// An event to notify that an interface endpoint set up at the message sender +// side has been closed. +// +// This event is omitted if the endpoint belongs to the master interface and +// there is no disconnect reason specified. +struct PeerAssociatedEndpointClosedEvent { + // The interface ID. + uint32 id; + DisconnectReason? disconnect_reason; +}; + diff --git a/mojo/public/interfaces/bindings/tests/BUILD.gn b/mojo/public/interfaces/bindings/tests/BUILD.gn new file mode 100644 index 0000000000..e496eb656c --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/BUILD.gn @@ -0,0 +1,204 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("../../../tools/bindings/mojom.gni") + +mojom("test_interfaces") { + testonly = true + sources = [ + "math_calculator.mojom", + "no_module.mojom", + "ping_service.mojom", + "rect.mojom", + "regression_tests.mojom", + "sample_factory.mojom", + "sample_interfaces.mojom", + "sample_service.mojom", + "scoping.mojom", + "serialization_test_structs.mojom", + "test_bad_messages.mojom", + "test_constants.mojom", + "test_data_view.mojom", + "test_native_types.mojom", + "test_structs.mojom", + "test_sync_methods.mojom", + "test_unions.mojom", + "validation_test_interfaces.mojom", + ] + public_deps = [ + ":echo", + ":test_mojom_import", + ":test_mojom_import2", + ] +} + +component("test_export_component") { + testonly = true + deps = [ + ":test_export", + ] +} + +if (!is_ios) { + component("test_export_blink_component") { + testonly = true + deps = [ + ":test_export_blink", + ] + } +} + +mojom("test_export") { + testonly = true + sources = [ + "test_export.mojom", + ] + export_class_attribute = "MOJO_TEST_EXPORT" + export_define = "MOJO_TEST_IMPLEMENTATION=1" + export_header = "mojo/public/cpp/bindings/tests/mojo_test_export.h" + if (!is_ios) { + export_class_attribute_blink = "MOJO_TEST_BLINK_EXPORT" + export_define_blink = "MOJO_TEST_BLINK_IMPLEMENTATION=1" + export_header_blink = + "mojo/public/cpp/bindings/tests/mojo_test_blink_export.h" + } + visibility = [ ":test_export_component" ] + if (!is_ios) { + visibility_blink = [ ":test_export_blink_component" ] + } +} + +mojom("test_exported_import") { + testonly = true + sources = [ + "test_import.mojom", + ] + public_deps = [ + ":test_export", + ] + + overridden_deps = [ ":test_export" ] + component_deps = [ ":test_export_component" ] + if (!is_ios) { + overridden_deps_blink = [ ":test_export" ] + component_deps_blink = [ ":test_export_blink_component" ] + } +} + +# Used to test that it is okay to call mojom::Foo::Serialize()/Deserialize() +# even if the mojom target is linked into another component. +# +# We don't use |test_export_component| for this test because +# //mojo/public/cpp/bindings/tests depends on both |test_export_component| and +# |test_exported_import| and therefore actually get the shared cpp sources of +# test_export.mojom from |test_exported_import|. +component("test_export_component2") { + testonly = true + public_deps = [ + ":test_export2", + ] +} + +mojom("test_export2") { + testonly = true + sources = [ + "test_export2.mojom", + ] + export_class_attribute = "MOJO_TEST_EXPORT" + export_define = "MOJO_TEST_IMPLEMENTATION=1" + export_header = "mojo/public/cpp/bindings/tests/mojo_test_export.h" + visibility = [ ":test_export_component2" ] +} + +mojom("test_mojom_import") { + testonly = true + sources = [ + "sample_import.mojom", + ] +} + +mojom("test_mojom_import_wrapper") { + testonly = true + public_deps = [ + ":test_mojom_import", + ] +} + +mojom("test_mojom_import_wrapper_wrapper") { + testonly = true + public_deps = [ + ":test_mojom_import_wrapper", + ] +} + +mojom("test_mojom_import2") { + testonly = true + sources = [ + "sample_import2.mojom", + ] + public_deps = [ + ":test_mojom_import", + ":test_mojom_import_wrapper_wrapper", + ] +} + +mojom("test_struct_traits_interfaces") { + testonly = true + sources = [ + "struct_with_traits.mojom", + ] +} + +mojom("test_associated_interfaces") { + # These files are not included in the test_interfaces target because + # associated interfaces are not supported by all bindings languages yet. + testonly = true + sources = [ + "test_associated_interfaces.mojom", + "validation_test_associated_interfaces.mojom", + ] + + public_deps = [ + ":test_interfaces", + ] +} + +mojom("versioning_test_service_interfaces") { + testonly = true + sources = [ + "versioning_test_service.mojom", + ] +} + +mojom("versioning_test_client_interfaces") { + testonly = true + sources = [ + "versioning_test_client.mojom", + ] +} + +mojom("test_wtf_types") { + testonly = true + + sources = [ + "test_wtf_types.mojom", + ] +} + +mojom("test_no_sources") { + testonly = true + + public_deps = [ + ":test_interfaces", + ] +} + +mojom("echo") { + testonly = true + sources = [ + "echo.mojom", + "echo_import.mojom", + ] + use_new_js_bindings = true +} diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_good.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_good.data new file mode 100644 index 0000000000..b797feaa2d --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_good.data @@ -0,0 +1,26 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method0_params // num_bytes +[u4]0 // version +[u4]1 // associated interface pointer: interface ID index +[u4]1 // associated interface pointer: version +[anchr]method0_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]3 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_invalid_interface_id.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_invalid_interface_id.data new file mode 100644 index 0000000000..a36d8073c0 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_invalid_interface_id.data @@ -0,0 +1,24 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method0_params // num_bytes +[u4]0 // version +[u4]1 // associated interface pointer: interface ID index +[u4]1 // associated interface pointer: version +[anchr]method0_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]2 // num_elements +[u4]3 +[u4]0xFFFFFFFF // Unexpected invalid interface ID. +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_invalid_interface_id.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_invalid_interface_id.expected new file mode 100644 index 0000000000..420b4210e2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_invalid_interface_id.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_master_interface_id.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_master_interface_id.data new file mode 100644 index 0000000000..e3fa5bb4f5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_master_interface_id.data @@ -0,0 +1,24 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method0_params // num_bytes +[u4]0 // version +[u4]1 // associated interface pointer: interface ID index +[u4]1 // associated interface pointer: version +[anchr]method0_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]2 // num_elements +[u4]3 +[u4]0 // Unexpected master interface ID. +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_master_interface_id.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_master_interface_id.expected new file mode 100644 index 0000000000..420b4210e2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_illegal_master_interface_id.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_interface_id_index_out_of_range.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_interface_id_index_out_of_range.data new file mode 100644 index 0000000000..f9e62015c9 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_interface_id_index_out_of_range.data @@ -0,0 +1,27 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method0_params // num_bytes +[u4]0 // version +[u4]1111 // associated interface pointer: The interface ID index + // is out of range. +[u4]1 // associated interface pointer: version +[anchr]method0_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]3 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_interface_id_index_out_of_range.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_interface_id_index_out_of_range.expected new file mode 100644 index 0000000000..420b4210e2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_interface_id_index_out_of_range.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_unexpected_invalid_associated_interface.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_unexpected_invalid_associated_interface.data new file mode 100644 index 0000000000..b785ed1b48 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_unexpected_invalid_associated_interface.data @@ -0,0 +1,25 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method0_params // num_bytes +[u4]0 // version +[u4]0xFFFFFFFF // associated interface pointer: Unexpected invalid + // interface ID index. +[u4]1 // associated interface pointer: version +[anchr]method0_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]2 // num_elements +[u4]3 +[u4]4 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_unexpected_invalid_associated_interface.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_unexpected_invalid_associated_interface.expected new file mode 100644 index 0000000000..d8eda1f573 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd0_unexpected_invalid_associated_interface.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_good.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_good.data new file mode 100644 index 0000000000..efa21623f5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_good.data @@ -0,0 +1,26 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]1 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method1_params // num_bytes +[u4]0 // version +[u4]1 // associated interface request: interface ID index +[u4]0 // padding +[anchr]method1_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]3 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_unexpected_invalid_associated_request.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_unexpected_invalid_associated_request.data new file mode 100644 index 0000000000..5a66aad82d --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_unexpected_invalid_associated_request.data @@ -0,0 +1,27 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]1 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method1_params // num_bytes +[u4]0 // version +[u4]0xFFFFFFFF // associated interface request: Unexpected invalid + // interface ID index. +[u4]0 // padding +[anchr]method1_params + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]3 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_unexpected_invalid_associated_request.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_unexpected_invalid_associated_request.expected new file mode 100644 index 0000000000..d8eda1f573 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd1_unexpected_invalid_associated_request.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd2_good.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd2_good.data new file mode 100644 index 0000000000..ab29603ec1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd2_good.data @@ -0,0 +1,18 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]2 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[u8]0 // payload_interface_ids: This array is a nullable field. +[anchr]message_header + +[anchr]payload +[dist4]method2_params // num_bytes +[u4]0 // version +[u4]0xFFFFFFFF // associated interface pointer: Invalid interface ID + // index. +[u4]1 // associated interface pointer: version +[anchr]method2_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd2_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd2_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd2_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_collided_interface_id_indices.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_collided_interface_id_indices.data new file mode 100644 index 0000000000..6cb71d374f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_collided_interface_id_indices.data @@ -0,0 +1,36 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method3_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method3_params + +[anchr]param0_ptr +[dist4]associated_interface_array // num_bytes +[u4]2 // num_elements +[u4]2 // interface ID index +[u4]14 // version +[u4]2 // interface ID index: The same value as the + // one above. +[u4]18 // version +[anchr]associated_interface_array + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]4 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[u4]19 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_collided_interface_id_indices.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_collided_interface_id_indices.expected new file mode 100644 index 0000000000..420b4210e2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_collided_interface_id_indices.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_good.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_good.data new file mode 100644 index 0000000000..13df01e049 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_good.data @@ -0,0 +1,35 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method3_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method3_params + +[anchr]param0_ptr +[dist4]associated_interface_array // num_bytes +[u4]2 // num_elements +[u4]2 // interface ID index +[u4]14 // version +[u4]3 // interface ID index +[u4]18 // version +[anchr]associated_interface_array + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]4 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[u4]19 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_unexpected_invalid_associated_interface_in_array.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_unexpected_invalid_associated_interface_in_array.data new file mode 100644 index 0000000000..2e163be160 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_unexpected_invalid_associated_interface_in_array.data @@ -0,0 +1,36 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method3_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method3_params + +[anchr]param0_ptr +[dist4]associated_interface_array // num_bytes +[u4]2 // num_elements +[u4]2 // interface ID index +[u4]14 // version +[u4]0xFFFFFFFF // interface ID index: Unexpected invalid + // value. +[u4]18 // version +[anchr]associated_interface_array + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]4 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[u4]19 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_unexpected_invalid_associated_interface_in_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_unexpected_invalid_associated_interface_in_array.expected new file mode 100644 index 0000000000..d8eda1f573 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_unexpected_invalid_associated_interface_in_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_wrong_interface_id_index_order.data b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_wrong_interface_id_index_order.data new file mode 100644 index 0000000000..4a63003e19 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_wrong_interface_id_index_order.data @@ -0,0 +1,38 @@ +[dist4]message_header // num_bytes +[u4]2 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // request_id +[dist8]payload +[dist8]payload_interface_ids +[anchr]message_header + +[anchr]payload +[dist4]method3_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method3_params + +[anchr]param0_ptr +[dist4]associated_interface_array // num_bytes +[u4]3 // num_elements +[u4]2 // interface ID index +[u4]14 // version +[u4]3 // interface ID index +[u4]0 // version +[u4]0 // interface ID index : It is smaller than + // the first element above, which is wrong. +[u4]18 // version +[anchr]associated_interface_array + +[anchr]payload_interface_ids +[dist4]interface_id_array // num_bytes +[u4]4 // num_elements : It is okay to have IDs that are not + // referred to. +[u4]4 +[u4]5 +[u4]8 +[u4]19 +[anchr]interface_id_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_wrong_interface_id_index_order.expected b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_wrong_interface_id_index_order.expected new file mode 100644 index 0000000000..420b4210e2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/associated_conformance_mthd3_wrong_interface_id_index_order.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_INTERFACE_ID diff --git a/mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.data b/mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.data new file mode 100644 index 0000000000..30032a172b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.data @@ -0,0 +1,7 @@ +[dist4]message_header // num_bytes +[u4]0 // version number +[u4]0 // interface ID +[u4]2 // There is no Method2 +[u4]0 // flags +[u4]0 // padding +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.expected b/mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.expected new file mode 100644 index 0000000000..a32d895c31 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_empty.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_empty.data new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_empty.data diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_empty.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_empty.expected new file mode 100644 index 0000000000..779df88cf6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_empty.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE 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 0000000000..68899f4650 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct.data @@ -0,0 +1,2 @@ +[u4]24 // num_bytes: Bigger than the total size of the message. +[u4]0 // version 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 0000000000..779df88cf6 --- /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_incomplete_struct_header.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct_header.data new file mode 100644 index 0000000000..21e7fbc02f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct_header.data @@ -0,0 +1 @@ +0x00 diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct_header.expected new file mode 100644 index 0000000000..779df88cf6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_incomplete_struct_header.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_MEMORY_RANGE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flag_combo.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flag_combo.data new file mode 100644 index 0000000000..dfb2dd262d --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flag_combo.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]3 // flags: This combination is illegal. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flag_combo.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flag_combo.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_invalid_flag_combo.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS 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 0000000000..27804a8390 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_missing_request_id.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]1 // flags: This is a response message which expects to + // have a request ID. +[u4]0 // padding +[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 0000000000..083db1ad27 --- /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_no_such_method.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_no_such_method.data new file mode 100644 index 0000000000..6302baeec1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_no_such_method.data @@ -0,0 +1,7 @@ +[dist4]message_header // num_bytes +[u4]0 // version number +[u4]0 // interface ID +[u4]9999 // There is no Method9999. +[u4]0 // flags +[u4]0 // padding +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_no_such_method.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_no_such_method.expected new file mode 100644 index 0000000000..a32d895c31 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_no_such_method.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD 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 0000000000..2fd0fcd452 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_huge.data @@ -0,0 +1,6 @@ +[u4]0xFFFFFFFF // num_bytes: Test whether a huge value will cause overflow. +[u4]0 // version +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]0 // flags +[u4]0 // padding 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 0000000000..779df88cf6 --- /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 0000000000..f58eca94df --- /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]0 // version +[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 0000000000..25aceeea5a --- /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 new file mode 100644 index 0000000000..e98f66f147 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.data @@ -0,0 +1,6 @@ +[u4]0 // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]0 // flags +[u4]0 // padding diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_less_than_struct_header.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_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_msghdr_num_bytes_version_mismatch_1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_1.data new file mode 100644 index 0000000000..df9e418105 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_1.data @@ -0,0 +1,9 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]0 // flags +[u4]0 // padding +[u8]0 // Extra bytes that result in mismatched |num_bytes| and + // |version|. +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_1.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_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_version_mismatch_2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_2.data new file mode 100644 index 0000000000..e2c574eea5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_2.data @@ -0,0 +1,10 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]1 // flags +[u4]0 // padding +[u8]0 // request_id +[u8]0 // Extra bytes that result in mismatched |num_bytes| and + // |version|. +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_2.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_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_version_mismatch_3.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_3.data new file mode 100644 index 0000000000..f7a321b6f8 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_3.data @@ -0,0 +1,7 @@ +[dist4]message_header // num_bytes +[u4]8 // version: |num_bytes| is too small for |version|. +[u4]0 // interface ID +[u4]0x80000000 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_3.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_3.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_msghdr_num_bytes_version_mismatch_3.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 new file mode 100644 index 0000000000..841da5e360 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.data @@ -0,0 +1,13 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method0_params // num_bytes +[u4]0 // version +[f]-1 // param0 +[u4]0 // padding +[anchr]method0_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_good.expected @@ -0,0 +1 @@ +PASS 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 0000000000..cff6a3066c --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct.data @@ -0,0 +1,11 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[u4]16 // num_bytes: Incomplete struct. +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..3f03ab2d04 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_incomplete_struct_header.data @@ -0,0 +1,9 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[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 0000000000..779df88cf6 --- /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_invalid_request_flags.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags.data new file mode 100644 index 0000000000..7aee806966 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0 // name +[u4]2 // flags: kMessageIsResponse is set in a request. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags2.data new file mode 100644 index 0000000000..5448c5f91b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags2.data @@ -0,0 +1,9 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0 // name +[u4]1 // flags: kMessageExpectsResponse is set in a request + // for a method that does not take a response. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags2.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_invalid_request_flags2.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS 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 0000000000..4a3e2fea2e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_huge.data @@ -0,0 +1,12 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[u4]0xFFFFFFFF // num_bytes: Test whether a huge value will cause overflow. +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..fa4c555096 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_min_requirement.data @@ -0,0 +1,11 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method0_params // num_bytes: Less than the minimal size that we expect. +[u4]0 // version +[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 0000000000..25aceeea5a --- /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 0000000000..d62206ed15 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd0_struct_num_bytes_less_than_struct_header.data @@ -0,0 +1,12 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]0 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[u4]4 // num_bytes: Less than the size of struct header. +[u4]0 // version +[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 0000000000..25aceeea5a --- /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_mthd10_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good.data new file mode 100644 index 0000000000..5dca2fe238 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good.data @@ -0,0 +1,48 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]10 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method10_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method10_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[dist8]key_string_1 +[dist8]key_string_2 +[anchr]key_array_member + +[anchr]key_string_1 +[dist4]key_string_1_member // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]key_string_1_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]key_string_2 +[dist4]key_string_2_member // num_bytes +[u4]5 // num_elements +5 6 7 8 9 +[anchr]key_string_2_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +1 2 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good_non_unique_keys.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good_non_unique_keys.data new file mode 100644 index 0000000000..f64fbc388b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good_non_unique_keys.data @@ -0,0 +1,48 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]10 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method10_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method10_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[dist8]key_string_1 +[dist8]key_string_2 +[anchr]key_array_member + +[anchr]key_string_1 +[dist4]key_string_1_member // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]key_string_1_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]key_string_2 +[dist4]key_string_2_member // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]key_string_2_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +1 2 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good_non_unique_keys.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good_non_unique_keys.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_good_non_unique_keys.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_keys.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_keys.data new file mode 100644 index 0000000000..3a99dc2ab8 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_keys.data @@ -0,0 +1,25 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]10 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method10_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method10_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[u8]0 // null keys array +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +1 2 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_keys.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_keys.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_keys.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_values.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_values.data new file mode 100644 index 0000000000..459d806dac --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_values.data @@ -0,0 +1,40 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]10 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method10_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method10_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[u8]0 // null values array +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[dist8]key_string_1 +[dist8]key_string_2 +[anchr]key_array_member + +[anchr]key_string_1 +[dist4]key_string_1_member // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]key_string_1_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]key_string_2 +[dist4]key_string_2_member // num_bytes +[u4]5 // num_elements +5 6 7 8 9 +[anchr]key_string_2_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_values.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_values.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_null_values.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_one_null_key.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_one_null_key.data new file mode 100644 index 0000000000..9127a26c25 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_one_null_key.data @@ -0,0 +1,40 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]10 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method10_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method10_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[dist8]key_string_1 +[u8]0 // one null key +[anchr]key_array_member + +[anchr]key_string_1 +[dist4]key_string_1_member // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]key_string_1_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +1 2 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_one_null_key.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_one_null_key.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_one_null_key.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_unequal_array_size.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_unequal_array_size.data new file mode 100644 index 0000000000..a2f903859f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_unequal_array_size.data @@ -0,0 +1,48 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]10 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method10_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method10_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[dist8]key_string_1 +[dist8]key_string_2 +[anchr]key_array_member + +[anchr]key_string_1 +[dist4]key_string_1_member // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]key_string_1_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]key_string_2 +[dist4]key_string_2_member // num_bytes +[u4]5 // num_elements +5 6 7 8 9 +[anchr]key_string_2_member + +[u4]0 [u4]0 [u1]0 [u1]0 [u1]0 // manual padding for array alignment + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]1 // num_elements +1 // unequal size +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_unequal_array_size.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_unequal_array_size.expected new file mode 100644 index 0000000000..2798d4861e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd10_unequal_array_size.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version0.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version0.data new file mode 100644 index 0000000000..781079bc39 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version0.data @@ -0,0 +1,19 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes +[u4]0 // version +[s4]123 // i +[u4]0 // padding +[anchr]struct_g diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version0.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version0.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version0.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version1.data new file mode 100644 index 0000000000..b9ab5bff51 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version1.data @@ -0,0 +1,20 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes +[u4]1 // version +[s4]123 // i +[u4]0 // padding +[u8]0 // struct_a +[anchr]struct_g diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version1.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version1.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version2.data new file mode 100644 index 0000000000..7d61446321 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version2.data @@ -0,0 +1,20 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes +[u4]2 // version +[s4]123 // i +[u4]0 // padding +[u8]0 // struct_a +[anchr]struct_g diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version2.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version2.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version3.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version3.data new file mode 100644 index 0000000000..3c3ee12717 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version3.data @@ -0,0 +1,28 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes +[u4]3 // version +[s4]123 // i +[b]00000001 // b +0 0 0 // padding +[u8]0 // struct_a +[dist8]str_ptr // str +[anchr]struct_g + +[anchr]str_ptr +[dist4]string // num_bytes +[u4]2 // num_elements +0 1 +[anchr]string diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version3.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version3.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version3.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_1.data new file mode 100644 index 0000000000..2e9fde6eeb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_1.data @@ -0,0 +1,30 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes +[u4]5 // version: Newer than what the validator knows. + // It is okay that the size is the same as the latest + // version that the validator knows. +[s4]123 // i +[b]00000001 // b +0 0 0 // padding +[u8]0 // struct_a +[dist8]str_ptr // str +[anchr]struct_g + +[anchr]str_ptr +[dist4]string // num_bytes +[u4]2 // num_elements +0 1 +[anchr]string diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_1.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_1.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_2.data new file mode 100644 index 0000000000..9a956267e8 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_2.data @@ -0,0 +1,30 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes +[u4]5 // version: Newer than what the validator knows. +[s4]123 // i +[b]00000001 // b +0 0 0 // padding +[u8]0 // struct_a +[dist8]str_ptr // str +[u8]0 // unknown contents +[u8]0 // unknown contents +[anchr]struct_g + +[anchr]str_ptr +[dist4]string // num_bytes +[u4]2 // num_elements +0 1 +[anchr]string diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_2.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_good_version_newer_than_known_2.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_1.data new file mode 100644 index 0000000000..c2e5a8da66 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_1.data @@ -0,0 +1,21 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes: The size is too big for the version. +[u4]1 // version +[s4]123 // i +[u4]0 // padding +[u8]0 // struct_a +[u8]0 // Unexpected contents that cause the mismatch. +[anchr]struct_g diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_1.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_1.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_2.data new file mode 100644 index 0000000000..edfe5fa8b1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_2.data @@ -0,0 +1,19 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]11 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method11_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method11_params + +[anchr]param0_ptr +[dist4]struct_g // num_bytes: The size is too small for the version. +[u4]2 // version +[s4]123 // i +[u4]0 // padding +[anchr]struct_g diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_2.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd11_num_bytes_version_mismatch_2.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd12_invalid_request_flags.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd12_invalid_request_flags.data new file mode 100644 index 0000000000..13135aecad --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd12_invalid_request_flags.data @@ -0,0 +1,9 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]12 // name +[u4]0 // flags: kMessageExpectsResponse is not set but + // expected. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd12_invalid_request_flags.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd12_invalid_request_flags.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd12_invalid_request_flags.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_1.data new file mode 100644 index 0000000000..51973be114 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_1.data @@ -0,0 +1,17 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]13 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method13_params // num_bytes +[u4]0 // version +[u4]0xFFFFFFFF // param0 +[u4]1234 +[u4]65535 // param1 +[u4]0xFFFFFFFF // param2 +[u4]3242 +[u4]0 // padding +[anchr]method13_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_1.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_1.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_2.data new file mode 100644 index 0000000000..b739731093 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_2.data @@ -0,0 +1,19 @@ +[handles]2 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]13 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method13_params // num_bytes +[u4]0 // version +[u4]0 // param0 +[u4]1234 +[u4]65535 // param1 +[u4]1 // param2 +[u4]3242 +[u4]0 // padding +[anchr]method13_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_2.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd13_good_2.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_known_enum_values.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_known_enum_values.data new file mode 100644 index 0000000000..14448497f1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_known_enum_values.data @@ -0,0 +1,13 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]14 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method14_params // num_bytes +[u4]0 // version +[u4]0 // param0 +[u4]1 // param1 +[anchr]method14_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_known_enum_values.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_known_enum_values.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_known_enum_values.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_uknown_extensible_enum_value.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_uknown_extensible_enum_value.data new file mode 100644 index 0000000000..50b9ea33b0 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_uknown_extensible_enum_value.data @@ -0,0 +1,13 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]14 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method14_params // num_bytes +[u4]0 // version +[u4]0 // param0 +[u4]0xFFFFFFFF // param1: Unknown value is okay for extensible enum. +[anchr]method14_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_uknown_extensible_enum_value.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_uknown_extensible_enum_value.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_good_uknown_extensible_enum_value.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_uknown_non_extensible_enum_value.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_uknown_non_extensible_enum_value.data new file mode 100644 index 0000000000..567f23b254 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_uknown_non_extensible_enum_value.data @@ -0,0 +1,14 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]14 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method14_params // num_bytes +[u4]0 // version +[u4]0xFFFFFFFF // param0: Unknown value is not allowed for + // non-extensible enum. +[u4]2 // param1 +[anchr]method14_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_uknown_non_extensible_enum_value.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_uknown_non_extensible_enum_value.expected new file mode 100644 index 0000000000..9ef4ce3fdd --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd14_uknown_non_extensible_enum_value.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNKNOWN_ENUM_VALUE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_empy_enum_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_empy_enum_array.data new file mode 100644 index 0000000000..21af8a3df1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_empy_enum_array.data @@ -0,0 +1,22 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]15 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method15_params // num_bytes +[u4]0 // version +[dist8]enum_array_0 // param0 +[u8]0 // param1 +[anchr]method15_params + +[anchr]enum_array_0 +[dist4]enum_array_0_member // num_bytes +[u4]0 // num_elements +[anchr]enum_array_0_member + +[u8]0x5678 // This is not part of the array above (which is + // empty), so enum validation shouldn't be done on + // it. diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_empy_enum_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_empy_enum_array.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_empy_enum_array.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_known_enum_array_values.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_known_enum_array_values.data new file mode 100644 index 0000000000..c418d8994c --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_known_enum_array_values.data @@ -0,0 +1,27 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]15 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method15_params // num_bytes +[u4]0 // version +[dist8]enum_array_0 // param0 +[dist8]enum_array_1 // param1 +[anchr]method15_params + +[anchr]enum_array_0 +[dist4]enum_array_0_member // num_bytes +[u4]2 // num_elements +[u4]0 +[u4]1 +[anchr]enum_array_0_member + +[anchr]enum_array_1 +[dist4]enum_array_1_member // num_bytes +[u4]2 // num_elements +[u4]0 +[u4]1 +[anchr]enum_array_1_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_known_enum_array_values.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_known_enum_array_values.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_known_enum_array_values.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_uknown_extensible_enum_array_value.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_uknown_extensible_enum_array_value.data new file mode 100644 index 0000000000..b6be6d93c6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_uknown_extensible_enum_array_value.data @@ -0,0 +1,20 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]15 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method15_params // num_bytes +[u4]0 // version +[u8]0 // param0 +[dist8]enum_array_1 // param1 +[anchr]method15_params + +[anchr]enum_array_1 +[dist4]enum_array_1_member // num_bytes +[u4]2 // num_elements +[u4]0 +[u4]0x1234 // Unknown value is okay for extensible enum. +[anchr]enum_array_1_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_uknown_extensible_enum_array_value.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_uknown_extensible_enum_array_value.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_good_uknown_extensible_enum_array_value.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_uknown_non_extensible_enum_array_value.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_uknown_non_extensible_enum_array_value.data new file mode 100644 index 0000000000..0a46e0a4a2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_uknown_non_extensible_enum_array_value.data @@ -0,0 +1,21 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]15 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method15_params // num_bytes +[u4]0 // version +[dist8]enum_array_0 // param0 +[u8]0 // param1 +[anchr]method15_params + +[anchr]enum_array_0 +[dist4]enum_array_0_member // num_bytes +[u4]2 // num_elements +[u4]1 +[u4]0x5678 // Unknown value is not allowed for non-extensible + // enum. +[anchr]enum_array_0_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_uknown_non_extensible_enum_array_value.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_uknown_non_extensible_enum_array_value.expected new file mode 100644 index 0000000000..9ef4ce3fdd --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd15_uknown_non_extensible_enum_array_value.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNKNOWN_ENUM_VALUE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_key.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_key.data new file mode 100644 index 0000000000..0425ea72f6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_key.data @@ -0,0 +1,34 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]16 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method16_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method16_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[u4]0x5678 // Unknown value is not allowed for non-extensible + // enum. +[u4]1 +[anchr]key_array_member + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +[u4]1 +[u4]2 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_key.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_key.expected new file mode 100644 index 0000000000..9ef4ce3fdd --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_key.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNKNOWN_ENUM_VALUE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_value.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_value.data new file mode 100644 index 0000000000..2c2ea26d93 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_value.data @@ -0,0 +1,34 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]16 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method16_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method16_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[u4]1 +[u4]2 +[anchr]key_array_member + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +[u4]0x5678 // Unknown value is not allowed for non-extensible + // enum. +[u4]1 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_value.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_value.expected new file mode 100644 index 0000000000..9ef4ce3fdd --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd16_uknown_non_extensible_enum_map_value.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNKNOWN_ENUM_VALUE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_good.data new file mode 100644 index 0000000000..48807ab36f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_good.data @@ -0,0 +1,23 @@ +[handles]10 // Larger than the number of handles that we know about is okay. + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]17 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method17_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method17_params + +[anchr]param0_ptr +[dist4]interface_array // num_bytes +[u4]2 // num_elements +[u4]4 // handle +[u4]14 // version +[u4]5 // handle +[u4]18 // version +[anchr]interface_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_interface_handle_out_of_range_in_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_interface_handle_out_of_range_in_array.data new file mode 100644 index 0000000000..e549a10e3a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_interface_handle_out_of_range_in_array.data @@ -0,0 +1,24 @@ +[handles]10 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]17 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method17_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method17_params + +[anchr]param0_ptr +[dist4]interface_array // num_bytes +[u4]2 // num_elements +[u4]4 // handle +[u4]14 // version +[u4]10 // handle: It is outside of the valid encoded handle + // range [0, 10) +[u4]18 // version +[anchr]interface_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_interface_handle_out_of_range_in_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_interface_handle_out_of_range_in_array.expected new file mode 100644 index 0000000000..eef8e38a84 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_interface_handle_out_of_range_in_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_unexpected_invalid_interface_in_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_unexpected_invalid_interface_in_array.data new file mode 100644 index 0000000000..1ce1d92fe5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_unexpected_invalid_interface_in_array.data @@ -0,0 +1,23 @@ +[handles]10 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]17 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method17_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method17_params + +[anchr]param0_ptr +[dist4]interface_array // num_bytes +[u4]2 // num_elements +[u4]4 // handle +[u4]14 // version +[u4]0xFFFFFFFF // handle: An unexpected invalid handle. +[u4]18 // version +[anchr]interface_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_unexpected_invalid_interface_in_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_unexpected_invalid_interface_in_array.expected new file mode 100644 index 0000000000..6768236f6e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd17_unexpected_invalid_interface_in_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd18_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd18_good.data new file mode 100644 index 0000000000..663796d50e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd18_good.data @@ -0,0 +1,14 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]18 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method18_params // num_bytes +[u4]0 // version +[u4]0 // param0: Size 0 indicating the inlined union is null. +[u4]0 // param0: Tag field ignored. +[u8]0 // param0: Payload field ignored. +[anchr]method18_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd18_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd18_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd18_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.data new file mode 100644 index 0000000000..96e52d5ee2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.data @@ -0,0 +1,612 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]19 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method0_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method0_params + +[anchr]param0_ptr +[dist4]struct_a1 // num_bytes +[u4]0 // version +[dist8]struct_a2_ptr // struct_a2 +[anchr]struct_a1 + +[anchr]struct_a2_ptr +[dist4]struct_a2 // num_bytes +[u4]0 // version +[dist8]struct_a3_ptr // struct_a2 +[anchr]struct_a2 + +[anchr]struct_a3_ptr +[dist4]struct_a3 // num_bytes +[u4]0 // version +[dist8]struct_a4_ptr // struct_a3 +[anchr]struct_a3 + +[anchr]struct_a4_ptr +[dist4]struct_a4 // num_bytes +[u4]0 // version +[dist8]struct_a5_ptr // struct_a4 +[anchr]struct_a4 + +[anchr]struct_a5_ptr +[dist4]struct_a5 // num_bytes +[u4]0 // version +[dist8]struct_a6_ptr // struct_a5 +[anchr]struct_a5 + +[anchr]struct_a6_ptr +[dist4]struct_a6 // num_bytes +[u4]0 // version +[dist8]struct_a7_ptr // struct_a6 +[anchr]struct_a6 + +[anchr]struct_a7_ptr +[dist4]struct_a7 // num_bytes +[u4]0 // version +[dist8]struct_a8_ptr // struct_a7 +[anchr]struct_a7 + +[anchr]struct_a8_ptr +[dist4]struct_a8 // num_bytes +[u4]0 // version +[dist8]struct_a9_ptr // struct_a8 +[anchr]struct_a8 + +[anchr]struct_a9_ptr +[dist4]struct_a9 // num_bytes +[u4]0 // version +[dist8]struct_a10_ptr // struct_a9 +[anchr]struct_a9 + +[anchr]struct_a10_ptr +[dist4]struct_a10 // num_bytes +[u4]0 // version +[dist8]struct_a11_ptr // struct_a10 +[anchr]struct_a10 + +[anchr]struct_a11_ptr +[dist4]struct_a11 // num_bytes +[u4]0 // version +[dist8]struct_a12_ptr // struct_a11 +[anchr]struct_a11 + +[anchr]struct_a12_ptr +[dist4]struct_a12 // num_bytes +[u4]0 // version +[dist8]struct_a13_ptr // struct_a12 +[anchr]struct_a12 + +[anchr]struct_a13_ptr +[dist4]struct_a13 // num_bytes +[u4]0 // version +[dist8]struct_a14_ptr // struct_a13 +[anchr]struct_a13 + +[anchr]struct_a14_ptr +[dist4]struct_a14 // num_bytes +[u4]0 // version +[dist8]struct_a15_ptr // struct_a14 +[anchr]struct_a14 + +[anchr]struct_a15_ptr +[dist4]struct_a15 // num_bytes +[u4]0 // version +[dist8]struct_a16_ptr // struct_a15 +[anchr]struct_a15 + +[anchr]struct_a16_ptr +[dist4]struct_a16 // num_bytes +[u4]0 // version +[dist8]struct_a17_ptr // struct_a16 +[anchr]struct_a16 + +[anchr]struct_a17_ptr +[dist4]struct_a17 // num_bytes +[u4]0 // version +[dist8]struct_a18_ptr // struct_a17 +[anchr]struct_a17 + +[anchr]struct_a18_ptr +[dist4]struct_a18 // num_bytes +[u4]0 // version +[dist8]struct_a19_ptr // struct_a18 +[anchr]struct_a18 + +[anchr]struct_a19_ptr +[dist4]struct_a19 // num_bytes +[u4]0 // version +[dist8]struct_a20_ptr // struct_a19 +[anchr]struct_a19 + +[anchr]struct_a20_ptr +[dist4]struct_a20 // num_bytes +[u4]0 // version +[dist8]struct_a21_ptr // struct_a20 +[anchr]struct_a20 + +[anchr]struct_a21_ptr +[dist4]struct_a21 // num_bytes +[u4]0 // version +[dist8]struct_a22_ptr // struct_a21 +[anchr]struct_a21 + +[anchr]struct_a22_ptr +[dist4]struct_a22 // num_bytes +[u4]0 // version +[dist8]struct_a23_ptr // struct_a22 +[anchr]struct_a22 + +[anchr]struct_a23_ptr +[dist4]struct_a23 // num_bytes +[u4]0 // version +[dist8]struct_a24_ptr // struct_a23 +[anchr]struct_a23 + +[anchr]struct_a24_ptr +[dist4]struct_a24 // num_bytes +[u4]0 // version +[dist8]struct_a25_ptr // struct_a24 +[anchr]struct_a24 + +[anchr]struct_a25_ptr +[dist4]struct_a25 // num_bytes +[u4]0 // version +[dist8]struct_a26_ptr // struct_a25 +[anchr]struct_a25 + +[anchr]struct_a26_ptr +[dist4]struct_a26 // num_bytes +[u4]0 // version +[dist8]struct_a27_ptr // struct_a26 +[anchr]struct_a26 + +[anchr]struct_a27_ptr +[dist4]struct_a27 // num_bytes +[u4]0 // version +[dist8]struct_a28_ptr // struct_a27 +[anchr]struct_a27 + +[anchr]struct_a28_ptr +[dist4]struct_a28 // num_bytes +[u4]0 // version +[dist8]struct_a29_ptr // struct_a28 +[anchr]struct_a28 + +[anchr]struct_a29_ptr +[dist4]struct_a29 // num_bytes +[u4]0 // version +[dist8]struct_a30_ptr // struct_a29 +[anchr]struct_a29 + +[anchr]struct_a30_ptr +[dist4]struct_a30 // num_bytes +[u4]0 // version +[dist8]struct_a31_ptr // struct_a30 +[anchr]struct_a30 + +[anchr]struct_a31_ptr +[dist4]struct_a31 // num_bytes +[u4]0 // version +[dist8]struct_a32_ptr // struct_a31 +[anchr]struct_a31 + +[anchr]struct_a32_ptr +[dist4]struct_a32 // num_bytes +[u4]0 // version +[dist8]struct_a33_ptr // struct_a32 +[anchr]struct_a32 + +[anchr]struct_a33_ptr +[dist4]struct_a33 // num_bytes +[u4]0 // version +[dist8]struct_a34_ptr // struct_a33 +[anchr]struct_a33 + +[anchr]struct_a34_ptr +[dist4]struct_a34 // num_bytes +[u4]0 // version +[dist8]struct_a35_ptr // struct_a34 +[anchr]struct_a34 + +[anchr]struct_a35_ptr +[dist4]struct_a35 // num_bytes +[u4]0 // version +[dist8]struct_a36_ptr // struct_a35 +[anchr]struct_a35 + +[anchr]struct_a36_ptr +[dist4]struct_a36 // num_bytes +[u4]0 // version +[dist8]struct_a37_ptr // struct_a36 +[anchr]struct_a36 + +[anchr]struct_a37_ptr +[dist4]struct_a37 // num_bytes +[u4]0 // version +[dist8]struct_a38_ptr // struct_a37 +[anchr]struct_a37 + +[anchr]struct_a38_ptr +[dist4]struct_a38 // num_bytes +[u4]0 // version +[dist8]struct_a39_ptr // struct_a38 +[anchr]struct_a38 + +[anchr]struct_a39_ptr +[dist4]struct_a39 // num_bytes +[u4]0 // version +[dist8]struct_a40_ptr // struct_a39 +[anchr]struct_a39 + +[anchr]struct_a40_ptr +[dist4]struct_a40 // num_bytes +[u4]0 // version +[dist8]struct_a41_ptr // struct_a40 +[anchr]struct_a40 + +[anchr]struct_a41_ptr +[dist4]struct_a41 // num_bytes +[u4]0 // version +[dist8]struct_a42_ptr // struct_a41 +[anchr]struct_a41 + +[anchr]struct_a42_ptr +[dist4]struct_a42 // num_bytes +[u4]0 // version +[dist8]struct_a43_ptr // struct_a42 +[anchr]struct_a42 + +[anchr]struct_a43_ptr +[dist4]struct_a43 // num_bytes +[u4]0 // version +[dist8]struct_a44_ptr // struct_a43 +[anchr]struct_a43 + +[anchr]struct_a44_ptr +[dist4]struct_a44 // num_bytes +[u4]0 // version +[dist8]struct_a45_ptr // struct_a44 +[anchr]struct_a44 + +[anchr]struct_a45_ptr +[dist4]struct_a45 // num_bytes +[u4]0 // version +[dist8]struct_a46_ptr // struct_a45 +[anchr]struct_a45 + +[anchr]struct_a46_ptr +[dist4]struct_a46 // num_bytes +[u4]0 // version +[dist8]struct_a47_ptr // struct_a46 +[anchr]struct_a46 + +[anchr]struct_a47_ptr +[dist4]struct_a47 // num_bytes +[u4]0 // version +[dist8]struct_a48_ptr // struct_a47 +[anchr]struct_a47 + +[anchr]struct_a48_ptr +[dist4]struct_a48 // num_bytes +[u4]0 // version +[dist8]struct_a49_ptr // struct_a48 +[anchr]struct_a48 + +[anchr]struct_a49_ptr +[dist4]struct_a49 // num_bytes +[u4]0 // version +[dist8]struct_a50_ptr // struct_a49 +[anchr]struct_a49 + +[anchr]struct_a50_ptr +[dist4]struct_a50 // num_bytes +[u4]0 // version +[dist8]struct_a51_ptr // struct_a50 +[anchr]struct_a50 + +[anchr]struct_a51_ptr +[dist4]struct_a51 // num_bytes +[u4]0 // version +[dist8]struct_a52_ptr // struct_a51 +[anchr]struct_a51 + +[anchr]struct_a52_ptr +[dist4]struct_a52 // num_bytes +[u4]0 // version +[dist8]struct_a53_ptr // struct_a52 +[anchr]struct_a52 + +[anchr]struct_a53_ptr +[dist4]struct_a53 // num_bytes +[u4]0 // version +[dist8]struct_a54_ptr // struct_a53 +[anchr]struct_a53 + +[anchr]struct_a54_ptr +[dist4]struct_a54 // num_bytes +[u4]0 // version +[dist8]struct_a55_ptr // struct_a54 +[anchr]struct_a54 + +[anchr]struct_a55_ptr +[dist4]struct_a55 // num_bytes +[u4]0 // version +[dist8]struct_a56_ptr // struct_a55 +[anchr]struct_a55 + +[anchr]struct_a56_ptr +[dist4]struct_a56 // num_bytes +[u4]0 // version +[dist8]struct_a57_ptr // struct_a56 +[anchr]struct_a56 + +[anchr]struct_a57_ptr +[dist4]struct_a57 // num_bytes +[u4]0 // version +[dist8]struct_a58_ptr // struct_a57 +[anchr]struct_a57 + +[anchr]struct_a58_ptr +[dist4]struct_a58 // num_bytes +[u4]0 // version +[dist8]struct_a59_ptr // struct_a58 +[anchr]struct_a58 + +[anchr]struct_a59_ptr +[dist4]struct_a59 // num_bytes +[u4]0 // version +[dist8]struct_a60_ptr // struct_a59 +[anchr]struct_a59 + +[anchr]struct_a60_ptr +[dist4]struct_a60 // num_bytes +[u4]0 // version +[dist8]struct_a61_ptr // struct_a60 +[anchr]struct_a60 + +[anchr]struct_a61_ptr +[dist4]struct_a61 // num_bytes +[u4]0 // version +[dist8]struct_a62_ptr // struct_a61 +[anchr]struct_a61 + +[anchr]struct_a62_ptr +[dist4]struct_a62 // num_bytes +[u4]0 // version +[dist8]struct_a63_ptr // struct_a62 +[anchr]struct_a62 + +[anchr]struct_a63_ptr +[dist4]struct_a63 // num_bytes +[u4]0 // version +[dist8]struct_a64_ptr // struct_a63 +[anchr]struct_a63 + +[anchr]struct_a64_ptr +[dist4]struct_a64 // num_bytes +[u4]0 // version +[dist8]struct_a65_ptr // struct_a64 +[anchr]struct_a64 + +[anchr]struct_a65_ptr +[dist4]struct_a65 // num_bytes +[u4]0 // version +[dist8]struct_a66_ptr // struct_a65 +[anchr]struct_a65 + +[anchr]struct_a66_ptr +[dist4]struct_a66 // num_bytes +[u4]0 // version +[dist8]struct_a67_ptr // struct_a66 +[anchr]struct_a66 + +[anchr]struct_a67_ptr +[dist4]struct_a67 // num_bytes +[u4]0 // version +[dist8]struct_a68_ptr // struct_a67 +[anchr]struct_a67 + +[anchr]struct_a68_ptr +[dist4]struct_a68 // num_bytes +[u4]0 // version +[dist8]struct_a69_ptr // struct_a68 +[anchr]struct_a68 + +[anchr]struct_a69_ptr +[dist4]struct_a69 // num_bytes +[u4]0 // version +[dist8]struct_a70_ptr // struct_a69 +[anchr]struct_a69 + +[anchr]struct_a70_ptr +[dist4]struct_a70 // num_bytes +[u4]0 // version +[dist8]struct_a71_ptr // struct_a70 +[anchr]struct_a70 + +[anchr]struct_a71_ptr +[dist4]struct_a71 // num_bytes +[u4]0 // version +[dist8]struct_a72_ptr // struct_a71 +[anchr]struct_a71 + +[anchr]struct_a72_ptr +[dist4]struct_a72 // num_bytes +[u4]0 // version +[dist8]struct_a73_ptr // struct_a72 +[anchr]struct_a72 + +[anchr]struct_a73_ptr +[dist4]struct_a73 // num_bytes +[u4]0 // version +[dist8]struct_a74_ptr // struct_a73 +[anchr]struct_a73 + +[anchr]struct_a74_ptr +[dist4]struct_a74 // num_bytes +[u4]0 // version +[dist8]struct_a75_ptr // struct_a74 +[anchr]struct_a74 + +[anchr]struct_a75_ptr +[dist4]struct_a75 // num_bytes +[u4]0 // version +[dist8]struct_a76_ptr // struct_a75 +[anchr]struct_a75 + +[anchr]struct_a76_ptr +[dist4]struct_a76 // num_bytes +[u4]0 // version +[dist8]struct_a77_ptr // struct_a76 +[anchr]struct_a76 + +[anchr]struct_a77_ptr +[dist4]struct_a77 // num_bytes +[u4]0 // version +[dist8]struct_a78_ptr // struct_a77 +[anchr]struct_a77 + +[anchr]struct_a78_ptr +[dist4]struct_a78 // num_bytes +[u4]0 // version +[dist8]struct_a79_ptr // struct_a78 +[anchr]struct_a78 + +[anchr]struct_a79_ptr +[dist4]struct_a79 // num_bytes +[u4]0 // version +[dist8]struct_a80_ptr // struct_a79 +[anchr]struct_a79 + +[anchr]struct_a80_ptr +[dist4]struct_a80 // num_bytes +[u4]0 // version +[dist8]struct_a81_ptr // struct_a80 +[anchr]struct_a80 + +[anchr]struct_a81_ptr +[dist4]struct_a81 // num_bytes +[u4]0 // version +[dist8]struct_a82_ptr // struct_a81 +[anchr]struct_a81 + +[anchr]struct_a82_ptr +[dist4]struct_a82 // num_bytes +[u4]0 // version +[dist8]struct_a83_ptr // struct_a82 +[anchr]struct_a82 + +[anchr]struct_a83_ptr +[dist4]struct_a83 // num_bytes +[u4]0 // version +[dist8]struct_a84_ptr // struct_a83 +[anchr]struct_a83 + +[anchr]struct_a84_ptr +[dist4]struct_a84 // num_bytes +[u4]0 // version +[dist8]struct_a85_ptr // struct_a84 +[anchr]struct_a84 + +[anchr]struct_a85_ptr +[dist4]struct_a85 // num_bytes +[u4]0 // version +[dist8]struct_a86_ptr // struct_a85 +[anchr]struct_a85 + +[anchr]struct_a86_ptr +[dist4]struct_a86 // num_bytes +[u4]0 // version +[dist8]struct_a87_ptr // struct_a86 +[anchr]struct_a86 + +[anchr]struct_a87_ptr +[dist4]struct_a87 // num_bytes +[u4]0 // version +[dist8]struct_a88_ptr // struct_a87 +[anchr]struct_a87 + +[anchr]struct_a88_ptr +[dist4]struct_a88 // num_bytes +[u4]0 // version +[dist8]struct_a89_ptr // struct_a88 +[anchr]struct_a88 + +[anchr]struct_a89_ptr +[dist4]struct_a89 // num_bytes +[u4]0 // version +[dist8]struct_a90_ptr // struct_a89 +[anchr]struct_a89 + +[anchr]struct_a90_ptr +[dist4]struct_a90 // num_bytes +[u4]0 // version +[dist8]struct_a91_ptr // struct_a90 +[anchr]struct_a90 + +[anchr]struct_a91_ptr +[dist4]struct_a91 // num_bytes +[u4]0 // version +[dist8]struct_a92_ptr // struct_a91 +[anchr]struct_a91 + +[anchr]struct_a92_ptr +[dist4]struct_a92 // num_bytes +[u4]0 // version +[dist8]struct_a93_ptr // struct_a92 +[anchr]struct_a92 + +[anchr]struct_a93_ptr +[dist4]struct_a93 // num_bytes +[u4]0 // version +[dist8]struct_a94_ptr // struct_a93 +[anchr]struct_a93 + +[anchr]struct_a94_ptr +[dist4]struct_a94 // num_bytes +[u4]0 // version +[dist8]struct_a95_ptr // struct_a94 +[anchr]struct_a94 + +[anchr]struct_a95_ptr +[dist4]struct_a95 // num_bytes +[u4]0 // version +[dist8]struct_a96_ptr // struct_a95 +[anchr]struct_a95 + +[anchr]struct_a96_ptr +[dist4]struct_a96 // num_bytes +[u4]0 // version +[dist8]struct_a97_ptr // struct_a96 +[anchr]struct_a96 + +[anchr]struct_a97_ptr +[dist4]struct_a97 // num_bytes +[u4]0 // version +[dist8]struct_a98_ptr // struct_a97 +[anchr]struct_a97 + +[anchr]struct_a98_ptr +[dist4]struct_a98 // num_bytes +[u4]0 // version +[dist8]struct_a99_ptr // struct_a98 +[anchr]struct_a98 + +[anchr]struct_a99_ptr +[dist4]struct_a99 // num_bytes +[u4]0 // version +[dist8]struct_a100_ptr // struct_a99 +[anchr]struct_a99 + +[anchr]struct_a100_ptr +[dist4]struct_a100 // num_bytes +[u4]0 // version +[u8]0 // struct_a100 +[anchr]struct_a100 diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.expected new file mode 100644 index 0000000000..81d6cd84e4 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MAX_RECURSION_DEPTH
\ No newline at end of file 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 0000000000..b6c201a948 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_good.data @@ -0,0 +1,18 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]1 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method1_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method1_params + +[anchr]param0_ptr +[dist4]struct_a // num_bytes +[u4]0 // version +[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 0000000000..7ef22e9a43 --- /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_misaligned_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.data new file mode 100644 index 0000000000..ec39b71d03 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_misaligned_struct.data @@ -0,0 +1,20 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]1 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method1_params // num_bytes +[u4]0 // version +[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]0 // version +[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 0000000000..acca999b3f --- /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 0000000000..6d9205093b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_struct_pointer_overflow.data @@ -0,0 +1,13 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]1 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method1_params // num_bytes +[u4]0 // version +[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 0000000000..23abb8cbb7 --- /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_mthd1_unexpected_null_struct.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_unexpected_null_struct.data new file mode 100644 index 0000000000..569733bcb3 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_unexpected_null_struct.data @@ -0,0 +1,12 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]1 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method1_params // num_bytes +[u4]0 // version +[u8]0 // param0: An unexpected null pointer. +[anchr]method1_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_unexpected_null_struct.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_unexpected_null_struct.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd1_unexpected_null_struct.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.data new file mode 100644 index 0000000000..8ec608bcd1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.data @@ -0,0 +1,57 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]20 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method20_params // num_bytes +[u4]0 // version +[dist8]map_data_ptr // param0 +[anchr]method20_params + +[anchr]map_data_ptr +[dist4]map_data_struct_header // num_bytes +[u4]0 // version +[dist8]key_array_ptr +[dist8]value_array_ptr +[anchr]map_data_struct_header + +[anchr]key_array_ptr +[dist4]key_array_member // num_bytes +[u4]2 // num_elements +[dist8]key_struct_b_1 +[dist8]key_struct_b_2 +[anchr]key_array_member + +[anchr]key_struct_b_1 +[dist4]key_struct_b_1_member // num_bytes +[u4]0 // version +[dist8]key_struct_a_1 // struct_a +[anchr]key_struct_b_1_member + +[anchr]key_struct_a_1 +[dist4]key_struct_a_1_member // num_bytes +[u4]0 // version +[u8]1234 // i +[anchr]key_struct_a_1_member + +[anchr]key_struct_b_2 +[dist4]key_struct_b_2_member // num_bytes +[u4]0 // version +[dist8]key_struct_a_2 // struct_a +[anchr]key_struct_b_2_member + +[anchr]key_struct_a_2 +[dist4]key_struct_a_2_member // num_bytes +[u4]0 // version +[u8]5678 // i +[anchr]key_struct_a_2_member + +[anchr]value_array_ptr +[dist4]value_array_member // num_bytes +[u4]2 // num_elements +[u1]1 +[u1]2 +[anchr]value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.data new file mode 100644 index 0000000000..d3ae88e3e6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.data @@ -0,0 +1,13 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]21 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method21_params // num_bytes +[u4]0 // version +[u4]7 // param0. All values are valid for an extensible enum. +[u4]0 // padding +[anchr]method21_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.data new file mode 100644 index 0000000000..414785ceb1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.data @@ -0,0 +1,14 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]22 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method21_params // num_bytes +[u4]0 // version +[u4]0 // param0. No values are valid for an empty + // non-extensible enum. +[u4]0 // padding +[anchr]method21_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.expected new file mode 100644 index 0000000000..9ef4ce3fdd --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNKNOWN_ENUM_VALUE 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 0000000000..40719f5708 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.data @@ -0,0 +1,34 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]2 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method2_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method2_params + +[anchr]param0_ptr +[dist4]struct_b // num_bytes +[u4]0 // version +[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]0 // version +[u8]12345 // i +[anchr]struct_a_member + +[anchr]param1_ptr +[dist4]struct_a_param // num_bytes +[u4]0 // version +[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 0000000000..7ef22e9a43 --- /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 0000000000..ef6525b008 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.data @@ -0,0 +1,27 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]2 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method2_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method2_params + +[anchr]param0_ptr +[dist4]struct_b // num_bytes +[u4]0 // version +[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]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..58b25a1aa9 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_overlapped_objects.data @@ -0,0 +1,32 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]2 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method2_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method2_params + +[anchr]param0_ptr +[dist4]struct_b // num_bytes +[u4]0 // version +[dist8]struct_a_ptr // struct_a +[anchr]struct_b + +[anchr]struct_a_ptr +[dist4]struct_a_member // num_bytes +[u4]0 // version + +[anchr]param1_ptr +// The following |num_bytes| and |version| fields are also the |i| field of the +// previous struct. +[dist4]struct_a_param // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..3038ed8097 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_wrong_layout_order.data @@ -0,0 +1,34 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]2 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method2_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method2_params + +[anchr]param0_ptr +[dist4]struct_b // num_bytes +[u4]0 // version +[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]0 // version +[u8]67890 // i +[anchr]struct_a_param + +[anchr]struct_a_ptr +[dist4]struct_a_member // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..681463663f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_huge.data @@ -0,0 +1,18 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..45021c0634 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_array_header.data @@ -0,0 +1,18 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..5a1ec4ef20 --- /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 0000000000..3d3870298f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_num_bytes_less_than_necessary_size.data @@ -0,0 +1,20 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..5a1ec4ef20 --- /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 0000000000..2f9e091b04 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_array_pointer_overflow.data @@ -0,0 +1,13 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..23abb8cbb7 --- /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 0000000000..ad26763f5f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_good.data @@ -0,0 +1,19 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..7ef22e9a43 --- /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_incomplete_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.data new file mode 100644 index 0000000000..d7734589ce --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array.data @@ -0,0 +1,16 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..ca462a5758 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_incomplete_array_header.data @@ -0,0 +1,15 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..5adfbbaa97 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_misaligned_array.data @@ -0,0 +1,21 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[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 0000000000..acca999b3f --- /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_mthd3_unexpected_null_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_unexpected_null_array.data new file mode 100644 index 0000000000..0f96c4bd58 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_unexpected_null_array.data @@ -0,0 +1,12 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]3 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method3_params // num_bytes +[u4]0 // version +[u8]0 // param0: An unexpected null pointer. +[anchr]method3_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_unexpected_null_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_unexpected_null_array.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd3_unexpected_null_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER 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 0000000000..84943d29ec --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_good.data @@ -0,0 +1,34 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]4 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method4_params // num_bytes: Larger than what we know is okay. +[u4]3 // version: 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]0 // version +[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 0000000000..7ef22e9a43 --- /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 0000000000..2f84185552 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_multiple_pointers_to_same_array.data @@ -0,0 +1,26 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]4 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method4_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method4_params + +[anchr]param0_ptr +[dist4]struct_c // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..d863e64a12 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_overlapped_objects.data @@ -0,0 +1,32 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]4 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method4_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method4_params + +[anchr]param0_ptr +[dist4]struct_c // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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 0000000000..b61423a6d7 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd4_wrong_layout_order.data @@ -0,0 +1,35 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]4 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method4_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method4_params + +[anchr]param0_ptr +[dist4]struct_c // num_bytes +[u4]0 // version +[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 0000000000..779df88cf6 --- /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/data/validation/conformance_mthd5_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_good.data new file mode 100644 index 0000000000..dcec8952d1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_good.data @@ -0,0 +1,37 @@ +[handles]10 // Larger than the number of handles that we know about is okay. + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]5 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method5_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[u4]4 // param1 +[u4]0 // padding +[anchr]method5_params + +[anchr]param0_ptr +[dist4]struct_e // num_bytes +[u4]0 // version +[dist8]struct_d_ptr // struct_d +[u4]3 // data_pipe_consumer +[u4]0 // padding +[anchr]struct_e + +[anchr]struct_d_ptr +[dist4]struct_d // num_bytes +[u4]0 // version +[dist8]message_pipes_ptr // message_pipes +[anchr]struct_d + +[anchr]message_pipes_ptr +[dist4]message_pipe_array // num_bytes +[u4]2 // num_elements +[u4]0 +[u4]1 +[anchr]message_pipe_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_handle_out_of_range.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_handle_out_of_range.data new file mode 100644 index 0000000000..d4a82ed174 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_handle_out_of_range.data @@ -0,0 +1,38 @@ +[handles]10 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]5 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method5_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[u4]10 // param1: It is outside of the valid encoded handle + // range [0, 10). +[u4]0 // padding +[anchr]method5_params + +[anchr]param0_ptr +[dist4]struct_e // num_bytes +[u4]0 // version +[dist8]struct_d_ptr // struct_d +[u4]3 // data_pipe_consumer +[u4]0 // padding +[anchr]struct_e + +[anchr]struct_d_ptr +[dist4]struct_d // num_bytes +[u4]0 // version +[dist8]message_pipes_ptr // message_pipes +[anchr]struct_d + +[anchr]message_pipes_ptr +[dist4]message_pipe_array // num_bytes +[u4]2 // num_elements +[u4]0 +[u4]1 +[anchr]message_pipe_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_handle_out_of_range.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_handle_out_of_range.expected new file mode 100644 index 0000000000..eef8e38a84 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_handle_out_of_range.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_1.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_1.data new file mode 100644 index 0000000000..9ee7a48c9c --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_1.data @@ -0,0 +1,37 @@ +[handles]10 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]5 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method5_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[u4]4 // param1 +[u4]0 // padding +[anchr]method5_params + +[anchr]param0_ptr +[dist4]struct_e // num_bytes +[u4]0 // version +[dist8]struct_d_ptr // struct_d +[u4]4 // data_pipe_consumer: The same value as |param1| above. +[u4]0 // padding +[anchr]struct_e + +[anchr]struct_d_ptr +[dist4]struct_d // num_bytes +[u4]0 // version +[dist8]message_pipes_ptr // message_pipes +[anchr]struct_d + +[anchr]message_pipes_ptr +[dist4]message_pipe_array // num_bytes +[u4]2 // num_elements +[u4]0 +[u4]1 +[anchr]message_pipe_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_1.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_1.expected new file mode 100644 index 0000000000..eef8e38a84 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_1.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_2.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_2.data new file mode 100644 index 0000000000..cb01caeb1a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_2.data @@ -0,0 +1,37 @@ +[handles]10 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]5 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method5_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[u4]4 // param1 +[u4]0 // padding +[anchr]method5_params + +[anchr]param0_ptr +[dist4]struct_e // num_bytes +[u4]0 // version +[dist8]struct_d_ptr // struct_d +[u4]3 // data_pipe_consumer +[u4]0 // padding +[anchr]struct_e + +[anchr]struct_d_ptr +[dist4]struct_d // num_bytes +[u4]0 // version +[dist8]message_pipes_ptr // message_pipes +[anchr]struct_d + +[anchr]message_pipes_ptr +[dist4]message_pipe_array // num_bytes +[u4]2 // num_elements +[u4]1 // The two message pipe handles have the same value. +[u4]1 +[anchr]message_pipe_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_2.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_2.expected new file mode 100644 index 0000000000..eef8e38a84 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_multiple_handles_with_same_value_2.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_unexpected_invalid_handle.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_unexpected_invalid_handle.data new file mode 100644 index 0000000000..b06ae0a46b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_unexpected_invalid_handle.data @@ -0,0 +1,36 @@ +[handles]5 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]5 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method5_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[u4]4 // param1 +[u4]0 // padding +[anchr]method5_params + +[anchr]param0_ptr +[dist4]struct_e // num_bytes +[u4]0 // version +[dist8]struct_d_ptr // struct_d +[s4]-1 // data_pipe_consumer: An unexpected invalid handle. +[u4]0 // padding +[anchr]struct_e + +[anchr]struct_d_ptr +[dist4]struct_d // num_bytes +[u4]0 // version +[dist8]message_pipes_ptr // message_pipes +[anchr]struct_d + +[anchr]message_pipes_ptr +[dist4]message_pipe_array // num_bytes +[u4]1 // num_elements +[u4]2 +[anchr]message_pipe_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_unexpected_invalid_handle.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_unexpected_invalid_handle.expected new file mode 100644 index 0000000000..6768236f6e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_unexpected_invalid_handle.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_wrong_handle_order.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_wrong_handle_order.data new file mode 100644 index 0000000000..f641de0561 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_wrong_handle_order.data @@ -0,0 +1,38 @@ +[handles]10 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]5 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method5_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[u4]9 // param1 +[u4]0 // padding +[anchr]method5_params + +[anchr]param0_ptr +[dist4]struct_e // num_bytes +[u4]0 // version +[dist8]struct_d_ptr // struct_d +[u4]1 // data_pipe_consumer: It is smaller than those handles + // in |message_pipe_array|, which is wrong. +[u4]0 // padding +[anchr]struct_e + +[anchr]struct_d_ptr +[dist4]struct_d // num_bytes +[u4]0 // version +[dist8]message_pipes_ptr // message_pipes +[anchr]struct_d + +[anchr]message_pipes_ptr +[dist4]message_pipe_array // num_bytes +[u4]2 // num_elements +[u4]3 +[u4]4 +[anchr]message_pipe_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_wrong_handle_order.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_wrong_handle_order.expected new file mode 100644 index 0000000000..eef8e38a84 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd5_wrong_handle_order.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_ILLEGAL_HANDLE diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_good.data new file mode 100644 index 0000000000..fb3f862f4c --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_good.data @@ -0,0 +1,24 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]6 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method6_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method6_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]1 // num_elements +[dist8]element_ptr +[anchr]array_param + +[anchr]element_ptr +[dist4]array_element // num_bytes +[u4]10 // num_elements +0 1 2 3 4 5 6 7 8 9 +[anchr]array_element diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_nested_array_num_bytes_less_than_necessary_size.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_nested_array_num_bytes_less_than_necessary_size.data new file mode 100644 index 0000000000..c8cacf0b2e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_nested_array_num_bytes_less_than_necessary_size.data @@ -0,0 +1,24 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]6 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method6_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method6_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]1 // num_elements +[dist8]element_ptr +[anchr]array_param + +[anchr]element_ptr +[dist4]array_element // num_bytes: It is insufficient to store 12 elements. +[u4]12 // num_elements +0 1 2 3 4 5 6 7 8 9 +[anchr]array_element diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_nested_array_num_bytes_less_than_necessary_size.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_nested_array_num_bytes_less_than_necessary_size.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd6_nested_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_mthd7_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_good.data new file mode 100644 index 0000000000..c9726763e1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_good.data @@ -0,0 +1,40 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]7 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method7_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method7_params + +[anchr]param0_ptr +[dist4]struct_f // num_bytes +[u4]0 // version +[dist8]array_ptr // fixed_size_array +[anchr]struct_f + +[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]2 // num_elements +[u8]0 // A null pointer, which is okay. +[dist8]array_element_ptr +[anchr]array_param + +[anchr]array_element_ptr +[dist4]array_element // num_bytes +[u4]3 // num_elements +0 1 2 +[anchr]array_element diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unexpected_null_fixed_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unexpected_null_fixed_array.data new file mode 100644 index 0000000000..4d25cf24a2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unexpected_null_fixed_array.data @@ -0,0 +1,26 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]7 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method7_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method7_params + +[anchr]param0_ptr +[dist4]struct_f // num_bytes +[u4]0 // version +[u8]0 // fixed_size_array: An unexpected null pointer. +[anchr]struct_f + +[anchr]param1_ptr +[dist4]array_param // num_bytes +[u4]2 // num_elements +[u8]0 // A null pointer, which is okay. +[u8]0 // A null pointer, which is okay. +[anchr]array_param diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unexpected_null_fixed_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unexpected_null_fixed_array.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unexpected_null_fixed_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements.data new file mode 100644 index 0000000000..cee6e1404f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements.data @@ -0,0 +1,34 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]7 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method7_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method7_params + +[anchr]param0_ptr +[dist4]struct_f // num_bytes +[u4]0 // version +[dist8]array_ptr // fixed_size_array +[anchr]struct_f + +[anchr]array_ptr +[dist4]array_member // num_bytes +[u4]2 // num_elements: Too few elements. +0 1 +[anchr]array_member + +[u4]0 [u1]0 [u1]0 // Padding for alignment of next array. + +[anchr]param1_ptr +[dist4]array_param // num_bytes +[u4]2 // num_elements +[u8]0 // A null pointer, which is okay. +[u8]0 // A null pointer, which is okay. +[anchr]array_param diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements_nested.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements_nested.data new file mode 100644 index 0000000000..3095a73893 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements_nested.data @@ -0,0 +1,40 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]7 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method7_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[dist8]param1_ptr // param1 +[anchr]method7_params + +[anchr]param0_ptr +[dist4]struct_f // num_bytes +[u4]0 // version +[dist8]array_ptr // fixed_size_array +[anchr]struct_f + +[anchr]array_ptr +[dist4]array_member // num_bytes +[u4]3 // num_elements +0 1 3 +[anchr]array_member + +[u4]0 [u1]0 // Padding for alignment of next array. + +[anchr]param1_ptr +[dist4]array_param // num_bytes +[u4]2 // num_elements +[dist8]array_element_ptr +[u8]0 // A null pointer, which is okay. +[anchr]array_param + +[anchr]array_element_ptr +[dist4]array_element // num_bytes +[u4]4 // num_elements: Too many elements. +0 1 2 3 +[anchr]array_element diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements_nested.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements_nested.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd7_unmatched_array_elements_nested.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_array_num_bytes_overflow.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_array_num_bytes_overflow.data new file mode 100644 index 0000000000..b19e141b0b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_array_num_bytes_overflow.data @@ -0,0 +1,21 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]8 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method8_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method8_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]0x20000001 // num_elements: The corresponding array size should be + // 0x20000001 * 8 + 8 = 0x100000010 which is + // 2^32 + 16 (base-10), while |num_bytes| is a 32-bit + // unsigned integer and its value is 16. +[u8]0 +[anchr]array_param diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_array_num_bytes_overflow.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_array_num_bytes_overflow.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_array_num_bytes_overflow.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_good.data new file mode 100644 index 0000000000..08c4bc3121 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_good.data @@ -0,0 +1,32 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]8 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method8_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method8_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]3 // num_elements +[u8]0 // A null pointer, which is okay. +[dist8]nested_array_ptr +[u8]0 // A null pointer, which is okay. +[anchr]array_param + +[anchr]nested_array_ptr +[dist4]nested_array // num_bytes +[u4]1 // num_elements +[dist8]string_ptr +[anchr]nested_array + +[anchr]string_ptr +[dist4]string // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]string diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_array.data new file mode 100644 index 0000000000..03f2a10cb5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_array.data @@ -0,0 +1,12 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]8 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method8_params // num_bytes +[u4]0 // version +[u8]0 // param0: An unexpected null pointer. +[anchr]method8_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_array.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_string.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_string.data new file mode 100644 index 0000000000..b1b4462051 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_string.data @@ -0,0 +1,33 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]8 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method8_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method8_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]3 // num_elements +[u8]0 // A null pointer, which is okay. +[dist8]nested_array_ptr +[u8]0 // A null pointer, which is okay. +[anchr]array_param + +[anchr]nested_array_ptr +[dist4]nested_array // num_bytes +[u4]2 // num_elements +[dist8]string_ptr +[u8]0 // An unexpected null pointer. +[anchr]nested_array + +[anchr]string_ptr +[dist4]string // num_bytes +[u4]5 // num_elements +0 1 2 3 4 +[anchr]string diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_string.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_string.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd8_unexpected_null_string.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good.data new file mode 100644 index 0000000000..6ed00092c6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good.data @@ -0,0 +1,36 @@ +[handles]4 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]9 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method9_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method9_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]2 // num_elements +[dist8]nested_array_ptr_0 +[dist8]nested_array_ptr_1 +[anchr]array_param + +[anchr]nested_array_ptr_0 +[dist4]nested_array_0 // num_bytes +[u4]2 // num_elements +[u4]0 +[s4]-1 // An invalid handle, which is okay. +[anchr]nested_array_0 + +[anchr]nested_array_ptr_1 +[dist4]nested_array_1 // num_bytes +[u4]3 // num_elements +[u4]2 +[s4]-1 // An invalid handle, which is okay. +[u4]3 +[anchr]nested_array_1 diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good_null_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good_null_array.data new file mode 100644 index 0000000000..90feced0b6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good_null_array.data @@ -0,0 +1,14 @@ +[handles]4 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]9 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method9_params // num_bytes +[u4]0 // version +[u8]0 // param0: A null pointer, which is okay. +[anchr]method9_params diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good_null_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good_null_array.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_good_null_array.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_unexpected_null_array.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_unexpected_null_array.data new file mode 100644 index 0000000000..e87fbcba31 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_unexpected_null_array.data @@ -0,0 +1,27 @@ +[handles]4 + +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]9 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method9_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method9_params + +[anchr]param0_ptr +[dist4]array_param // num_bytes +[u4]2 // num_elements +[dist8]nested_array_ptr_0 +[u8]0 // An unexpected null pointer. +[anchr]array_param + +[anchr]nested_array_ptr_0 +[dist4]nested_array_0 // num_bytes +[u4]1 // num_elements +[u4]0 +[anchr]nested_array_0 diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_unexpected_null_array.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_unexpected_null_array.expected new file mode 100644 index 0000000000..95d8db01bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd9_unexpected_null_array.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_NULL_POINTER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_good.data b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_good.data new file mode 100644 index 0000000000..7da356fc5e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_good.data @@ -0,0 +1,19 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0 // name +[u4]2 // flags kMessageIsResponse +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header + +[dist4]method0_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method0_params + +[anchr]param0_ptr +[dist4]uint8_array // num_bytes +[u4]1 // num_elements +[u1]0 +[anchr]uint8_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_unexpected_array_header.data b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_unexpected_array_header.data new file mode 100644 index 0000000000..bdcfc46853 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_unexpected_array_header.data @@ -0,0 +1,19 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0 // name +[u4]2 // flags kMessageIsResponse +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header + +[dist4]method0_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method0_params + +[anchr]param0_ptr +[dist4]uint8_array // num_bytes +[u4]2 // num_elements: The size is too small to hold 2 elements. +[u1]0 +[anchr]uint8_array diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_unexpected_array_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_unexpected_array_header.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_resp_mthd0_unexpected_array_header.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_good.data b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_good.data new file mode 100644 index 0000000000..a1fe69d82e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_good.data @@ -0,0 +1,20 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0 // name +[u4]1 // flags kMessageExpectsResponse +[u4]0 // padding +[u8]7 // request_id +[anchr]message_header + +[dist4]method0_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method0_params + +[anchr]param0_ptr +[dist4]basic_struct // num_bytes +[u4]0 // version +[s4]-1 // a +[u4]0 // padding +[anchr]basic_struct diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_good.expected b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_good.expected new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_good.expected @@ -0,0 +1 @@ +PASS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_unexpected_struct_header.data b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_unexpected_struct_header.data new file mode 100644 index 0000000000..e689adb670 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_unexpected_struct_header.data @@ -0,0 +1,17 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0 // name +[u4]1 // flags kMessageExpectsResponse +[u4]0 // padding +[u8]7 // request_id +[anchr]message_header + +[dist4]method0_params // num_bytes +[u4]0 // version +[dist8]param0_ptr // param0 +[anchr]method0_params + +[anchr]param0_ptr +[u4]0 // num_bytes: The struct size is too small. +[u4]0 // version diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_unexpected_struct_header.expected b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_unexpected_struct_header.expected new file mode 100644 index 0000000000..25aceeea5a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_intf_rqst_mthd0_unexpected_struct_header.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_msghdr_invalid_flags.data b/mojo/public/interfaces/bindings/tests/data/validation/integration_msghdr_invalid_flags.data new file mode 100644 index 0000000000..7198afa30e --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_msghdr_invalid_flags.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]0xffffffff // name +[u4]3 // flags: This combination is illegal. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/integration_msghdr_invalid_flags.expected b/mojo/public/interfaces/bindings/tests/data/validation/integration_msghdr_invalid_flags.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/integration_msghdr_invalid_flags.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_boundscheck_msghdr_no_such_method.data b/mojo/public/interfaces/bindings/tests/data/validation/resp_boundscheck_msghdr_no_such_method.data new file mode 100644 index 0000000000..72835098f7 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_boundscheck_msghdr_no_such_method.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]1 // name: Method1 does not have a response message. +[u4]2 // flags: kMessageIsResponse +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_boundscheck_msghdr_no_such_method.expected b/mojo/public/interfaces/bindings/tests/data/validation/resp_boundscheck_msghdr_no_such_method.expected new file mode 100644 index 0000000000..65a48b3c06 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_boundscheck_msghdr_no_such_method.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD
\ No newline at end of file diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags1.data b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags1.data new file mode 100644 index 0000000000..d1d8d3f157 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags1.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]12 // name +[u4]0 // flags: kMessageIsResponse is not set in a response. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags1.expected b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags1.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags1.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags2.data b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags2.data new file mode 100644 index 0000000000..091b68c235 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags2.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]12 // name +[u4]1 // flags: kMessageExpectsResponse is set in a response. +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags2.expected b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags2.expected new file mode 100644 index 0000000000..c33fde327b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_invalid_response_flags2.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_no_such_method.data b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_no_such_method.data new file mode 100644 index 0000000000..0eda287e32 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_no_such_method.data @@ -0,0 +1,8 @@ +[dist4]message_header // num_bytes +[u4]1 // version +[u4]0 // interface ID +[u4]11 // name: Method11 does not have a response message. +[u4]2 // flags: kMessageIsResponse +[u4]0 // padding +[u8]1 // request_id +[anchr]message_header diff --git a/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_no_such_method.expected b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_no_such_method.expected new file mode 100644 index 0000000000..65a48b3c06 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/resp_conformance_msghdr_no_such_method.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD
\ No newline at end of file diff --git a/mojo/public/interfaces/bindings/tests/echo.mojom b/mojo/public/interfaces/bindings/tests/echo.mojom new file mode 100644 index 0000000000..56c6063010 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/echo.mojom @@ -0,0 +1,12 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module test.echo.mojom; + +import "echo_import.mojom"; + +interface Echo { + EchoPoint(test.echo_import.mojom.Point point) + => (test.echo_import.mojom.Point result); +}; diff --git a/mojo/public/interfaces/bindings/tests/echo_import.mojom b/mojo/public/interfaces/bindings/tests/echo_import.mojom new file mode 100644 index 0000000000..a024ce2ff1 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/echo_import.mojom @@ -0,0 +1,10 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module test.echo_import.mojom; + +struct Point { + int32 x; + int32 y; +}; diff --git a/mojo/public/interfaces/bindings/tests/math_calculator.mojom b/mojo/public/interfaces/bindings/tests/math_calculator.mojom new file mode 100644 index 0000000000..7d1b171e1a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/math_calculator.mojom @@ -0,0 +1,12 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.math"] +module math; + +interface Calculator { + Clear@0() => (double value@0); + Add@1(double value@0) => (double value@0); + Multiply@2(double value@0) => (double value@0); +}; diff --git a/mojo/public/interfaces/bindings/tests/no_module.mojom b/mojo/public/interfaces/bindings/tests/no_module.mojom new file mode 100644 index 0000000000..f380011290 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/no_module.mojom @@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Entities without module + +enum EnumWithoutModule { + A +}; diff --git a/mojo/public/interfaces/bindings/tests/ping_service.mojom b/mojo/public/interfaces/bindings/tests/ping_service.mojom new file mode 100644 index 0000000000..ba6ad3d66a --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/ping_service.mojom @@ -0,0 +1,14 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.ping"] +module mojo.test; + +interface PingService { + Ping() => (); +}; + +interface EchoService { + Echo(string test_data) => (string echo_data); +}; diff --git a/mojo/public/interfaces/bindings/tests/rect.mojom b/mojo/public/interfaces/bindings/tests/rect.mojom new file mode 100644 index 0000000000..4ecc4d9660 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/rect.mojom @@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"] +module mojo.test; + +struct Rect { + int32 x; + int32 y; + int32 width; + int32 height; +}; + +// A copy of Rect that is typemapped differently in the chromium and blink +// variants. +struct TypemappedRect { + int32 x; + int32 y; + int32 width; + int32 height; +}; + +// A copy of Rect that is typemapped to the same custom type in the chromium and +// blink variants. +struct SharedTypemappedRect { + int32 x; + int32 y; + int32 width; + int32 height; +};
\ No newline at end of file diff --git a/mojo/public/interfaces/bindings/tests/regression_tests.mojom b/mojo/public/interfaces/bindings/tests/regression_tests.mojom new file mode 100644 index 0000000000..d87a3ad65f --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/regression_tests.mojom @@ -0,0 +1,76 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Module containing entities for regression tests of the generator. Entities +// must never be modified, instead new entity must be added to add new tests. +[JavaPackage="org.chromium.mojo.bindings.test.mojom.regression_tests"] +module regression_tests; + +interface CheckMethodWithEmptyResponse { +WithouParameterAndEmptyResponse() => (); +WithParameterAndEmptyResponse(bool b) => (); +}; + +interface CheckNameCollision { +WithNameCollision(bool message, bool response) => (bool message, bool response); +}; + +enum EnumWithReference { + k_STEREO_AND_KEYBOARD_MIC = 30, + k_MAX = k_STEREO_AND_KEYBOARD_MIC +}; + +enum EnumWithLowercase { + PlanarF16, + PlanarF32 +}; + +enum EnumWithNumbers { + k_2_1 = 4 +}; + +enum EnumWithK { + K = 0 +}; + +struct Edge { + Vertex? v; +}; + +struct Vertex { + EmptyStruct? e; +}; + +struct EmptyStruct { +}; + +struct A { + B? b; +}; + +struct B { + A? a; +}; + +// Previously, a field or parameter called |handles| would be shadowed by a +// method parameter in generated C++ bindings code. +struct HandlesNameCollisionStruct { + EmptyStruct handles; +}; + +struct HandlesHandleNameCollisionStruct { + handle handles; +}; + +union HandlesNameCollisionUnion { + int32 handles; +}; + +struct HandlesUnionNameCollisionStruct { + HandlesNameCollisionUnion handles; +}; + +interface HandlesNameCollisionInterface { + Method(EmptyStruct handles) => (handle handles); +}; diff --git a/mojo/public/interfaces/bindings/tests/sample_factory.mojom b/mojo/public/interfaces/bindings/tests/sample_factory.mojom new file mode 100644 index 0000000000..ade3bf37d6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/sample_factory.mojom @@ -0,0 +1,41 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] +module sample; + +import "sample_import.mojom"; + +// This sample shows how handles to MessagePipes can be sent as both parameters +// to methods as well as fields on structs. + +struct Request { + int32 x; + handle<message_pipe>? pipe; + array<handle<message_pipe>>? more_pipes; + + // Interfaces can be used as members. + imported.ImportedInterface? obj; +}; + +struct Response { + int32 x; + handle<message_pipe>? pipe; +}; + +interface NamedObject { + SetName(string name); + GetName() => (string name); +}; + +interface Factory { + DoStuff(Request request, handle<message_pipe>? pipe) => + (Response response, string text); + DoStuff2(handle<data_pipe_consumer> pipe) => (string text); + CreateNamedObject(NamedObject& obj); + RequestImportedInterface( + imported.ImportedInterface& obj) => (imported.ImportedInterface& obj); + TakeImportedInterface( + imported.ImportedInterface obj) => (imported.ImportedInterface obj); +}; diff --git a/mojo/public/interfaces/bindings/tests/sample_import.mojom b/mojo/public/interfaces/bindings/tests/sample_import.mojom new file mode 100644 index 0000000000..d28cb7b4db --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/sample_import.mojom @@ -0,0 +1,38 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.imported"] +module imported; + +// This sample just defines some types that are imported into +// sample_service.mojom, to show how import works. + +enum Shape { + RECTANGLE = 1, + CIRCLE, + TRIANGLE, + LAST = TRIANGLE, +}; + +// These enum values should not interfere with those of Shape above. +enum AnotherShape { + RECTANGLE = 10, + CIRCLE, + TRIANGLE, +}; + +enum YetAnotherShape { + RECTANGLE = 20, + CIRCLE, + TRIANGLE, +}; + +struct Point { + int32 x; + int32 y; +}; + +interface ImportedInterface { + DoSomething(); +}; diff --git a/mojo/public/interfaces/bindings/tests/sample_import2.mojom b/mojo/public/interfaces/bindings/tests/sample_import2.mojom new file mode 100644 index 0000000000..ca4e81c0bb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/sample_import2.mojom @@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.imported"] +module imported; + +import "sample_import.mojom"; + +// This sample adds more types and constants to the "imported" namespace, +// to test a bug with importing multiple modules with the same namespace. + +enum Color { + RED, + BLACK, +}; + +struct Size { + int32 width; + int32 height; +}; + +struct Thing { + imported.Shape shape = RECTANGLE; + imported.Color color = Color.BLACK; + Point location; + Size size; +}; diff --git a/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom b/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom new file mode 100644 index 0000000000..5960d75665 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom @@ -0,0 +1,32 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.sample", + JavaConstantsClassName="InterfaceConstants", + Foo = "hello world"] +module sample; + +const uint64 kLong = 4405; + +enum Enum { + VALUE +}; + +interface PingTest { + Ping() => (); +}; + +interface Provider { + EchoString(string a) => (string a); + EchoStrings(string a, string b) => (string a, string b); + EchoMessagePipeHandle(handle<message_pipe> a) => (handle<message_pipe> a); + EchoEnum(Enum a) => (Enum a); + EchoInt(int32 a) => (int32 a); +}; + +interface IntegerAccessor { + GetInteger() => (int64 data, [MinVersion=2] Enum type); + [MinVersion=1] + SetInteger(int64 data, [MinVersion=3] Enum type); +}; diff --git a/mojo/public/interfaces/bindings/tests/sample_service.mojom b/mojo/public/interfaces/bindings/tests/sample_service.mojom new file mode 100644 index 0000000000..761cb91a9b --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/sample_service.mojom @@ -0,0 +1,112 @@ + +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] +module sample; + +import "sample_import.mojom"; +import "sample_import2.mojom"; + +const uint8 kTwelve = 12; + +struct Bar { + enum Type { + VERTICAL = 1, + HORIZONTAL, + BOTH, + INVALID + }; + uint8 alpha@0 = 0xff; + uint8 beta@1; + uint8 gamma@2; + Type type@3 = sample.Bar.Type.VERTICAL; +}; + +struct Foo { + const string kFooby = "Fooby"; + string name@8 = kFooby; + int32 x@0; + int32 y@1; + bool a@2 = true; + bool b@3; + bool c@4; + Bar? bar@5; + array<Bar>? extra_bars@7; + array<uint8>? data@6; + handle<message_pipe>? source@9; + array<handle<data_pipe_consumer>>? input_streams@10; + array<handle<data_pipe_producer>>? output_streams@11; + array<array<bool>>? array_of_array_of_bools@12; + array<array<array<string>>>? multi_array_of_strings@13; + array<bool>? array_of_bools@14; +}; + +struct DefaultsTest { + int8 a0@0 = -12; + uint8 a1@1 = sample.kTwelve; + int16 a2@2 = 1234; + uint16 a3@3 = 34567; + int32 a4@4 = 123456; + uint32 a5@5 = 3456789012; + int64 a6@6 = -111111111111; + uint64 a7@7 = 9999999999999999999; + int32 a8@8 = 0x12345; + int32 a9@9 = -0x12345; + int32 a10@10 = +1234; + bool a11@11 = true; + bool a12@12 = false; + float a13@13 = 123.25; + double a14@14 = 1234567890.123; + double a15@15 = 1E10; + double a16@16 = -1.2E+20; + double a17@17 = +1.23E-20; + + // TODO(vtl): Add tests for default vs null when those are implemented (for + // structs, arrays, and strings). + array<uint8> a18@18; + string a19@19; + + Bar.Type a20@20 = BOTH; + imported.Point a21@21; + imported.Thing a22@22 = default; + + uint64 a23@23 = 0xFFFFFFFFFFFFFFFF; + int64 a24@24 = 0x123456789; + int64 a25@25 = -0x123456789; + + double a26@26 = double.INFINITY; + double a27@27 = double.NEGATIVE_INFINITY; + double a28@28 = double.NAN; + float a29@29 = float.INFINITY; + float a30@30 = float.NEGATIVE_INFINITY; + float a31@31 = float.NAN; +}; + +struct StructWithHoleV1 { + int32 v1 = 1; + int64 v2 = 2; +}; + +struct StructWithHoleV2 { + int32 v1 = 1; + int64 v2 = 2; + int32 v3 = 3; +}; + +interface Service { + enum BazOptions { + REGULAR = 0, + EXTRA + }; + const uint8 kFavoriteBaz = 1; + Frobinate@0(Foo? foo@0, BazOptions baz@1, Port? port@2) => (int32 result@0); + GetPort@1(Port& port @0); +}; + +// This interface is referenced above where it is defined. It also refers to +// itself from a method. +interface Port { + PostMessageToPort@0(string message_text@0, Port port@1); +}; diff --git a/mojo/public/interfaces/bindings/tests/scoping.mojom b/mojo/public/interfaces/bindings/tests/scoping.mojom new file mode 100644 index 0000000000..2e9edb10b4 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/scoping.mojom @@ -0,0 +1,17 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +interface A { + GetB(B& b); +}; + +interface B { + GetC(C& c); +}; + +interface C { + D(); +}; diff --git a/mojo/public/interfaces/bindings/tests/serialization_test_structs.mojom b/mojo/public/interfaces/bindings/tests/serialization_test_structs.mojom new file mode 100644 index 0000000000..1239e163cb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/serialization_test_structs.mojom @@ -0,0 +1,36 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.mojo"] +module mojo.test; + +struct Struct1 { + uint8 i; +}; + +struct Struct2 { + handle hdl; +}; + +struct Struct3 { + Struct1 struct_1; +}; + +struct Struct4 { + array<Struct1> data; +}; + +struct Struct5 { + array<Struct1, 2> pair; +}; + +struct Struct6 { + string str; +}; + +struct StructOfNullables { + handle? hdl; + Struct1? struct_1; + string? str; +}; diff --git a/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom b/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom new file mode 100644 index 0000000000..b50409ee88 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom @@ -0,0 +1,83 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +// TODO(yzshen): Rename *WithTraits* types to something more readable. + +struct NestedStructWithTraits { + int32 value; +}; + +enum EnumWithTraits { + VALUE_0, + VALUE_1 +}; + +struct StructWithTraits { + EnumWithTraits f_enum; + bool f_bool; + uint32 f_uint32; + uint64 f_uint64; + string f_string; + string f_string2; + array<string> f_string_array; + array<string> f_string_set; + NestedStructWithTraits f_struct; + array<NestedStructWithTraits> f_struct_array; + map<string, NestedStructWithTraits> f_struct_map; +}; + +// Test that this container can be cloned. +struct StructWithTraitsContainer { + StructWithTraits f_struct; +}; + +// Maps to a pass-by-value trivial struct. +struct TrivialStructWithTraits { + int32 value; +}; + +// Maps to a move-only struct. +struct MoveOnlyStructWithTraits { + handle f_handle; +}; + +// The custom type for MoveOnlyStructWithTraits is not clonable. Test that +// this container can compile as long as Clone() is not used. +struct MoveOnlyStructWithTraitsContainer { + MoveOnlyStructWithTraits f_struct; +}; + +struct StructWithTraitsForUniquePtr { + int32 f_int32; +}; + +union UnionWithTraits { + int32 f_int32; + NestedStructWithTraits f_struct; +}; + +interface TraitsTestService { + EchoStructWithTraits(StructWithTraits s) => (StructWithTraits passed); + + EchoTrivialStructWithTraits(TrivialStructWithTraits s) => + (TrivialStructWithTraits passed); + + EchoMoveOnlyStructWithTraits(MoveOnlyStructWithTraits s) => + (MoveOnlyStructWithTraits passed); + + EchoNullableMoveOnlyStructWithTraits(MoveOnlyStructWithTraits? s) => + (MoveOnlyStructWithTraits? passed); + + EchoEnumWithTraits(EnumWithTraits e) => (EnumWithTraits passed); + + EchoStructWithTraitsForUniquePtr(StructWithTraitsForUniquePtr e) => ( + StructWithTraitsForUniquePtr passed); + + EchoNullableStructWithTraitsForUniquePtr(StructWithTraitsForUniquePtr? e) => ( + StructWithTraitsForUniquePtr? passed); + + EchoUnionWithTraits(UnionWithTraits u) => (UnionWithTraits passed); +}; diff --git a/mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom b/mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom new file mode 100644 index 0000000000..adc4e7e809 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom @@ -0,0 +1,54 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +import "mojo/public/interfaces/bindings/tests/ping_service.mojom"; + +interface FooInterface {}; + +struct StructContainsAssociated { + associated FooInterface? foo_interface; + associated FooInterface& foo_request; + array<associated FooInterface> foo_interfaces; + array<associated FooInterface&> foo_requests; +}; + +union UnionContainsAssociated { + associated FooInterface foo_interface; + associated FooInterface& foo_request; + array<associated FooInterface> foo_interfaces; + array<associated FooInterface&> foo_requests; +}; + +interface InterfacePassesAssociated { + PassFoo(associated FooInterface foo_interface, + associated FooInterface& foo_request) => + (associated FooInterface foo_interface, + associated FooInterface& foo_request); + + PassStruct(StructContainsAssociated foo_struct) => + (StructContainsAssociated foo_struct); + + PassUnion(UnionContainsAssociated foo_union) => + (UnionContainsAssociated foo_union); +}; + +interface IntegerSender { + Echo(int32 value) => (int32 value); + Send(int32 value); +}; + +interface IntegerSenderConnection { + GetSender(associated IntegerSender& sender); + AsyncGetSender() => (associated IntegerSender sender); +}; + +interface AssociatedPingProvider { + GetPing(associated PingService& request); +}; + +interface AssociatedPingProviderProvider { + GetPingProvider(associated AssociatedPingProvider& request); +}; diff --git a/mojo/public/interfaces/bindings/tests/test_bad_messages.mojom b/mojo/public/interfaces/bindings/tests/test_bad_messages.mojom new file mode 100644 index 0000000000..dcd594754d --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_bad_messages.mojom @@ -0,0 +1,13 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +interface TestBadMessages { + RejectEventually() => (); + RequestResponse() => (); + + [Sync] RejectSync() => (); + [Sync] RequestResponseSync() => (); +}; diff --git a/mojo/public/interfaces/bindings/tests/test_constants.mojom b/mojo/public/interfaces/bindings/tests/test_constants.mojom new file mode 100644 index 0000000000..272e6035a6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_constants.mojom @@ -0,0 +1,57 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.test_constants"] +module mojo.test; + +// Integral types. +const bool kBoolValue = true; + +const int8 kInt8Value = -2; + +// In the range of (MAX_INT8, MAX_UINT8]. +const uint8 kUint8Value = 128; + +// In the range of [MIN_INT16, MIN_INT8). +const int16 kInt16Value = -233; + +// In the range of (MAX_INT16, MAX_UINT16]. +const uint16 kUint16Value = 44204; + +// In the range of [MIN_INT32, MIN_INT16). +const int32 kInt32Value = -44204; + +// In the range of (MAX_INT32, MAX_UINT32]. +const uint32 kUint32Value = 4294967295; + +// In the range of [MIN_INT64, MIN_INT32). +const int64 kInt64Value = -9223372036854775807; + +// In the range of (MAX_INT64, MAX_UINT64]. +const uint64 kUint64Value = 9999999999999999999; + +// Floating point types. +const double kDoubleValue = 3.14159; +const double kDoubleInfinity = double.INFINITY; +const double kDoubleNegativeInfinity = double.NEGATIVE_INFINITY; +const double kDoubleNaN = double.NAN; + +const float kFloatValue = 2.71828; +const float kFloatInfinity = float.INFINITY; +const float kFloatNegativeInfinity = float.NEGATIVE_INFINITY; +const float kFloatNaN = float.NAN; + +const string kStringValue = "test string contents"; + +struct StructWithConstants { + const int8 kInt8Value = 5; + const float kFloatValue = 765.432; + const string kStringValue = "struct test string contents"; +}; + +interface InterfaceWithConstants { + const uint32 kUint32Value = 20100722; + const double kDoubleValue = 12.34567; + const string kStringValue = "interface test string contents"; +}; diff --git a/mojo/public/interfaces/bindings/tests/test_data_view.mojom b/mojo/public/interfaces/bindings/tests/test_data_view.mojom new file mode 100644 index 0000000000..1fe8c6a8e2 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_data_view.mojom @@ -0,0 +1,41 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test.data_view; + +enum TestEnum { + VALUE_0, + VALUE_1 +}; + +interface TestInterface { + [Sync] + Echo(int32 value) => (int32 out_value); +}; + +struct NestedStruct { + int32 f_int32; +}; + +[Native] +struct TestNativeStruct; + +union TestUnion { + bool f_bool; + int32 f_int32; +}; + +struct TestStruct { + string f_string; + NestedStruct? f_struct; + TestNativeStruct? f_native_struct; + array<bool> f_bool_array; + array<int32> f_int32_array; + array<TestEnum> f_enum_array; + array<TestInterface> f_interface_array; + array<array<int32>> f_nested_array; + array<NestedStruct> f_struct_array; + array<TestUnion> f_union_array; + map<string, int32> f_map; +}; diff --git a/mojo/public/interfaces/bindings/tests/test_export.mojom b/mojo/public/interfaces/bindings/tests/test_export.mojom new file mode 100644 index 0000000000..319a15b036 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_export.mojom @@ -0,0 +1,20 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test.test_export; + +struct StringPair { + string s1; + string s2; +}; + +// This is a regression test. On Windows, if we export the generated class *and* +// not explicitly disallow copy constructor and assign operator, compilation +// will fail because it tries to use copy constructor of +// InlinedStructPtr<StringPair>. +struct StringPairContainer { + array<StringPair> pairs; +}; + +interface ExportedInterface {}; diff --git a/mojo/public/interfaces/bindings/tests/test_export2.mojom b/mojo/public/interfaces/bindings/tests/test_export2.mojom new file mode 100644 index 0000000000..011395cccb --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_export2.mojom @@ -0,0 +1,10 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test.test_export2; + +struct StringPair { + string s1; + string s2; +}; diff --git a/mojo/public/interfaces/bindings/tests/test_import.mojom b/mojo/public/interfaces/bindings/tests/test_import.mojom new file mode 100644 index 0000000000..42014c6809 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_import.mojom @@ -0,0 +1,11 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test.test_import; + +import "mojo/public/interfaces/bindings/tests/test_export.mojom"; + +struct ImportingStruct { + mojo.test.test_export.StringPair strings; +}; diff --git a/mojo/public/interfaces/bindings/tests/test_native_types.mojom b/mojo/public/interfaces/bindings/tests/test_native_types.mojom new file mode 100644 index 0000000000..3df43182a3 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_native_types.mojom @@ -0,0 +1,38 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +import "mojo/public/interfaces/bindings/tests/rect.mojom"; + +// Used to verify that structs can be declared with no body in mojom. + +[Native] +struct PickledStruct; + +[Native] +enum PickledEnum; + +struct PickleContainer { + PickledStruct f_struct; + PickledEnum f_enum; +}; + +interface PicklePasser { + PassPickledStruct(PickledStruct pickle) => (PickledStruct passed); + PassPickledEnum(PickledEnum pickle) => (PickledEnum passed); + PassPickleContainer(PickleContainer container) => (PickleContainer passed); + PassPickles(array<PickledStruct> pickles) => (array<PickledStruct> passed); + PassPickleArrays(array<array<PickledStruct>> pickle_arrays) + => (array<array<PickledStruct>> passed); +}; + +// Used to verify support for native serialization of mojom-defined structs +// using StrucTraits with different variants of the Rect type from rect.mojom. + +interface RectService { + AddRect(TypemappedRect r); + GetLargestRect() => (TypemappedRect largest); + PassSharedRect(SharedTypemappedRect r) => (SharedTypemappedRect passed); +}; diff --git a/mojo/public/interfaces/bindings/tests/test_structs.mojom b/mojo/public/interfaces/bindings/tests/test_structs.mojom new file mode 100644 index 0000000000..03a0a20581 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_structs.mojom @@ -0,0 +1,414 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"] +module mojo.test; + +import "mojo/public/interfaces/bindings/tests/rect.mojom"; + +struct NamedRegion { + string? name; + array<Rect>? rects; +}; + +struct RectPair { + Rect? first; + Rect? second; +}; + +struct EmptyStruct { +}; + +[Native] +struct UnmappedNativeStruct; + +// Used to verify that struct fields which don't specify a default are +// initialized to: false for bool, 0 for numbers, and null for strings, +// handles, and structs. The "?" nullable suffix shouldn't have any +// impact on initial field values. + +struct NoDefaultFieldValues { + bool f0; + int8 f1; + uint8 f2; + int16 f3; + uint16 f4; + int32 f5; + uint32 f6; + int64 f7; + uint64 f8; + float f9; + double f10; + string f11; + string? f12; + handle<message_pipe> f13; + handle<data_pipe_consumer> f14; + handle<data_pipe_producer> f15; + handle<message_pipe>? f16; + handle<data_pipe_consumer>? f17; + handle<data_pipe_producer>? f18; + handle f19; + handle? f20; + handle<shared_buffer> f21; + handle<shared_buffer>? f22; + array<string> f23; + array<string?> f24; + array<string>? f25; + array<string?>? f26; + EmptyStruct f27; + EmptyStruct? f28; +}; + +// Used to verify that struct fields with an explicit default value +// are initialized correctly. The "?" nullable suffix shouldn't have any +// impact on initial field values. + +struct DefaultFieldValues { + const string kFoo = "foo"; + bool f0 = true; + int8 f1 = 100; + uint8 f2 = 100; + int16 f3 = 100; + uint16 f4 = 100; + int32 f5 = 100; + uint32 f6 = 100; + int64 f7 = 100; + uint64 f8 = 100; + float f9 = 100; + float f10 = 100.0; + double f11 = 100; + double f12 = 100.0; + string f13 = kFoo; + string? f14 = kFoo; + Rect f15 = default; + Rect? f16 = default; +}; + +// Used to verify that the code generated for enum and const values defined +// within a struct is correct. Assuming that a constant's value can be a literal +// or another constant and that enum values can either be an integer constant or +// another value from the same enum type. + +struct ScopedConstants { + const int32 TEN = 10; + const int32 ALSO_TEN = TEN; + enum EType { + E0, + E1, + E2 = 10, + E3 = E2, + E4, + }; + EType f0 = E0; // 0 + EType f1 = E1; // 1 + EType f2 = E2; // 10 + EType f3 = E3; // 10 + EType f4 = E4; // 11 + int32 f5 = TEN; + int32 f6 = ALSO_TEN; +}; + +// Used to verify that all possible Map key field types can be encoded and +// decoded successfully. + +struct MapKeyTypes { + // TODO(yzshen): WTF::HashMap doesn't support bool as key. + // map<bool, bool> f0; + map<int8, int8> f1; + map<uint8, uint8> f2; + map<int16, int16> f3; + map<uint16, uint16> f4; + map<int32, int32> f5; + map<uint32, uint32> f6; + map<int64, int64> f7; + map<uint64, uint64> f8; + map<float, float> f9; + map<double, double> f10; + map<string, string> f11; + // TODO(tibell): JS/Java don't support struct as key. + // map<Rect, Rect> f12; +}; + +// Used to verify that various map value types can be encoded and decoded +// successfully. + +struct MapValueTypes { + map<string, array<string>> f0; + map<string, array<string>?> f1; + map<string, array<string?>> f2; + map<string, array<string, 2>> f3; + map<string, array<array<string, 2>?>> f4; + map<string, array<array<string, 2>, 1>> f5; + map<string, Rect?> f6; + map<string, map<string, string>> f7; + map<string, array<map<string, string>>> f8; + map<string, handle> f9; + map<string, array<handle>> f10; + map<string, map<string, handle>> f11; +}; + +// Used to verify that various array types can be encoded and decoded +// successfully. + +struct ArrayValueTypes { + array<int8> f0; + array<int16> f1; + array<int32> f2; + array<int64> f3; + array<float> f4; + array<double> f5; + array<SomeInterface> f6; + array<SomeInterface&> f7; +}; + +// Used to verify that various float and double values can be encoded and +// decoded correctly. + +struct FloatNumberValues { + const double V0 = double.INFINITY; + const double V1 = double.NEGATIVE_INFINITY; + const double V2 = double.NAN; + const float V3 = float.INFINITY; + const float V4 = float.NEGATIVE_INFINITY; + const float V5 = float.NAN; + const float V6 = 0; + const double V7 = 1234567890.123; + const double V8 = 1.2E+20; + const double V9 = -1.2E+20; + + double f0 = V0; + double f1 = V1; + double f2 = V2; + float f3 = V3; + float f4 = V4; + float f5 = V5; + float f6 = V6; + double f7 = V7; + double f8 = V8; + double f9 = V9; +}; + +// Used to verify that various signed integer values can be encoded and +// decoded correctly. + +struct IntegerNumberValues { + const int8 V0 = -128; // Minimum + const int8 V1 = -1; // -1 + const int8 V2 = 0; // 0 + const int8 V3 = 42; // An arbitrary valid value. + const int8 V4 = 127; // Maximum + + const int16 V5 = -32768; // ... + const int16 V6 = -1; + const int16 V7 = 0; + const int16 V8 = 12345; + const int16 V9 = 32767; + + const int32 V10 = -2147483648; + const int32 V11 = -1; + const int32 V12 = 0; + const int32 V13 = 1234567890; + const int32 V14 = 2147483647; + + // The limits for JavaScript integers are +/- (2^53 - 1). + const int64 V15 = -9007199254740991; // Number.MIN_SAFE_INTEGER + const int64 V16 = -1; + const int64 V17 = 0; + const int64 V18 = 1234567890123456; + const int64 V19 = 9007199254740991; // Number.MAX_SAFE_INTEGER + + int8 f0 = V0; + int8 f1 = V1; + int8 f2 = V2; + int8 f3 = V3; + int8 f4 = V4; + + int16 f5 = V5; + int16 f6 = V6; + int16 f7 = V7; + int16 f8 = V8; + int16 f9 = V9; + + int32 f10 = V10; + int32 f11 = V11; + int32 f12 = V12; + int32 f13 = V13; + int32 f14 = V14; + + int64 f15 = V15; + int64 f16 = V16; + int64 f17 = V17; + int64 f18 = V18; + int64 f19 = V19; +}; + +// Used to verify that various unsigned integer values can be encoded and +// decoded correctly. + +struct UnsignedNumberValues { + const uint8 V0 = 0; // Minimum = 0. + const uint8 V1 = 42; // An arbitrary valid value. + const uint8 V2 = 0xFF; // Maximum + + const uint16 V3 = 0; // ... + const uint16 V4 = 12345; + const uint16 V5 = 0xFFFF; + + const uint32 V6 = 0; + const uint32 V7 = 1234567890; + const uint32 V8 = 0xFFFFFFFF; + + // The limits for JavaScript integers are +/- (2^53 - 1). + const uint64 V9 = 0; + const uint64 V10 = 1234567890123456; + const uint64 V11 = 9007199254740991; // Number.MAX_SAFE_INTEGER + + uint8 f0 = V0; + uint8 f1 = V1; + uint8 f2 = V2; + + uint16 f3 = V3; + uint16 f4 = V4; + uint16 f5 = V5; + + uint32 f6 = V6; + uint32 f7 = V7; + uint32 f8 = V8; + + uint64 f9 = V9; + uint64 f10 = V10; + uint64 f11 = V11; +}; + +// Used to verify that various (packed) boolean array values can be encoded +// and decoded correctly. + +struct BitArrayValues { + array<bool, 1> f0; + array<bool, 7> f1; + array<bool, 9> f2; + array<bool> f3; + array<array<bool>> f4; + array<array<bool>?> f5; + array<array<bool, 2>?> f6; +}; + +// Used to verify that different versions can be decoded correctly. + +struct MultiVersionStruct { + [MinVersion=0] + int32 f_int32; + [MinVersion=1] + Rect? f_rect; + [MinVersion=3] + string? f_string; + [MinVersion=5] + array<int8>? f_array; + [MinVersion=7] + handle<message_pipe>? f_message_pipe; + [MinVersion=7] + bool f_bool; + [MinVersion=9] + int16 f_int16; +}; + +struct MultiVersionStructV0 { + [MinVersion=0] + int32 f_int32; +}; + +struct MultiVersionStructV1 { + [MinVersion=0] + int32 f_int32; + [MinVersion=1] + Rect? f_rect; +}; + +struct MultiVersionStructV3 { + [MinVersion=0] + int32 f_int32; + [MinVersion=1] + Rect? f_rect; + [MinVersion=3] + string? f_string; +}; + +struct MultiVersionStructV5 { + [MinVersion=0] + int32 f_int32; + [MinVersion=1] + Rect? f_rect; + [MinVersion=3] + string? f_string; + [MinVersion=5] + array<int8>? f_array; +}; + +struct MultiVersionStructV7 { + [MinVersion=0] + int32 f_int32; + [MinVersion=1] + Rect? f_rect; + [MinVersion=3] + string? f_string; + [MinVersion=5] + array<int8>? f_array; + [MinVersion=7] + handle<message_pipe>? f_message_pipe; + [MinVersion=7] + bool f_bool; +}; + +// A struct where the fields are not sorted by their ordinals. +struct ReorderedStruct { + [MinVersion=2] + int32 a@3 = 3; + [MinVersion=4] + int32 b@6 = 6; + [MinVersion=1] + int32 c@1 = 1; +}; + +// Used to verify that interfaces that are struct members can be defined in the +// same file. + +interface SomeInterface { + SomeMethod(RectPair pair) => (RectPair other_pair); +}; + +struct ContainsInterface { + SomeInterface some_interface; +}; + +// Verify that a field can be called |other|. + +struct ContainsOther { + int32 other; +}; + +// Used to verify that structs can contain interface requests. + +struct ContainsInterfaceRequest { + SomeInterface& request; +}; + +// Used to verify that boolean fields are correctly serialized/deserialized. + +struct SingleBoolStruct { + bool value; +}; + +// Used to verify that structs containing typemapped types can be hashed (if the +// typemapped type itself is hashable). + +struct ContainsHashable { + TypemappedRect rect; +}; + +// Used to test that nested structs can be hashed. The nested struct mustn't be +// nullable. + +struct SimpleNestedStruct { + ContainsOther nested; +}; diff --git a/mojo/public/interfaces/bindings/tests/test_sync_methods.mojom b/mojo/public/interfaces/bindings/tests/test_sync_methods.mojom new file mode 100644 index 0000000000..3b8cfe6388 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_sync_methods.mojom @@ -0,0 +1,44 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +interface TestSyncCodeGeneration { + [Sync] + NoInput() => (int32 result); + + [Sync] + NoOutput(int32 value) => (); + + [Sync] + NoInOut() => (); + + [Sync] + HaveInOut(int32 value1, int32 value2) => (int32 result1, int32 result2); +}; + +interface TestSync { + [Sync] + Ping() => (); + + [Sync] + Echo(int32 value) => (int32 result); + + AsyncEcho(int32 value) => (int32 result); +}; + +// Test sync method support with associated interfaces. +interface TestSyncMaster { + [Sync] + Ping() => (); + + [Sync] + Echo(int32 value) => (int32 result); + + AsyncEcho(int32 value) => (int32 result); + + SendInterface(associated TestSync ptr); + + SendRequest(associated TestSync& request); +}; diff --git a/mojo/public/interfaces/bindings/tests/test_unions.mojom b/mojo/public/interfaces/bindings/tests/test_unions.mojom new file mode 100644 index 0000000000..41e1ed6ace --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_unions.mojom @@ -0,0 +1,105 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +enum AnEnum { + FIRST, SECOND +}; + +[Extensible] +enum AnExtensibleEnum { + FIRST, SECOND, THIRD +}; + +union PodUnion { + int8 f_int8; + int8 f_int8_other; + uint8 f_uint8; + int16 f_int16; + uint16 f_uint16; + int32 f_int32; + uint32 f_uint32; + int64 f_int64; + uint64 f_uint64; + float f_float; + double f_double; + bool f_bool; + AnEnum f_enum; + AnExtensibleEnum f_extensible_enum; +}; + +union ObjectUnion { + int8 f_int8; + string f_string; + DummyStruct f_dummy; + DummyStruct? f_nullable; + array<int8> f_array_int8; + map<string, int8> f_map_int8; + PodUnion f_pod_union; + // Test that Clone() is defined after SmallStruct is declared. + array<SmallStruct> f_small_structs; +}; + +union HandleUnion { + handle f_handle; + handle<message_pipe> f_message_pipe; + handle<data_pipe_consumer> f_data_pipe_consumer; + handle<data_pipe_producer> f_data_pipe_producer; + handle<shared_buffer> f_shared_buffer; + SmallCache f_small_cache; + SmallCache& f_small_cache_request; +}; + +struct WrapperStruct { + ObjectUnion? object_union; + PodUnion? pod_union; + HandleUnion? handle_union; +}; + +struct DummyStruct { + int8 f_int8; +}; + +struct SmallStruct { + DummyStruct? dummy_struct; + PodUnion? pod_union; + array<PodUnion>? pod_union_array; + array<PodUnion?>? nullable_pod_union_array; + array<DummyStruct>? s_array; + map<string, PodUnion>? pod_union_map; + map<string, PodUnion?>? nullable_pod_union_map; +}; + +struct SmallStructNonNullableUnion { + PodUnion pod_union; +}; + +struct SmallObjStruct { + ObjectUnion obj_union; + int8 f_int8; +}; + +interface SmallCache { + SetIntValue(int64 int_value); + GetIntValue() => (int64 int_value); +}; + +interface UnionInterface { + Echo(PodUnion in_val) => (PodUnion out_val); +}; + +struct TryNonNullStruct { + DummyStruct? nullable; + DummyStruct non_nullable; +}; + +union OldUnion { + int8 f_int8; +}; + +union NewUnion { + int8 f_int8; + int16 f_int16; +}; diff --git a/mojo/public/interfaces/bindings/tests/test_wtf_types.mojom b/mojo/public/interfaces/bindings/tests/test_wtf_types.mojom new file mode 100644 index 0000000000..183f184ef3 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/test_wtf_types.mojom @@ -0,0 +1,50 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +struct TestWTFCodeGeneration { + string str; + string? nullable_str; + array<string> strs; + array<string?> nullable_strs; + array<array<int32>> arrays; + array<bool> bools; + array<handle<message_pipe>> handles; + map<string, string?> str_map; + map<int32, array<int32>> array_map; + map<int32, handle<message_pipe>> handle_map; + array<map<string, string?>> str_maps; +}; + +union TestWTFCodeGeneration2 { + string str; + array<string> strs; + map<string, string?> str_map; +}; + +struct TestWTFStruct { + enum NestedEnum { + E0, + E1, + }; + string str; + int32 integer; +}; + +interface TestWTF { + enum NestedEnum { + E0, + E1, + }; + EchoString(string? str) => (string? str); + EchoStringArray(array<string?>? arr) => (array<string?>? arr); + EchoStringMap(map<string, string?>? str_map) + => (map<string, string?>? str_map); +}; + +enum TopLevelEnum { + E0, + E1, +}; diff --git a/mojo/public/interfaces/bindings/tests/validation_test_associated_interfaces.mojom b/mojo/public/interfaces/bindings/tests/validation_test_associated_interfaces.mojom new file mode 100644 index 0000000000..2fa77ffc9d --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/validation_test_associated_interfaces.mojom @@ -0,0 +1,18 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test; + +// Associated interfaces are not supported by all language bindings yet. +// Eventually these definitions should live in validation_test_interfaces.mojom. + +interface InterfaceX {}; + +interface AssociatedConformanceTestInterface { + Method0(associated InterfaceX param0); + Method1(associated InterfaceX& param0); + Method2(associated InterfaceX? param0); + Method3(array<associated InterfaceX> param0); +}; + diff --git a/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom b/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom new file mode 100644 index 0000000000..ab69045e53 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom @@ -0,0 +1,135 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +[JavaPackage="org.chromium.mojo.bindings.test.mojom.mojo"] +module mojo.test; + +struct StructA { + uint64 i; +}; + +struct StructB { + StructA struct_a; +}; + +struct StructC { + array<uint8> data; +}; + +struct StructD { + array<handle<message_pipe>> message_pipes; +}; + +struct StructE { + StructD struct_d; + handle<data_pipe_consumer> data_pipe_consumer; +}; + +struct StructF { + array<uint8, 3> fixed_size_array; +}; + +struct StructG { + int32 i; + [MinVersion=1] + StructA? struct_a; + [MinVersion=3] + string? str; + [MinVersion=3] + bool b; +}; + +interface InterfaceA { +}; + +enum EnumA { + ENUM_A_0, + ENUM_A_1 +}; + +[Extensible] +enum EnumB { + ENUM_B_0, + ENUM_B_1, + ENUM_B_2 +}; + +// A non-extensible enum with no values is valid, but about as useless as +// you would expect: it will fail validation for all values. +enum EmptyEnum {}; + +[Extensible] +enum ExtensibleEmptyEnum {}; + +union UnionA { + StructA struct_a; + bool b; +}; + +// This interface is used for testing bounds-checking in the mojom +// binding code. If you add a method please update the files +// ./data/validation/boundscheck_*. If you add a response please update +// ./data/validation/resp_boundscheck_*. +interface BoundsCheckTestInterface { + Method0(uint8 param0) => (uint8 param0); + Method1(uint8 param0); +}; + +interface ConformanceTestInterface { + Method0(float param0); + Method1(StructA param0); + Method2(StructB param0, StructA param1); + Method3(array<bool> param0); + Method4(StructC param0, array<uint8> param1); + Method5(StructE param0, handle<data_pipe_producer> param1); + Method6(array<array<uint8>> param0); + Method7(StructF param0, array<array<uint8, 3>?, 2> param1); + Method8(array<array<string>?> param0); + Method9(array<array<handle?>>? param0); + Method10(map<string, uint8> param0); + Method11(StructG param0); + Method12(float param0) => (float param0); + Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2); + Method14(EnumA param0, EnumB param1); + Method15(array<EnumA>? param0, array<EnumB>? param1); + Method16(map<EnumA, EnumA>? param0); + Method17(array<InterfaceA> param0); + Method18(UnionA? param0); + Method19(Recursive recursive); + Method20(map<StructB, uint8> param0); + Method21(ExtensibleEmptyEnum param0); + Method22(EmptyEnum param0); +}; + +struct BasicStruct { + int32 a; +}; + +interface IntegrationTestInterface { + Method0(BasicStruct param0) => (array<uint8> param0); +}; + +// An enum generates a enum-value validation function, so we want to test it. +// E.g., valid enum values for this enum should be: -3, 0, 1, 10 +enum BasicEnum { + A, + B, + C = A, + D = -3, + E = 0xA +}; + +// The enum validation function should be generated within the scope of this +// struct. +struct StructWithEnum { + enum EnumWithin { + A, B, C, D + }; +}; + +// This is used to test that deeply recursive structures don't blow the stack. +struct Recursive { + Recursive? recursive; +}; diff --git a/mojo/public/interfaces/bindings/tests/versioning_test_client.mojom b/mojo/public/interfaces/bindings/tests/versioning_test_client.mojom new file mode 100644 index 0000000000..f0136db9b5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/versioning_test_client.mojom @@ -0,0 +1,34 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test.versioning; + +// versioning_test_service.mojom and versioning_test_client.mojom contain +// different versions of Mojom definitions for a fictitious human resource +// management system. They are used to test the versioning mechanism. + +enum Department { + SALES, + DEV +}; + +struct Employee { + uint64 employee_id; + string name; + Department department; +}; + +interface HumanResourceDatabase { + AddEmployee(Employee employee) => (bool success); + + QueryEmployee(uint64 id, [MinVersion=1] bool retrieve_finger_print) + => (Employee? employee, [MinVersion=1] array<uint8>? finger_print); + + [MinVersion=1] + AttachFingerPrint(uint64 id, array<uint8> finger_print) + => (bool success); + + [MinVersion=2] + ListEmployeeIds() => (array<uint64>? ids); +}; diff --git a/mojo/public/interfaces/bindings/tests/versioning_test_service.mojom b/mojo/public/interfaces/bindings/tests/versioning_test_service.mojom new file mode 100644 index 0000000000..59b38324a6 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/versioning_test_service.mojom @@ -0,0 +1,38 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo.test.versioning; + +// versioning_test_service.mojom and versioning_test_client.mojom contain +// different versions of Mojom definitions for a fictitious human resource +// management system. They are used to test the versioning mechanism. + +enum Department { + SALES, + DEV +}; + +struct Date { + uint16 year; + uint8 month; + uint8 day; +}; + +struct Employee { + uint64 employee_id; + string name; + Department department; + [MinVersion=1] Date? birthday; +}; + +interface HumanResourceDatabase { + AddEmployee(Employee employee) => (bool success); + + QueryEmployee(uint64 id, [MinVersion=1] bool retrieve_finger_print) + => (Employee? employee, [MinVersion=1] array<uint8>? finger_print); + + [MinVersion=1] + AttachFingerPrint(uint64 id, array<uint8> finger_print) + => (bool success); +}; |