Chromium Code Reviews| 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 [DartPackage="_mojo_for_test_only", JavaPackage="org.chromium.mojo.bindings.test .mojom.sample"] | 5 [DartPackage="_mojo_for_test_only", |
| 6 JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] | |
| 6 module sample; | 7 module sample; |
| 7 | 8 |
| 8 import "sample_import.mojom"; | 9 import "sample_import.mojom"; |
| 9 import "sample_import2.mojom"; | 10 import "sample_import2.mojom"; |
| 10 | 11 |
| 11 const uint8 kTwelve = 12; | 12 const uint8 kTwelve = 12; |
| 12 | 13 |
| 13 struct Bar { | 14 struct Bar { |
| 14 enum Type { | 15 enum Type { |
| 15 VERTICAL = 1, | 16 VERTICAL = 1, |
| 16 HORIZONTAL, | 17 HORIZONTAL, |
| 17 BOTH, | 18 BOTH, |
| 18 INVALID | 19 INVALID, |
| 19 }; | 20 }; |
| 20 uint8 alpha@0 = 0xff; | 21 uint8 alpha@0 = 0xff; |
| 21 uint8 beta@1; | 22 uint8 beta@1; |
| 22 uint8 gamma@2; | 23 uint8 gamma@2; |
| 23 Type type@3 = sample.Bar.Type.VERTICAL; | 24 Type type@3 = sample.Bar.Type.VERTICAL; |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 struct Foo { | 27 struct Foo { |
| 27 const string kFooby = "Fooby"; | 28 const string kFooby = "Fooby"; |
| 28 string name@8 = kFooby; | 29 string name@8 = kFooby; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 46 int8 a0@0 = -12; | 47 int8 a0@0 = -12; |
| 47 uint8 a1@1 = sample.kTwelve; | 48 uint8 a1@1 = sample.kTwelve; |
| 48 int16 a2@2 = 1234; | 49 int16 a2@2 = 1234; |
| 49 uint16 a3@3 = 34567; | 50 uint16 a3@3 = 34567; |
| 50 int32 a4@4 = 123456; | 51 int32 a4@4 = 123456; |
| 51 uint32 a5@5 = 3456789012; | 52 uint32 a5@5 = 3456789012; |
| 52 int64 a6@6 = -111111111111; | 53 int64 a6@6 = -111111111111; |
| 53 uint64 a7@7 = 9999999999999999999; | 54 uint64 a7@7 = 9999999999999999999; |
| 54 int32 a8@8 = 0x12345; | 55 int32 a8@8 = 0x12345; |
| 55 int32 a9@9 = -0x12345; | 56 int32 a9@9 = -0x12345; |
| 56 int32 a10@10 = +1234; | 57 int32 a10@10 = 1234; |
|
jamesr
2016/03/09 19:18:08
i think we want something somewhere that has a una
viettrungluu
2016/03/09 20:49:08
I mentioned this previously. I can live with havin
jamesr
2016/03/09 20:58:09
Yeah I'm totally fine with that - but this should
azani
2016/03/15 22:18:48
Done.
| |
| 57 bool a11@11 = true; | 58 bool a11@11 = true; |
| 58 bool a12@12 = false; | 59 bool a12@12 = false; |
| 59 float a13@13 = 123.25; | 60 float a13@13 = 123.25; |
| 60 double a14@14 = 1234567890.123; | 61 double a14@14 = 1234567890.123; |
| 61 double a15@15 = 1E10; | 62 double a15@15 = 1E10; |
| 62 double a16@16 = -1.2E+20; | 63 double a16@16 = -1.2E+20; |
| 63 double a17@17 = +1.23E-20; | 64 double a17@17 = 1.23E-20; |
| 64 | 65 |
| 65 // TODO(vtl): Add tests for default vs null when those are implemented (for | 66 // TODO(vtl): Add tests for default vs null when those are implemented (for |
| 66 // structs, arrays, and strings). | 67 // structs, arrays, and strings). |
| 67 array<uint8> a18@18; | 68 array<uint8> a18@18; |
| 68 string a19@19; | 69 string a19@19; |
| 69 | 70 |
| 70 Bar.Type a20@20 = BOTH; | 71 Bar.Type a20@20 = BOTH; |
| 71 imported.Point a21@21; | 72 imported.Point a21@21; |
| 72 imported.Thing a22@22 = default; | 73 imported.Thing a22@22 = default; |
| 73 | 74 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 90 | 91 |
| 91 struct StructWithHoleV2 { | 92 struct StructWithHoleV2 { |
| 92 int32 v1 = 1; | 93 int32 v1 = 1; |
| 93 int64 v2 = 2; | 94 int64 v2 = 2; |
| 94 int32 v3 = 3; | 95 int32 v3 = 3; |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 interface Service { | 98 interface Service { |
| 98 enum BazOptions { | 99 enum BazOptions { |
| 99 REGULAR = 0, | 100 REGULAR = 0, |
| 100 EXTRA | 101 EXTRA, |
| 101 }; | 102 }; |
| 102 const uint8 kFavoriteBaz = 1; | 103 const uint8 kFavoriteBaz = 1; |
| 103 Frobinate@0(Foo? foo@0, BazOptions baz@1, Port? port@2) => (int32 result@0); | 104 Frobinate@0(Foo? foo@0, BazOptions baz@1, Port? port@2) => (int32 result@0); |
| 104 GetPort@1(Port& port @0); | 105 GetPort@1(Port& port@0); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 // This interface is referenced above where it is defined. It also refers to | 108 // This interface is referenced above where it is defined. It also refers to |
| 108 // itself from a method. | 109 // itself from a method. |
| 109 interface Port { | 110 interface Port { |
| 110 PostMessage@0(string message_text@0, Port port@1); | 111 PostMessage@0(string message_text@0, Port port@1); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 struct NonNullableMapStruct { | 114 struct NonNullableMapStruct { |
| 114 map<string, string> map_field; | 115 map<string, string> map_field; |
| 115 }; | 116 }; |
| OLD | NEW |