summaryrefslogtreecommitdiff
path: root/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
blob: ab69045e53bc43220718d38a07a159d053f456af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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;
};