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

Unified Diff: tests/isolate/isolate_complex_messages_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/isolate3_negative_test.dart ('k') | tests/isolate/isolate_import_negative_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/isolate_complex_messages_test.dart
diff --git a/tests/isolate/isolate_complex_messages_test.dart b/tests/isolate/isolate_complex_messages_test.dart
index f78b74e975afd24377ffe830d415ea822358f76f..c23fe6c5de01d79c1e7d727fb285bc28067f3097 100644
--- a/tests/isolate/isolate_complex_messages_test.dart
+++ b/tests/isolate/isolate_complex_messages_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.
@@ -11,69 +11,63 @@
main() {
test("complex messages are serialized correctly", () {
- new LogIsolate().spawn().then(expectAsync1((SendPort remote) {
-
- remote.send(1, null);
- remote.send("Hello", null);
- remote.send("World", null);
- remote.send(const [null, 1, 2, 3, 4], null);
- remote.send(const [1, 2.0, true, false, 0xffffffffff], null);
- remote.send(const ["Hello", "World", 0xffffffffff], null);
- // Shutdown the LogRunner.
- remote.call(-1).then(expectAsync1((int message) {
- Expect.equals(6, message);
- }));
+ SendPort remote = spawnFunction(logMessages);
+ remote.send(1, null);
+ remote.send("Hello", null);
+ remote.send("World", null);
+ remote.send(const [null, 1, 2, 3, 4], null);
+ remote.send(const [1, 2.0, true, false, 0xffffffffff], null);
+ remote.send(const ["Hello", "World", 0xffffffffff], null);
+ // Shutdown the LogRunner.
+ remote.call(-1).then(expectAsync1((int message) {
+ Expect.equals(6, message);
}));
});
}
-class LogIsolate extends Isolate {
- LogIsolate() : super() { }
-
- void main() {
- int count = 0;
+void logMessages() {
+ int count = 0;
- this.port.receive((var message, SendPort replyTo) {
- if (message == -1) {
- this.port.close();
- replyTo.send(count, null);
- } else {
- switch (count) {
- case 0:
- Expect.equals(1, message);
- break;
- case 1:
- Expect.equals("Hello", message);
- break;
- case 2:
- Expect.equals("World", message);
- break;
- case 3:
- Expect.equals(5, message.length);
- Expect.equals(null, message[0]);
- Expect.equals(1, message[1]);
- Expect.equals(2, message[2]);
- Expect.equals(3, message[3]);
- Expect.equals(4, message[4]);
- break;
- case 4:
- Expect.equals(5, message.length);
- Expect.equals(1, message[0]);
- Expect.equals(2.0, message[1]);
- Expect.equals(true, message[2]);
- Expect.equals(false, message[3]);
- Expect.equals(0xffffffffff, message[4]);
- break;
- case 5:
- Expect.equals(3, message.length);
- Expect.equals("Hello", message[0]);
- Expect.equals("World", message[1]);
- Expect.equals(0xffffffffff, message[2]);
- break;
- }
- count++;
+ port.receive((var message, SendPort replyTo) {
+ if (message == -1) {
+ port.close();
+ replyTo.send(count, null);
+ } else {
+ switch (count) {
+ case 0:
+ Expect.equals(1, message);
+ break;
+ case 1:
+ Expect.equals("Hello", message);
+ break;
+ case 2:
+ Expect.equals("World", message);
+ break;
+ case 3:
+ Expect.equals(5, message.length);
+ Expect.equals(null, message[0]);
+ Expect.equals(1, message[1]);
+ Expect.equals(2, message[2]);
+ Expect.equals(3, message[3]);
+ Expect.equals(4, message[4]);
+ break;
+ case 4:
+ Expect.equals(5, message.length);
+ Expect.equals(1, message[0]);
+ Expect.equals(2.0, message[1]);
+ Expect.equals(true, message[2]);
+ Expect.equals(false, message[3]);
+ Expect.equals(0xffffffffff, message[4]);
+ break;
+ case 5:
+ Expect.equals(3, message.length);
+ Expect.equals("Hello", message[0]);
+ Expect.equals("World", message[1]);
+ Expect.equals(0xffffffffff, message[2]);
+ break;
}
- });
- }
+ count++;
+ }
+ });
}
« no previous file with comments | « tests/isolate/isolate3_negative_test.dart ('k') | tests/isolate/isolate_import_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698