chromium/mojo/public/tools/fuzzers/fuzz.mojom

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module fuzz.mojom;

[Extensible]
enum FuzzEnum {
  FUZZ_VALUE0,
  FUZZ_VALUE1,
  FUZZ_VALUE2
};

struct FuzzDummyStruct {
  int8 dummy;
};

union FuzzUnion {
  bool fuzz_bool;
  int8 fuzz_int8;
  uint8 fuzz_uint8;
  int16 fuzz_int16;
  uint16 fuzz_uint16;
  int32 fuzz_int32;
  uint32 fuzz_uint32;
  int64 fuzz_int64;
  uint64 fuzz_uint64;
  float fuzz_float;
  double fuzz_double;
  string fuzz_string;
  array<bool> fuzz_bool_array;
  array<int8> fuzz_primitive_array;
  array<FuzzDummyStruct> fuzz_struct_array;
  map<string, int8> fuzz_primitive_map;
  map<string, array<string>> fuzz_array_map;
  map<string, FuzzDummyStruct> fuzz_struct_map;
  map<FuzzEnum, FuzzUnion> fuzz_union_map;

  array<map<FuzzEnum, map<int8, array<FuzzUnion?>?>>>? fuzz_complex;
};

struct FuzzStruct {
  bool fuzz_bool;
  int8 fuzz_int8;
  uint8 fuzz_uint8;
  int16 fuzz_int16;
  uint16 fuzz_uint16;
  int32 fuzz_int32;
  uint32 fuzz_uint32;
  int64 fuzz_int64;
  uint64 fuzz_uint64;
  float fuzz_float;
  double fuzz_double;
  string fuzz_string;

  array<bool> fuzz_bool_array;
  array<int8> fuzz_primitive_array;
  map<string, int8> fuzz_primitive_map;
  map<string, array<string>> fuzz_array_map;
  map<FuzzEnum, FuzzUnion> fuzz_union_map;
  array<FuzzUnion> fuzz_union_array;
  array<FuzzStruct> fuzz_struct_array;
  array<int8>? fuzz_nullable_array;

  array<map<FuzzEnum, map<int8, array<FuzzStruct?>?>>>? fuzz_complex;
};

interface FuzzDummyInterface {
  Ping();
};

// A comprehensive Mojo interface used for fuzzing message dispatch and validation.
interface FuzzInterface {
  FuzzBasic();
  FuzzBasicResp() => ();
  [Sync]
  FuzzBasicSyncResp() => ();

  FuzzArgs(FuzzStruct a, FuzzStruct? b);
  FuzzArgsResp(FuzzStruct a, FuzzStruct? b) => ();
  [Sync]
  FuzzArgsSyncResp(FuzzStruct a, FuzzStruct? b) => ();

  FuzzAssociated(pending_associated_receiver<FuzzDummyInterface> receiver);
};