OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 module mojo.test; | 5 module mojo.test; |
6 | 6 |
7 // TODO(yzshen): Rename *WithTraits* types to something more readable. | 7 // TODO(yzshen): Rename *WithTraits* types to something more readable. |
8 | 8 |
9 struct NestedStructWithTraits { | 9 struct NestedStructWithTraits { |
10 int32 value; | 10 int32 value; |
(...skipping 15 matching lines...) Expand all Loading... |
26 NestedStructWithTraits f_struct; | 26 NestedStructWithTraits f_struct; |
27 array<NestedStructWithTraits> f_struct_array; | 27 array<NestedStructWithTraits> f_struct_array; |
28 map<string, NestedStructWithTraits> f_struct_map; | 28 map<string, NestedStructWithTraits> f_struct_map; |
29 }; | 29 }; |
30 | 30 |
31 // Test that this container can be cloned. | 31 // Test that this container can be cloned. |
32 struct StructWithTraitsContainer { | 32 struct StructWithTraitsContainer { |
33 StructWithTraits f_struct; | 33 StructWithTraits f_struct; |
34 }; | 34 }; |
35 | 35 |
36 struct PassByValueStructWithTraits { | 36 // Maps to a pass-by-value trivial struct. |
| 37 struct TrivialStructWithTraits { |
| 38 int32 value; |
| 39 }; |
| 40 |
| 41 // Maps to a move-only struct. |
| 42 struct MoveOnlyStructWithTraits { |
37 handle f_handle; | 43 handle f_handle; |
38 }; | 44 }; |
39 | 45 |
40 // The custom type for PassByValueStructWithTraits is not clonable. Test that | 46 // The custom type for MoveOnlyStructWithTraits is not clonable. Test that |
41 // this container can compile as long as Clone() is not used. | 47 // this container can compile as long as Clone() is not used. |
42 struct PassByValueStructWithTraitsContainer { | 48 struct MoveOnlyStructWithTraitsContainer { |
43 PassByValueStructWithTraits f_struct; | 49 MoveOnlyStructWithTraits f_struct; |
44 }; | 50 }; |
45 | 51 |
46 struct StructWithTraitsForUniquePtrTest { | 52 struct StructWithTraitsForUniquePtrTest { |
47 int32 f_int32; | 53 int32 f_int32; |
48 }; | 54 }; |
49 | 55 |
50 interface TraitsTestService { | 56 interface TraitsTestService { |
51 EchoStructWithTraits(StructWithTraits s) => (StructWithTraits passed); | 57 EchoStructWithTraits(StructWithTraits s) => (StructWithTraits passed); |
52 | 58 |
53 EchoPassByValueStructWithTraits(PassByValueStructWithTraits s) => | 59 EchoTrivialStructWithTraits(TrivialStructWithTraits s) => |
54 (PassByValueStructWithTraits passed); | 60 (TrivialStructWithTraits passed); |
| 61 |
| 62 EchoMoveOnlyStructWithTraits(MoveOnlyStructWithTraits s) => |
| 63 (MoveOnlyStructWithTraits passed); |
55 | 64 |
56 EchoEnumWithTraits(EnumWithTraits e) => (EnumWithTraits passed); | 65 EchoEnumWithTraits(EnumWithTraits e) => (EnumWithTraits passed); |
57 | 66 |
58 EchoStructWithTraitsForUniquePtrTest(StructWithTraitsForUniquePtrTest e) => ( | 67 EchoStructWithTraitsForUniquePtrTest(StructWithTraitsForUniquePtrTest e) => ( |
59 StructWithTraitsForUniquePtrTest passed); | 68 StructWithTraitsForUniquePtrTest passed); |
60 }; | 69 }; |
OLD | NEW |