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 3 // found in the LICENSE file. 4 5 module mojo.test; 6 7 // TODO(yzshen): Rename *WithTraits* types to something more readable. 8 9 struct NestedStructWithTraits { 10 int32 value; 11 }; 12 13 enum EnumWithTraits { 14 VALUE_0, 15 VALUE_1 16 }; 17 18 struct StructWithTraits { 19 EnumWithTraits f_enum; 20 bool f_bool; 21 uint32 f_uint32; 22 uint64 f_uint64; 23 string f_string; 24 string f_string2; 25 array<string> f_string_array; 26 NestedStructWithTraits f_struct; 27 array<NestedStructWithTraits> f_struct_array; 28 map<string, NestedStructWithTraits> f_struct_map; 29 }; 30 31 // Test that this container can be cloned. 32 struct StructWithTraitsContainer { 33 StructWithTraits f_struct; 34 }; 35 36 struct PassByValueStructWithTraits { 37 handle f_handle; 38 }; 39 40 // The custom type for PassByValueStructWithTraits is not clonable. Test that 41 // this container can compile as long as Clone() is not used. 42 struct PassByValueStructWithTraitsContainer { 43 PassByValueStructWithTraits f_struct; 44 }; 45 46 struct StructWithTraitsForUniquePtrTest { 47 int32 f_int32; 48 }; 49 50 interface TraitsTestService { 51 EchoStructWithTraits(StructWithTraits s) => (StructWithTraits passed); 52 53 EchoPassByValueStructWithTraits(PassByValueStructWithTraits s) => 54 (PassByValueStructWithTraits passed); 55 56 EchoEnumWithTraits(EnumWithTraits e) => (EnumWithTraits passed); 57 58 EchoStructWithTraitsForUniquePtrTest(StructWithTraitsForUniquePtrTest e) => ( 59 StructWithTraitsForUniquePtrTest passed); 60 }; 61