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

Unified Diff: tests/lib/async/timer_isolate_test.dart

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/async/schedule_microtask6_test.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
});
}
« no previous file with comments | « tests/lib/async/schedule_microtask6_test.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698