Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 { |
| 217 const int8 V0 = -128; // Minimum | 216 const int8 V0 = -128; // Minimum |
| 218 const int8 V1 = -1; // -1 | 217 const int8 V1 = -1; // -1 |
| 219 const int8 V2 = 0; // 0 | 218 const int8 V2 = 0; // 0 |
|
jamesr
2016/02/29 23:40:49
this looks a lot worse when it isn't aligned
| |
| 220 const int8 V3 = 42; // An arbitrary valid value. | 219 const int8 V3 = 42; // An arbitrary valid value. |
| 221 const int8 V4 = 127; // Maximum | 220 const int8 V4 = 127; // Maximum |
| 222 | 221 |
| 223 const int16 V5 = -32768; // ... | 222 const int16 V5 = -32768; // ... |
| 224 const int16 V6 = -1; | 223 const int16 V6 = -1; |
| 225 const int16 V7 = 0; | 224 const int16 V7 = 0; |
| 226 const int16 V8 = 12345; | 225 const int16 V8 = 12345; |
| 227 const int16 V9 = 32767; | 226 const int16 V9 = 32767; |
| 228 | 227 |
| 229 const int32 V10 = -2147483648; | 228 const int32 V10 = -2147483648; |
| 230 const int32 V11 = -1; | 229 const int32 V11 = -1; |
| 231 const int32 V12 = 0; | 230 const int32 V12 = 0; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 261 int64 f16 = V16; | 260 int64 f16 = V16; |
| 262 int64 f17 = V17; | 261 int64 f17 = V17; |
| 263 int64 f18 = V18; | 262 int64 f18 = V18; |
| 264 int64 f19 = V19; | 263 int64 f19 = V19; |
| 265 }; | 264 }; |
| 266 | 265 |
| 267 // Used to verify that various unsigned integer values can be encoded and | 266 // Used to verify that various unsigned integer values can be encoded and |
| 268 // decoded correctly. | 267 // decoded correctly. |
| 269 | 268 |
| 270 struct UnsignedNumberValues { | 269 struct UnsignedNumberValues { |
| 271 const uint8 V0 = 0; // Minimum = 0. | 270 const uint8 V0 = 0; // Minimum = 0. |
| 272 const uint8 V1 = 42; // An arbitrary valid value. | 271 const uint8 V1 = 42; // An arbitrary valid value. |
| 273 const uint8 V2 = 0xFF; // Maximum | 272 const uint8 V2 = 0xFF; // Maximum |
| 274 | 273 |
| 275 const uint16 V3 = 0; // ... | 274 const uint16 V3 = 0; // ... |
| 276 const uint16 V4 = 12345; | 275 const uint16 V4 = 12345; |
| 277 const uint16 V5 = 0xFFFF; | 276 const uint16 V5 = 0xFFFF; |
| 278 | 277 |
| 279 const uint32 V6 = 0; | 278 const uint32 V6 = 0; |
| 280 const uint32 V7 = 1234567890; | 279 const uint32 V7 = 1234567890; |
| 281 const uint32 V8 = 0xFFFFFFFF; | 280 const uint32 V8 = 0xFFFFFFFF; |
| 282 | 281 |
| 283 // The limits for JavaScript integers are +/- (2^53 - 1). | 282 // The limits for JavaScript integers are +/- (2^53 - 1). |
| 284 const uint64 V9 = 0; | 283 const uint64 V9 = 0; |
| 285 const uint64 V10 = 1234567890123456; | 284 const uint64 V10 = 1234567890123456; |
| 286 const uint64 V11 = 9007199254740991; // Number.MAX_SAFE_INTEGER | 285 const uint64 V11 = 9007199254740991; // Number.MAX_SAFE_INTEGER |
| 287 | 286 |
| 288 uint8 f0 = V0; | 287 uint8 f0 = V0; |
| 289 uint8 f1 = V1; | 288 uint8 f1 = V1; |
| 290 uint8 f2 = V2; | 289 uint8 f2 = V2; |
| 291 | 290 |
| 292 uint16 f3 = V3; | 291 uint16 f3 = V3; |
| 293 uint16 f4 = V4; | 292 uint16 f4 = V4; |
| 294 uint16 f5 = V5; | 293 uint16 f5 = V5; |
| 295 | 294 |
| 296 uint32 f6 = V6; | 295 uint32 f6 = V6; |
| 297 uint32 f7 = V7; | 296 uint32 f7 = V7; |
| 298 uint32 f8 = V8; | 297 uint32 f8 = V8; |
| 299 | 298 |
| 300 uint64 f9 = V9; | 299 uint64 f9 = V9; |
| 301 uint64 f10 = V10; | 300 uint64 f10 = V10; |
| 302 uint64 f11 = V11; | 301 uint64 f11 = V11; |
| 303 }; | 302 }; |
| 304 | 303 |
| 305 // Used to verify that various (packed) boolean array values can be encoded | 304 // Used to verify that various (packed) boolean array values can be encoded |
| 306 // and decoded correctly. | 305 // and decoded correctly. |
| 307 | 306 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 | 395 |
| 397 struct ContainsOther { | 396 struct ContainsOther { |
| 398 int32 other; | 397 int32 other; |
| 399 }; | 398 }; |
| 400 | 399 |
| 401 struct ContainsInterfaceRequest { | 400 struct ContainsInterfaceRequest { |
| 402 SomeInterface& req; | 401 SomeInterface& req; |
| 403 SomeInterface&? nullable_req; | 402 SomeInterface&? nullable_req; |
| 404 }; | 403 }; |
| 405 | 404 |
| 406 | |
| 407 struct DartKeywordStruct { | 405 struct DartKeywordStruct { |
| 408 enum Keywords { | 406 enum Keywords { |
| 409 AWAIT, | 407 AWAIT, |
| 410 IS, | 408 IS, |
| 411 RETHROW, | 409 RETHROW, |
| 412 }; | 410 }; |
| 413 Keywords await; | 411 Keywords await; |
| 414 Keywords is; | 412 Keywords is; |
| 415 Keywords rethrow; | 413 Keywords rethrow; |
| 416 }; | 414 }; |
| OLD | NEW |