Index: tests/lib/async/timer_isolate_test.dart |
diff --git a/tests/lib/async/timer_isolate_test.dart b/tests/lib/async/timer_isolate_test.dart |
index 80d2220d8230a600f5d87321df475b7d62bbac8a..31776c5f5edb009b82cdd31b7ffd5559ed05a0b0 100644 |
--- a/tests/lib/async/timer_isolate_test.dart |
+++ b/tests/lib/async/timer_isolate_test.dart |
@@ -10,11 +10,9 @@ import '../../../pkg/unittest/lib/unittest.dart'; |
const Duration TIMEOUT = const Duration(milliseconds: 100); |
-createTimer() { |
- port.receive((msg, replyTo) { |
- new Timer(TIMEOUT, () { |
- replyTo.send("timer_fired"); |
- }); |
+createTimer(replyTo) { |
+ new Timer(TIMEOUT, () { |
+ replyTo.send("timer_fired"); |
}); |
} |
@@ -23,15 +21,15 @@ main() { |
int startTime; |
int endTime; |
- port.receive(expectAsync2((msg, _) { |
+ ReceivePort port = new ReceivePort(); |
+ |
+ port.first.then(expectAsync1((msg) { |
expect("timer_fired", msg); |
int endTime = (new DateTime.now()).millisecondsSinceEpoch; |
expect(endTime - startTime, greaterThanOrEqualTo(TIMEOUT.inMilliseconds)); |
- port.close(); |
})); |
startTime = (new DateTime.now()).millisecondsSinceEpoch; |
- var sendPort = spawnFunction(createTimer); |
- sendPort.send("sendPort", port.toSendPort()); |
+ var remote = Isolate.spawn(createTimer, port.sendPort); |
}); |
} |