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

Unified Diff: tests/isolate/request_reply_test.dart

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 5 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/isolate/nested_spawn_test.dart ('k') | tests/isolate/spawn_function_custom_class_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}));
});
}
« no previous file with comments | « tests/isolate/nested_spawn_test.dart ('k') | tests/isolate/spawn_function_custom_class_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698