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 import "mojo/public/interfaces/bindings/tests/rect.mojom" 6 7 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"] 8 module mojo.test { 9 10 struct NamedRegion { 11 string? name; 12 Rect[]? rects; 13 }; 14 15 struct RectPair { 16 Rect? first; 17 Rect? second; 18 }; 19 20 struct EmptyStruct { 21 }; 22 23 // Used to verify that struct fields which don't specify a deafult are 24 // initialized to: false for bool, 0 for numbers, and null for strings, 25 // handles, and structs. The "?" nullable suffix shouldn't have any 26 // impact on initial field values. 27 28 struct NoDefaultFieldValues { 29 bool f0; 30 int8 f1; 31 uint8 f2; 32 int16 f3; 33 uint16 f4; 34 int32 f5; 35 uint32 f6; 36 int64 f7; 37 uint64 f8; 38 float f9; 39 double f10; 40 string f11; 41 string? f12; 42 handle<message_pipe> f13; 43 handle<data_pipe_consumer> f14; 44 handle<data_pipe_producer> f15; 45 handle<message_pipe>? f16; 46 handle<data_pipe_consumer>? f17; 47 handle<data_pipe_producer>? f18; 48 handle f19; 49 handle? f20; 50 handle<shared_buffer> f21; 51 handle<shared_buffer>? f22; 52 string[] f23; 53 string?[] f24; 54 string[]? f25; 55 string?[]? f26; 56 EmptyStruct f27; 57 EmptyStruct? f28; 58 }; 59 60 // Used to verify that struct fields with an explicit default value 61 // are initialized correctly. The "?" nullable suffix shouldn't have any 62 // impact on initial field values. 63 64 struct DefaultFieldValues { 65 const string kFoo = "foo"; 66 bool f0 = true; 67 int8 f1 = 100; 68 uint8 f2 = 100; 69 int16 f3 = 100; 70 uint16 f4 = 100; 71 int32 f5 = 100; 72 uint32 f6 = 100; 73 int64 f7 = 100; 74 uint64 f8 = 100; 75 float f9 = 100; 76 float f10 = 100.0; 77 double f11 = 100; 78 double f12 = 100.0; 79 string f13 = kFoo; 80 string? f14 = kFoo; 81 Rect f15 = default; 82 Rect? f16 = default; 83 }; 84 85 } 86