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 [DartPackage="_mojo_for_test_only", | |
6 JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] | |
7 module sample; | |
8 | |
9 import "sample_import.mojom"; | |
10 import "sample_import2.mojom"; | |
11 | |
12 const uint8 kTwelve = 12; | |
13 | |
14 struct 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 | |
27 struct 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 | |
46 struct DefaultsTest { | |
47 // no-format | |
48 int8 a0@0 = -12; | |
49 uint8 a1@1 = sample.kTwelve; | |
50 int16 a2@2 = 1234; | |
51 uint16 a3@3 = 34567; | |
52 int32 a4@4 = 123456; | |
53 uint32 a5@5 = 3456789012; | |
54 int64 a6@6 = -111111111111; | |
55 uint64 a7@7 = 9999999999999999999; | |
56 int32 a8@8 = 0x12345; | |
57 int32 a9@9 = -0x12345; | |
58 int32 a10@10 = +1234; | |
59 bool a11@11 = true; | |
60 bool a12@12 = false; | |
61 float a13@13 = 123.25; | |
62 double a14@14 = 1234567890.123; | |
63 double a15@15 = 1E10; | |
64 double a16@16 = -1.2E+20; | |
65 double a17@17 = +1.23E-20; | |
66 // end-no-format | |
67 | |
68 // TODO(vtl): Add tests for default vs null when those are implemented (for | |
69 // structs, arrays, and strings). | |
70 array<uint8> a18@18; | |
71 string a19@19; | |
72 | |
73 Bar.Type a20@20 = BOTH; | |
74 imported.Point a21@21; | |
75 imported.Thing a22@22 = default; | |
76 | |
77 uint64 a23@23 = 0xFFFFFFFFFFFFFFFF; | |
78 int64 a24@24 = 0x123456789; | |
79 int64 a25@25 = -0x123456789; | |
80 | |
81 double a26@26 = double.INFINITY; | |
82 double a27@27 = double.NEGATIVE_INFINITY; | |
83 double a28@28 = double.NAN; | |
84 float a29@29 = float.INFINITY; | |
85 float a30@30 = float.NEGATIVE_INFINITY; | |
86 float a31@31 = float.NAN; | |
87 }; | |
88 | |
89 struct StructWithHoleV1 { | |
90 int32 v1 = 1; | |
91 int64 v2 = 2; | |
92 }; | |
93 | |
94 struct StructWithHoleV2 { | |
95 int32 v1 = 1; | |
96 int64 v2 = 2; | |
97 int32 v3 = 3; | |
98 }; | |
99 | |
100 interface Service { | |
101 enum BazOptions { | |
102 REGULAR = 0, | |
103 EXTRA, | |
104 }; | |
105 const uint8 kFavoriteBaz = 1; | |
106 Frobinate@0(Foo? foo@0, BazOptions baz@1, Port? port@2) => (int32 result@0); | |
107 GetPort@1(Port& port@0); | |
108 }; | |
109 | |
110 // This interface is referenced above where it is defined. It also refers to | |
111 // itself from a method. | |
112 interface Port { | |
113 PostMessage@0(string message_text@0, Port port@1); | |
114 }; | |
115 | |
116 struct NonNullableMapStruct { | |
117 map<string, string> map_field; | |
118 }; | |
OLD | NEW |