New issue
Advanced search Search tips

Issue 905728 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Bindings conformance test framework

Project Member Reported by rockot@google.com, Nov 15

Issue description

We've got Mojom bindings for C++, JS, and Java. They all need to support the same essential features and they all need to conform to the same serialization format for any given IDL and set of parameters.

We should have a common set of test cases with each consisting of a set of one-off mojom definitions, a set of test messages, expressed as language-agnostic description of argument values, and a corresponding serialized message expectation for each test message.

A test case might look something like:

  # basic_types.mojomtest
  mojom:
    interface Test {
      Send(int32 x, float32 f, string? s);
    };

  tests:
    withNullField:
      input: Test.Send(42, 3.14, null)
      output:
        header:
          flags: 0
          ordinal: 0
        body:
          uint32 24     # Send params should take 24 bytes
          uint32 0      # Version 0
          uint32 42     # Value of x
          float32 3.14  # Value of f
          offset 0      # Value of s

    withNonNullFiled:
      input: Test.Send(42, 3.14, "hello");
      output:
        header:
          flags: 0
          ordinal: 0
        body:
          uint32 24
          uint32 0
          uint32 42
          float32 3.14
          offset $s     # Variable offset allowed
        # data encoded at a variable offset
        $s:
          uint32 13      # Size of array in bytes
          uint32 5       # Number of elements
          uint8 104      # h
          uint8 101      # e
          uint8 108      # l
          uint8 108      # l
          uint8 111      # o
          pad 5          # 5 bytes of padding

From these cases we can have Python generate test code for each target language to produce a mojom conformance test suite.
 

Sign in to add a comment