| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Dart test program for testing serialization of messages. | 5 // Dart test program for testing serialization of messages. |
| 6 // VMOptions=--enable_type_checks --enable_asserts | 6 // VMOptions=--enable_type_checks --enable_asserts |
| 7 | 7 |
| 8 #library('MessageTest'); | 8 #library('MessageTest'); |
| 9 #import("dart:isolate"); | 9 #import("dart:isolate"); |
| 10 #import('../../pkg/unittest/unittest.dart'); | 10 #import('../../pkg/unittest/unittest.dart'); |
| 11 | 11 |
| 12 // --------------------------------------------------------------------------- | 12 // --------------------------------------------------------------------------- |
| 13 // Message passing test. | 13 // Message passing test. |
| 14 // --------------------------------------------------------------------------- | 14 // --------------------------------------------------------------------------- |
| 15 | 15 |
| 16 class MessageTest { | 16 class MessageTest { |
| 17 static final List list1 = const ["Hello", "World", "Hello", 0xfffffffffff]; | 17 static const List list1 = const ["Hello", "World", "Hello", 0xfffffffffff]; |
| 18 static final List list2 = const [null, list1, list1, list1, list1]; | 18 static const List list2 = const [null, list1, list1, list1, list1]; |
| 19 static final List list3 = const [list2, 2.0, true, false, 0xfffffffffff]; | 19 static const List list3 = const [list2, 2.0, true, false, 0xfffffffffff]; |
| 20 static final Map map1 = const { | 20 static const Map map1 = const { |
| 21 "a=1" : 1, "b=2" : 2, "c=3" : 3, | 21 "a=1" : 1, "b=2" : 2, "c=3" : 3, |
| 22 }; | 22 }; |
| 23 static final Map map2 = const { | 23 static const Map map2 = const { |
| 24 "list1" : list1, "list2" : list2, "list3" : list3, | 24 "list1" : list1, "list2" : list2, "list3" : list3, |
| 25 }; | 25 }; |
| 26 static final List list4 = const [map1, map2]; | 26 static const List list4 = const [map1, map2]; |
| 27 static final List elms = const [ | 27 static const List elms = const [ |
| 28 list1, list2, list3, list4, | 28 list1, list2, list3, list4, |
| 29 ]; | 29 ]; |
| 30 | 30 |
| 31 static void VerifyMap(Map expected, Map actual) { | 31 static void VerifyMap(Map expected, Map actual) { |
| 32 Expect.equals(true, expected is Map); | 32 Expect.equals(true, expected is Map); |
| 33 Expect.equals(true, actual is Map); | 33 Expect.equals(true, actual is Map); |
| 34 Expect.equals(expected.length, actual.length); | 34 Expect.equals(expected.length, actual.length); |
| 35 testForEachMap(key, value) { | 35 testForEachMap(key, value) { |
| 36 if (value is List) { | 36 if (value is List) { |
| 37 VerifyList(value, actual[key]); | 37 VerifyList(value, actual[key]); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Bigint literals are not canonicalized so do a == check. | 119 // Bigint literals are not canonicalized so do a == check. |
| 120 Expect.equals(true, replyObject[0][3] == replyObject[4][4]); | 120 Expect.equals(true, replyObject[0][3] == replyObject[4][4]); |
| 121 }); | 121 }); |
| 122 | 122 |
| 123 // Shutdown the MessageServer. | 123 // Shutdown the MessageServer. |
| 124 remote.call(-1).then(expectAsync1((int message) { | 124 remote.call(-1).then(expectAsync1((int message) { |
| 125 Expect.equals(MessageTest.elms.length + 1, message); | 125 Expect.equals(MessageTest.elms.length + 1, message); |
| 126 })); | 126 })); |
| 127 }); | 127 }); |
| 128 } | 128 } |
| OLD | NEW |