1
2// Copyright 2013 The Chromium Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5
6[JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"]
7module sample;
8
9import "mojo/public/interfaces/bindings/tests/sample_import.mojom";
10import "mojo/public/interfaces/bindings/tests/sample_import2.mojom";
11
12const uint8 kTwelve = 12;
13
14struct Bar {
15  enum Type {
16    VERTICAL = 1,
17    HORIZONTAL,
18    BOTH,
19    INVALID
20  };
21  uint8 alpha@0 = 0xff;
22  uint8 beta@1;
23  uint8 gamma@2;
24  Type type@3 = sample.Bar.Type.VERTICAL;
25};
26
27struct Foo {
28  const string kFooby = "Fooby";
29  string name@8 = kFooby;
30  int32 x@0;
31  int32 y@1;
32  bool a@2 = true;
33  bool b@3;
34  bool c@4;
35  Bar? bar@5;
36  array<Bar>? extra_bars@7;
37  array<uint8>? data@6;
38  handle<message_pipe>? source@9;
39  array<handle<data_pipe_consumer>>? input_streams@10;
40  array<handle<data_pipe_producer>>? output_streams@11;
41  array<array<bool>>? array_of_array_of_bools@12;
42  array<array<array<string>>>? multi_array_of_strings@13;
43  array<bool>? array_of_bools@14;
44};
45
46struct DefaultsTest {
47  int8 a0@0 = -12;
48  uint8 a1@1 = sample.kTwelve;
49  int16 a2@2 = 1234;
50  uint16 a3@3 = 34567;
51  int32 a4@4 = 123456;
52  uint32 a5@5 = 3456789012;
53  int64 a6@6 = -111111111111;
54  uint64 a7@7 = 9999999999999999999;
55  int32 a8@8 = 0x12345;
56  int32 a9@9 = -0x12345;
57  int32 a10@10 = +1234;
58  bool a11@11 = true;
59  bool a12@12 = false;
60  float a13@13 = 123.25;
61  double a14@14 = 1234567890.123;
62  double a15@15 = 1E10;
63  double a16@16 = -1.2E+20;
64  double a17@17 = +1.23E-20;
65
66  // TODO(vtl): Add tests for default vs null when those are implemented (for
67  // structs, arrays, and strings).
68  array<uint8> a18@18;
69  string a19@19;
70
71  Bar.Type a20@20 = BOTH;
72  imported.Point a21@21;
73  imported.Thing a22@22 = default;
74
75  uint64 a23@23 = 0xFFFFFFFFFFFFFFFF;
76  int64 a24@24 = 0x123456789;
77  int64 a25@25 = -0x123456789;
78
79  double a26@26 = double.INFINITY;
80  double a27@27 = double.NEGATIVE_INFINITY;
81  double a28@28 = double.NAN;
82  float a29@29 = float.INFINITY;
83  float a30@30 = float.NEGATIVE_INFINITY;
84  float a31@31 = float.NAN;
85};
86
87struct StructWithHoleV1 {
88  int32 v1 = 1;
89  int64 v2 = 2;
90};
91
92struct StructWithHoleV2 {
93  int32 v1 = 1;
94  int64 v2 = 2;
95  int32 v3 = 3;
96};
97
98interface Service {
99  enum BazOptions {
100    REGULAR = 0,
101    EXTRA
102  };
103  const uint8 kFavoriteBaz = 1;
104  Frobinate@0(Foo? foo@0, BazOptions baz@1, Port? port@2) => (int32 result@0);
105  GetPort@1(Port& port @0);
106};
107
108// This interface is referenced above where it is defined. It also refers to
109// itself from a method.
110interface Port {
111  PostMessageToPort@0(string message_text@0, Port port@1);
112};
113