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.
5 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"]
8 import "mojo/public/interfaces/bindings/tests/rect.mojom";
23 // Used to verify that struct fields which don't specify a default 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.
28 struct NoDefaultFieldValues {
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;
50 handle<shared_buffer> f21;
51 handle<shared_buffer>? f22;
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.
64 struct DefaultFieldValues {
65 const string kFoo = "foo";
85 // Used to verify that the code generated for enum and const values defined
86 // within a struct is correct. Assuming that a constant's value can be a literal
87 // or another constant and that enum values can either be an integer constant or
88 // another value from the same enum type.
90 struct ScopedConstants {
92 const int32 ALSO_TEN = TEN;
100 const int32 TEN_TOO = EType.E2;
110 // Used to verify that all possible Map key field types can be encoded and
111 // decoded successfully.
116 map<uint8, uint8> f2;
117 map<int16, int16> f3;
118 map<uint16, uint16> f4;
119 map<int32, int32> f5;
120 map<uint32, uint32> f6;
121 map<int64, int64> f7;
122 map<uint64, uint64> f8;
123 map<float, float> f9;
124 map<double, double> f10;
125 map<string, string> f11;
128 // Used to verify that various map value types can be encoded and decoded
131 struct MapValueTypes {
132 map<string, array<string>> f0;
133 map<string, array<string>?> f1;
134 map<string, array<string?>> f2;
135 map<string, array<string, 2>> f3;
136 map<string, array<array<string, 2>?>> f4;
137 map<string, array<array<string, 2>, 1>> f5;
138 map<string, Rect?> f6;
139 map<string, map<string, string>> f7;
140 map<string, array<map<string, string>>> f8;
143 // Used to verify that various float and double values can be encoded and
144 // decoded correctly.
146 struct FloatNumberValues {
147 const double V0 = double.INFINITY;
148 const double V1 = double.NEGATIVE_INFINITY;
149 const double V2 = double.NAN;
150 const float V3 = float.INFINITY;
151 const float V4 = float.NEGATIVE_INFINITY;
152 const float V5 = float.NAN;
154 const double V7 = 1234567890.123;
155 const double V8 = 1.2E+20;
156 const double V9 = -1.2E+20;
170 // Used to verify that various (packed) boolean array values can be encoded
171 // and decoded correctly.
173 struct BitArrayValues {
178 array<array<bool>> f4;
179 array<array<bool>?> f5;
180 array<array<bool, 2>?> f6;