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