Index: tests/isolate/request_reply_test.dart |
diff --git a/tests/isolate/request_reply_test.dart b/tests/isolate/request_reply_test.dart |
index b093ba085fd30fbf2acdc194dd618cd0287ba8fd..07f2b5299ef947fe7caac125654ae2d22fa02b6e 100644 |
--- a/tests/isolate/request_reply_test.dart |
+++ b/tests/isolate/request_reply_test.dart |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
@@ -7,36 +7,28 @@ |
#import("dart:isolate"); |
#import('../../lib/unittest/unittest.dart'); |
-class TestIsolate extends Isolate { |
- |
- TestIsolate() : super(); |
- |
- void main() { |
- this.port.receive((message, SendPort replyTo) { |
- replyTo.send(message + 87); |
- this.port.close(); |
- }); |
- } |
- |
+void entry() { |
+ port.receive((message, SendPort replyTo) { |
+ replyTo.send(message + 87); |
+ port.close(); |
+ }); |
} |
void main() { |
test("call", () { |
- new TestIsolate().spawn().then(expectAsync1((SendPort port) { |
- port.call(42).then(expectAsync1((message) { |
- Expect.equals(42 + 87, message); |
- })); |
+ SendPort port = spawnFunction(entry); |
+ port.call(42).then(expectAsync1((message) { |
+ Expect.equals(42 + 87, message); |
})); |
}); |
test("send", () { |
- new TestIsolate().spawn().then(expectAsync1((SendPort port) { |
- ReceivePort reply = new ReceivePort(); |
- port.send(99, reply.toSendPort()); |
- reply.receive(expectAsync2((message, replyTo) { |
- Expect.equals(99 + 87, message); |
- reply.close(); |
- })); |
+ SendPort port = spawnFunction(entry); |
+ ReceivePort reply = new ReceivePort(); |
+ port.send(99, reply.toSendPort()); |
+ reply.receive(expectAsync2((message, replyTo) { |
+ Expect.equals(99 + 87, message); |
+ reply.close(); |
})); |
}); |
} |