| 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 import 'dart:isolate'; | 5 import 'dart:isolate'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 class Expect { | 8 class Expect { |
| 9 static void equals(x, y) { | 9 static void equals(x, y) { |
| 10 if (x != y) throw new ArgumentError('not equal'); | 10 if (x != y) throw new ArgumentError('not equal'); |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 } | 1306 } |
| 1307 }); | 1307 }); |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 message_test_main() { | 1310 message_test_main() { |
| 1311 test("send objects and receive them back", () { | 1311 test("send objects and receive them back", () { |
| 1312 SendPort remote = spawnFunction(pingPong); | 1312 SendPort remote = spawnFunction(pingPong); |
| 1313 // Send objects and receive them back. | 1313 // Send objects and receive them back. |
| 1314 for (int i = 0; i < MessageTest.elms.length; i++) { | 1314 for (int i = 0; i < MessageTest.elms.length; i++) { |
| 1315 var sentObject = MessageTest.elms[i]; | 1315 var sentObject = MessageTest.elms[i]; |
| 1316 // TODO(asiva): remove this local var idx once thew new for-loop | |
| 1317 // semantics for closures is implemented. | |
| 1318 var idx = i; | |
| 1319 remote.call(sentObject).then(expectAsync1((var receivedObject) { | 1316 remote.call(sentObject).then(expectAsync1((var receivedObject) { |
| 1320 MessageTest.VerifyObject(idx, receivedObject); | 1317 MessageTest.VerifyObject(i, receivedObject); |
| 1321 })); | 1318 })); |
| 1322 } | 1319 } |
| 1323 | 1320 |
| 1324 // Send recursive objects and receive them back. | 1321 // Send recursive objects and receive them back. |
| 1325 List local_list1 = ["Hello", "World", "Hello", 0xffffffffff]; | 1322 List local_list1 = ["Hello", "World", "Hello", 0xffffffffff]; |
| 1326 List local_list2 = [null, local_list1, local_list1 ]; | 1323 List local_list2 = [null, local_list1, local_list1 ]; |
| 1327 List local_list3 = [local_list2, 2.0, true, false, 0xffffffffff]; | 1324 List local_list3 = [local_list2, 2.0, true, false, 0xffffffffff]; |
| 1328 List sendObject = new List(5); | 1325 List sendObject = new List(5); |
| 1329 sendObject[0] = local_list1; | 1326 sendObject[0] = local_list1; |
| 1330 sendObject[1] = sendObject; | 1327 sendObject[1] = sendObject; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 void processLines() { | 1553 void processLines() { |
| 1557 port.receive((message, SendPort replyTo) { | 1554 port.receive((message, SendPort replyTo) { |
| 1558 if (message == TERMINATION_MESSAGE) { | 1555 if (message == TERMINATION_MESSAGE) { |
| 1559 assert(replyTo == null); | 1556 assert(replyTo == null); |
| 1560 port.close(); | 1557 port.close(); |
| 1561 } else { | 1558 } else { |
| 1562 replyTo.send(processLine(message), null); | 1559 replyTo.send(processLine(message), null); |
| 1563 } | 1560 } |
| 1564 }); | 1561 }); |
| 1565 } | 1562 } |
| OLD | NEW |