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

Unified Diff: tests/isolate/message2_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/mandel_isolate_test.dart ('k') | tests/isolate/message_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/message2_test.dart
diff --git a/tests/isolate/message2_test.dart b/tests/isolate/message2_test.dart
index 4c9f93e838c1e32319d848ad7df711ae295bf429..f31854a5859d038a6a5fdd92ce296efc04086d71 100644
--- a/tests/isolate/message2_test.dart
+++ b/tests/isolate/message2_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.
@@ -42,34 +42,29 @@ class MessageTest {
}
}
-class PingPongServer extends Isolate {
- PingPongServer() : super.heavy();
-
- void main() {
- this.port.receive((var message, SendPort replyTo) {
- if (message == -1) {
- this.port.close();
- } else {
- // Bounce the received object back so that the sender
- // can make sure that the object matches.
- replyTo.send(message, null);
- }
- });
- }
+void pingPong() {
+ port.receive((var message, SendPort replyTo) {
+ if (message == -1) {
+ port.close();
+ } else {
+ // Bounce the received object back so that the sender
+ // can make sure that the object matches.
+ replyTo.send(message, null);
+ }
+ });
}
main() {
test("map is equal after it is sent back and forth", () {
- new PingPongServer().spawn().then(expectAsync1((SendPort remote) {
- Map m = new Map();
- m[1] = "eins";
- m[2] = "deux";
- m[3] = "tre";
- m[4] = "four";
- remote.call(m).then(expectAsync1((var received) {
- MessageTest.mapEqualsDeep(m, received);
- remote.send(-1, null);
- }));
+ SendPort remote = spawnFunction(pingPong);
+ Map m = new Map();
+ m[1] = "eins";
+ m[2] = "deux";
+ m[3] = "tre";
+ m[4] = "four";
+ remote.call(m).then(expectAsync1((var received) {
+ MessageTest.mapEqualsDeep(m, received);
+ remote.send(-1, null);
}));
});
}
« no previous file with comments | « tests/isolate/mandel_isolate_test.dart ('k') | tests/isolate/message_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698