OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import "sample_import.mojom" | 5 import "sample_import.mojom" |
6 import "sample_import2.mojom" | 6 import "sample_import2.mojom" |
7 | 7 |
8 [JavaPackage="org.chromium.mojo.bindings.test.sample"] | 8 [JavaPackage="org.chromium.mojo.bindings.test.sample"] |
9 module sample { | 9 module sample { |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 struct Foo { | 27 struct Foo { |
28 const string kFooby = "Fooby"; | 28 const string kFooby = "Fooby"; |
29 string name = kFooby @8; | 29 string name = kFooby @8; |
30 int32 x @0; | 30 int32 x @0; |
31 int32 y @1; | 31 int32 y @1; |
32 bool a = true @2; | 32 bool a = true @2; |
33 bool b @3; | 33 bool b @3; |
34 bool c @4; | 34 bool c @4; |
35 Bar bar @5; | 35 Bar bar @5; |
36 Bar[] extra_bars @7; | 36 Bar[] extra_bars @7; |
37 uint8[] data = [1,2,kThree] @6; | 37 uint8[] data @6; |
38 handle<message_pipe> source @9; | 38 handle<message_pipe> source @9; |
39 handle<data_pipe_consumer>[] input_streams @10; | 39 handle<data_pipe_consumer>[] input_streams @10; |
40 handle<data_pipe_producer>[] output_streams @11; | 40 handle<data_pipe_producer>[] output_streams @11; |
41 bool[][] array_of_array_of_bools = [[true], [false, true]] @12; | 41 bool[][] array_of_array_of_bools @12; |
42 string[][][] multi_array_of_strings @13; | 42 string[][][] multi_array_of_strings @13; |
43 }; | 43 }; |
44 | 44 |
45 struct DefaultsTestInner { | 45 struct DefaultsTestInner { |
46 int32 age @2; | 46 int32 x = 123 @0; |
47 string[] names = ["Jim"] @1; | |
48 int32 height = 6*12 @3; | |
49 }; | 47 }; |
50 | 48 |
51 struct DefaultsTest { | 49 struct DefaultsTest { |
52 sample.DefaultsTestInner[] people = [{32, ["Bob", "Bobby"]}] @1; | 50 int8 a0 = -12 @0; |
53 uint8[] data = [1, 2, 3] @2; | 51 uint8 a1 = 12 @1; |
54 imported.Point point = {7, 15} @3; | 52 int16 a2 = 1234 @2; |
55 int32[] shape_masks = [1 << imported.SHAPE_RECTANGLE] @4; | 53 uint16 a3 = 34567 @3; |
56 imported.Thing thing = {imported.SHAPE_CIRCLE, imported.COLOR_BLACK}; | 54 int32 a4 = 123456 @4; |
57 Bar.Type bar_type = Bar.TYPE_BOTH; | 55 // TODO(vtl): crbug.com/375522 |
| 56 uint32 a5 /* = 3456789012 */ @5; |
| 57 // TODO(vtl): crbug.com/375522 |
| 58 int64 a6 = 111111111111 @6; |
| 59 uint64 a7 /* = 9999999999999999999 */ @7; |
| 60 int32 a8 = 0x12345 @8; |
| 61 int32 a9 = -0x12345 @9; |
| 62 // TODO(vtl): crbug.com/375829 |
| 63 int32 a10 /* = 010 */ @10; // Octal. |
| 64 int32 a11 /* = -010 */ @11; // Negative octal. |
| 65 int32 a12 = +1234 @12; |
| 66 bool a13 = true @13; |
| 67 bool a14 = false @14; |
| 68 float a15 = 123.25 @15; |
| 69 double a16 = 1234567890.123 @16; |
| 70 double a17 = 1E10 @17; |
| 71 double a18 = -1.2E+20 @18; |
| 72 double a19 = +1.23E-20 @19; |
| 73 |
| 74 // TODO(vtl): Add tests for default vs null when those are implemented (for |
| 75 // structs, arrays, and strings). |
| 76 sample.DefaultsTestInner a20 @20; |
| 77 uint8[] a21 @21; |
| 78 string a22 @22; |
58 }; | 79 }; |
59 | 80 |
60 struct StructWithHoleV1 { | 81 struct StructWithHoleV1 { |
61 int32 v1 = 1; | 82 int32 v1 = 1; |
62 int64 v2 = 2; | 83 int64 v2 = 2; |
63 }; | 84 }; |
64 | 85 |
65 struct StructWithHoleV2 { | 86 struct StructWithHoleV2 { |
66 int32 v1 = 1; | 87 int32 v1 = 1; |
67 int64 v2 = 2; | 88 int64 v2 = 2; |
(...skipping 14 matching lines...) Expand all Loading... |
82 DidFrobinate@0(int32 result @0); | 103 DidFrobinate@0(int32 result @0); |
83 }; | 104 }; |
84 | 105 |
85 // This interface is referenced above where it is defined. It also refers to | 106 // This interface is referenced above where it is defined. It also refers to |
86 // itself from a method. | 107 // itself from a method. |
87 interface Port { | 108 interface Port { |
88 PostMessage@0(string message_text @0, Port port@1); | 109 PostMessage@0(string message_text @0, Port port@1); |
89 }; | 110 }; |
90 | 111 |
91 } | 112 } |
OLD | NEW |