Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: mojo/public/interfaces/bindings/tests/test_structs.mojom

Issue 1741963002: Auto-formatted all .mojom files. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Switch to 80 char line length limit. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.test_structs"] 5 [DartPackage="_mojo_for_test_only",
6 JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"]
6 module mojo.test; 7 module mojo.test;
7 8
8 import "mojo/public/interfaces/bindings/tests/rect.mojom"; 9 import "mojo/public/interfaces/bindings/tests/rect.mojom";
9 10
10 // Tests that you can reference yet-to-be-declared structs in a union. 11 // Tests that you can reference yet-to-be-declared structs in a union.
11 union UnionOfStructs { 12 union UnionOfStructs {
12 NamedRegion nr; 13 NamedRegion nr;
13 array<NamedRegion> a_nr; 14 array<NamedRegion> a_nr;
14 array<RectPair> a_rp; 15 array<RectPair> a_rp;
15 map<int64, NoDefaultFieldValues> m_ndfv; 16 map<int64, NoDefaultFieldValues> m_ndfv;
(...skipping 12 matching lines...) Expand all
28 struct NamedRegion { 29 struct NamedRegion {
29 string? name; 30 string? name;
30 array<Rect>? rects; 31 array<Rect>? rects;
31 }; 32 };
32 33
33 struct RectPair { 34 struct RectPair {
34 Rect? first; 35 Rect? first;
35 Rect? second; 36 Rect? second;
36 }; 37 };
37 38
38 struct EmptyStruct { 39 struct EmptyStruct {};
39 };
40
41 40
42 struct HandleStruct { 41 struct HandleStruct {
43 handle<message_pipe>? h; 42 handle<message_pipe>? h;
44 array<handle<message_pipe>> array_h; 43 array<handle<message_pipe>> array_h;
45 }; 44 };
46 45
47 struct NullableHandleStruct { 46 struct NullableHandleStruct {
48 handle<message_pipe>? h; 47 handle<message_pipe>? h;
49 int32 data = 1234; 48 int32 data = 1234;
50 }; 49 };
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 struct ScopedConstants { 118 struct ScopedConstants {
120 const int32 TEN = 10; 119 const int32 TEN = 10;
121 const int32 ALSO_TEN = TEN; 120 const int32 ALSO_TEN = TEN;
122 enum EType { 121 enum EType {
123 E0, 122 E0,
124 E1, 123 E1,
125 E2 = 10, 124 E2 = 10,
126 E3 = E2, 125 E3 = E2,
127 E4, 126 E4,
128 }; 127 };
129 EType f0 = E0; // 0 128 EType f0 = E0; // 0
130 EType f1 = E1; // 1 129 EType f1 = E1; // 1
131 EType f2 = E2; // 10 130 EType f2 = E2; // 10
132 EType f3 = E3; // 10 131 EType f3 = E3; // 10
133 EType f4 = E4; // 11 132 EType f4 = E4; // 11
134 int32 f5 = TEN; 133 int32 f5 = TEN;
135 int32 f6 = ALSO_TEN; 134 int32 f6 = ALSO_TEN;
136 }; 135 };
137 136
138 // Used to verify that all possible Map key field types can be encoded and 137 // Used to verify that all possible Map key field types can be encoded and
139 // decoded successfully. 138 // decoded successfully.
140 139
141 struct MapKeyTypes { 140 struct MapKeyTypes {
142 map<bool, bool> f0; 141 map<bool, bool> f0;
143 map<int8, int8> f1; 142 map<int8, int8> f1;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 float f6 = V6; 206 float f6 = V6;
208 double f7 = V7; 207 double f7 = V7;
209 double f8 = V8; 208 double f8 = V8;
210 double f9 = V9; 209 double f9 = V9;
211 }; 210 };
212 211
213 // Used to verify that various signed integer values can be encoded and 212 // Used to verify that various signed integer values can be encoded and
214 // decoded correctly. 213 // decoded correctly.
215 214
216 struct IntegerNumberValues { 215 struct IntegerNumberValues {
216 // no-format
217 const int8 V0 = -128; // Minimum 217 const int8 V0 = -128; // Minimum
218 const int8 V1 = -1; // -1 218 const int8 V1 = -1; // -1
219 const int8 V2 = 0; // 0 219 const int8 V2 = 0; // 0
220 const int8 V3 = 42; // An arbitrary valid value. 220 const int8 V3 = 42; // An arbitrary valid value.
221 const int8 V4 = 127; // Maximum 221 const int8 V4 = 127; // Maximum
222 // end-no-format
222 223
223 const int16 V5 = -32768; // ... 224 const int16 V5 = -32768; // ...
224 const int16 V6 = -1; 225 const int16 V6 = -1;
225 const int16 V7 = 0; 226 const int16 V7 = 0;
226 const int16 V8 = 12345; 227 const int16 V8 = 12345;
227 const int16 V9 = 32767; 228 const int16 V9 = 32767;
228 229
229 const int32 V10 = -2147483648; 230 const int32 V10 = -2147483648;
230 const int32 V11 = -1; 231 const int32 V11 = -1;
231 const int32 V12 = 0; 232 const int32 V12 = 0;
232 const int32 V13 = 1234567890; 233 const int32 V13 = 1234567890;
233 const int32 V14 = 2147483647; 234 const int32 V14 = 2147483647;
234 235
235 // The limits for JavaScript integers are +/- (2^53 - 1). 236 // The limits for JavaScript integers are +/- (2^53 - 1).
236 const int64 V15 = -9007199254740991; // Number.MIN_SAFE_INTEGER 237 const int64 V15 = -9007199254740991; // Number.MIN_SAFE_INTEGER
237 const int64 V16 = -1; 238 const int64 V16 = -1;
238 const int64 V17 = 0; 239 const int64 V17 = 0;
239 const int64 V18 = 1234567890123456; 240 const int64 V18 = 1234567890123456;
240 const int64 V19 = 9007199254740991; // Number.MAX_SAFE_INTEGER 241 const int64 V19 = 9007199254740991; // Number.MAX_SAFE_INTEGER
241 242
242 int8 f0 = V0; 243 int8 f0 = V0;
243 int8 f1 = V1; 244 int8 f1 = V1;
244 int8 f2 = V2; 245 int8 f2 = V2;
245 int8 f3 = V3; 246 int8 f3 = V3;
246 int8 f4 = V4; 247 int8 f4 = V4;
247 248
248 int16 f5 = V5; 249 int16 f5 = V5;
249 int16 f6 = V6; 250 int16 f6 = V6;
250 int16 f7 = V7; 251 int16 f7 = V7;
(...skipping 10 matching lines...) Expand all
261 int64 f16 = V16; 262 int64 f16 = V16;
262 int64 f17 = V17; 263 int64 f17 = V17;
263 int64 f18 = V18; 264 int64 f18 = V18;
264 int64 f19 = V19; 265 int64 f19 = V19;
265 }; 266 };
266 267
267 // Used to verify that various unsigned integer values can be encoded and 268 // Used to verify that various unsigned integer values can be encoded and
268 // decoded correctly. 269 // decoded correctly.
269 270
270 struct UnsignedNumberValues { 271 struct UnsignedNumberValues {
271 const uint8 V0 = 0; // Minimum = 0. 272 const uint8 V0 = 0; // Minimum = 0.
272 const uint8 V1 = 42; // An arbitrary valid value. 273 const uint8 V1 = 42; // An arbitrary valid value.
273 const uint8 V2 = 0xFF; // Maximum 274 const uint8 V2 = 0xFF; // Maximum
274 275
275 const uint16 V3 = 0; // ... 276 const uint16 V3 = 0; // ...
276 const uint16 V4 = 12345; 277 const uint16 V4 = 12345;
277 const uint16 V5 = 0xFFFF; 278 const uint16 V5 = 0xFFFF;
278 279
279 const uint32 V6 = 0; 280 const uint32 V6 = 0;
280 const uint32 V7 = 1234567890; 281 const uint32 V7 = 1234567890;
281 const uint32 V8 = 0xFFFFFFFF; 282 const uint32 V8 = 0xFFFFFFFF;
282 283
283 // The limits for JavaScript integers are +/- (2^53 - 1). 284 // The limits for JavaScript integers are +/- (2^53 - 1).
284 const uint64 V9 = 0; 285 const uint64 V9 = 0;
285 const uint64 V10 = 1234567890123456; 286 const uint64 V10 = 1234567890123456;
286 const uint64 V11 = 9007199254740991; // Number.MAX_SAFE_INTEGER 287 const uint64 V11 = 9007199254740991; // Number.MAX_SAFE_INTEGER
287 288
288 uint8 f0 = V0; 289 uint8 f0 = V0;
289 uint8 f1 = V1; 290 uint8 f1 = V1;
290 uint8 f2 = V2; 291 uint8 f2 = V2;
291 292
292 uint16 f3 = V3; 293 uint16 f3 = V3;
293 uint16 f4 = V4; 294 uint16 f4 = V4;
294 uint16 f5 = V5; 295 uint16 f5 = V5;
295 296
296 uint32 f6 = V6; 297 uint32 f6 = V6;
297 uint32 f7 = V7; 298 uint32 f7 = V7;
298 uint32 f8 = V8; 299 uint32 f8 = V8;
299 300
300 uint64 f9 = V9; 301 uint64 f9 = V9;
301 uint64 f10 = V10; 302 uint64 f10 = V10;
302 uint64 f11 = V11; 303 uint64 f11 = V11;
303 }; 304 };
304 305
305 // Used to verify that various (packed) boolean array values can be encoded 306 // Used to verify that various (packed) boolean array values can be encoded
306 // and decoded correctly. 307 // and decoded correctly.
307 308
308 struct BitArrayValues { 309 struct BitArrayValues {
309 array<bool, 1> f0; 310 array<bool, 1> f0;
310 array<bool, 7> f1; 311 array<bool, 7> f1;
311 array<bool, 9> f2; 312 array<bool, 9> f2;
312 array<bool> f3; 313 array<bool> f3;
313 array<array<bool>> f4; 314 array<array<bool>> f4;
314 array<array<bool>?> f5; 315 array<array<bool>?> f5;
315 array<array<bool, 2>?> f6; 316 array<array<bool, 2>?> f6;
316 }; 317 };
317 318
318 // Used to verify that different versions can be decoded correctly. 319 // Used to verify that different versions can be decoded correctly.
319 320
320 struct MultiVersionStruct { 321 struct MultiVersionStruct {
321 [MinVersion=0] 322 [MinVersion=0] int32 f_int32;
322 int32 f_int32; 323 [MinVersion=1] Rect? f_rect;
323 [MinVersion=1] 324 [MinVersion=3] string? f_string;
324 Rect? f_rect; 325 [MinVersion=5] array<int8>? f_array;
325 [MinVersion=3] 326 [MinVersion=7] handle<message_pipe>? f_message_pipe;
326 string? f_string; 327 [MinVersion=7] bool f_bool;
327 [MinVersion=5] 328 [MinVersion=9] int16 f_int16;
328 array<int8>? f_array;
329 [MinVersion=7]
330 handle<message_pipe>? f_message_pipe;
331 [MinVersion=7]
332 bool f_bool;
333 [MinVersion=9]
334 int16 f_int16;
335 }; 329 };
336 330
337 struct MultiVersionStructV0 { 331 struct MultiVersionStructV0 {
338 [MinVersion=0] 332 [MinVersion=0] int32 f_int32;
339 int32 f_int32;
340 }; 333 };
341 334
342 struct MultiVersionStructV1 { 335 struct MultiVersionStructV1 {
343 [MinVersion=0] 336 [MinVersion=0] int32 f_int32;
344 int32 f_int32; 337 [MinVersion=1] Rect? f_rect;
345 [MinVersion=1]
346 Rect? f_rect;
347 }; 338 };
348 339
349 struct MultiVersionStructV3 { 340 struct MultiVersionStructV3 {
350 [MinVersion=0] 341 [MinVersion=0] int32 f_int32;
351 int32 f_int32; 342 [MinVersion=1] Rect? f_rect;
352 [MinVersion=1] 343 [MinVersion=3] string? f_string;
353 Rect? f_rect;
354 [MinVersion=3]
355 string? f_string;
356 }; 344 };
357 345
358 struct MultiVersionStructV5 { 346 struct MultiVersionStructV5 {
359 [MinVersion=0] 347 [MinVersion=0] int32 f_int32;
360 int32 f_int32; 348 [MinVersion=1] Rect? f_rect;
361 [MinVersion=1] 349 [MinVersion=3] string? f_string;
362 Rect? f_rect; 350 [MinVersion=5] array<int8>? f_array;
363 [MinVersion=3]
364 string? f_string;
365 [MinVersion=5]
366 array<int8>? f_array;
367 }; 351 };
368 352
369 struct MultiVersionStructV7 { 353 struct MultiVersionStructV7 {
370 [MinVersion=0] 354 [MinVersion=0] int32 f_int32;
371 int32 f_int32; 355 [MinVersion=1] Rect? f_rect;
372 [MinVersion=1] 356 [MinVersion=3] string? f_string;
373 Rect? f_rect; 357 [MinVersion=5] array<int8>? f_array;
374 [MinVersion=3] 358 [MinVersion=7] handle<message_pipe>? f_message_pipe;
375 string? f_string; 359 [MinVersion=7] bool f_bool;
376 [MinVersion=5]
377 array<int8>? f_array;
378 [MinVersion=7]
379 handle<message_pipe>? f_message_pipe;
380 [MinVersion=7]
381 bool f_bool;
382 }; 360 };
383 361
384 // Used to verify that interfaces that are struct members can be defined in the 362 // Used to verify that interfaces that are struct members can be defined in the
385 // same file. 363 // same file.
386 364
387 interface SomeInterface { 365 interface SomeInterface {
388 SomeMethod(RectPair pair) => (RectPair other_pair); 366 SomeMethod(RectPair pair) => (RectPair other_pair);
389 }; 367 };
390 368
391 struct ContainsInterface { 369 struct ContainsInterface {
392 SomeInterface some_interface; 370 SomeInterface some_interface;
393 }; 371 };
394 372
395 // Regression: Verify that a field can be called |other|. 373 // Regression: Verify that a field can be called |other|.
396 374
397 struct ContainsOther { 375 struct ContainsOther {
398 int32 other; 376 int32 other;
399 }; 377 };
400 378
401 struct ContainsInterfaceRequest { 379 struct ContainsInterfaceRequest {
402 SomeInterface& req; 380 SomeInterface& req;
403 SomeInterface&? nullable_req; 381 SomeInterface&? nullable_req;
404 }; 382 };
405 383
406
407 struct DartKeywordStruct { 384 struct DartKeywordStruct {
408 enum Keywords { 385 enum Keywords {
409 AWAIT, 386 AWAIT,
410 IS, 387 IS,
411 RETHROW, 388 RETHROW,
412 }; 389 };
413 Keywords await; 390 Keywords await;
414 Keywords is; 391 Keywords is;
415 Keywords rethrow; 392 Keywords rethrow;
416 }; 393 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698