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

Unified Diff: tests/isolate/illegal_msg_test.dart

Issue 36933002: All isolate tests running on vm (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: tests/isolate/illegal_msg_test.dart
diff --git a/tests/isolate/illegal_msg_test.dart b/tests/isolate/illegal_msg_test.dart
index ed29bd974724a70d424a8c6752fb1a1f4c97844f..8f8f3273353703bf90693b34555906353ccda020 100644
--- a/tests/isolate/illegal_msg_test.dart
+++ b/tests/isolate/illegal_msg_test.dart
@@ -9,29 +9,37 @@ import "package:async_helper/async_helper.dart";
funcFoo(x) => x + 2;
-echo() {
- port.receive((msg, reply) {
- reply.send("echoing ${msg(1)}}");
+echo(sendPort) {
+ var port = new ReceivePort();
+ sendPort.send(port.sendPort);
+ port.list((msg) {
Lasse Reichstein Nielsen 2013/10/24 10:26:01 This is a typo, so this code doesn't run either (w
+ sendPort.send("echoing ${msg(1)}}");
});
}
main() {
- var snd = spawnFunction(echo);
+ ReceivePort port = new ReceivePort();
+ Future spawn = Isolate.spawn(echo, port.sendPort);
var caught_exception = false;
- try {
- snd.send(funcFoo, port.toSendPort());
- } catch (e) {
- caught_exception = true;
- }
+ var stream = port.asBroadcastStream();
+ asyncStart();
+ stream.first.then((snd) {
+ asyncEnd();
floitsch 2013/10/23 13:33:24 Looks like the second part is never executed.
Lasse Reichstein Nielsen 2013/10/24 10:26:01 It never is if the test succeeds. The expected beh
+ try {
+ snd.send(funcFoo);
+ } catch (e) {
+ caught_exception = true;
+ }
- if (caught_exception) {
- port.close();
- } else {
- asyncStart();
- port.receive((msg, reply) {
- print("from worker ${msg}");
- asyncEnd();
- });
- }
- Expect.isTrue(caught_exception);
+ if (caught_exception) {
+ port.close();
+ } else {
+ asyncStart();
floitsch 2013/10/23 13:33:24 This would yield an error. you are not allowed to
Lasse Reichstein Nielsen 2013/10/24 10:26:01 Now overlaps.
+ stream.first.then((msg) {
+ print("from worker ${msg}");
+ asyncEnd();
+ });
+ }
+ Expect.isTrue(caught_exception);
+ });
}

Powered by Google App Engine
This is Rietveld 408576698