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

Unified Diff: tests/isolate/illegal_msg_mirror_test.dart

Issue 70103014: Make isolate tests work on drt (and hopefully dartium). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Retain isolate_stress_test in status file Created 7 years, 1 month 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/illegal_msg_function_test.dart ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/illegal_msg_mirror_test.dart
diff --git a/tests/isolate/illegal_msg_mirror_test.dart b/tests/isolate/illegal_msg_mirror_test.dart
index eed29812dac2508ff2b3d2e24d01dfc5fe235c26..dcf80a01d6d480bd0925efbbe3e22a3103bc1953 100644
--- a/tests/isolate/illegal_msg_mirror_test.dart
+++ b/tests/isolate/illegal_msg_mirror_test.dart
@@ -4,11 +4,12 @@
library illegal_msg_mirror_test;
-import "package:expect/expect.dart";
import "dart:isolate";
import "dart:async" show Future;
-import "package:async_helper/async_helper.dart";
+@MirrorsUsed(targets: "Class")
import "dart:mirrors";
+import "package:unittest/unittest.dart";
+import "remote_unittest_helper.dart";
class Class {
method() {}
@@ -22,31 +23,30 @@ echo(sendPort) {
});
}
-main() {
- var methodMirror = reflectClass(Class).declarations[#method];
+void main([args, port]) {
+ if (testRemote(main, port)) return;
+ test("msg-mirror", () {
+ var methodMirror = reflectClass(Class).declarations[#method];
- ReceivePort port = new ReceivePort();
- Future spawn = Isolate.spawn(echo, port.sendPort);
- var caught_exception = false;
- var stream = port.asBroadcastStream();
- asyncStart();
- stream.first.then((snd) {
- try {
- snd.send(methodMirror);
- } catch (e) {
- caught_exception = true;
- }
+ ReceivePort port = new ReceivePort();
+ Future spawn = Isolate.spawn(echo, port.sendPort);
+ var caught_exception = false;
+ var stream = port.asBroadcastStream();
+ stream.first.then(expectAsync1((snd) {
+ try {
+ snd.send(methodMirror);
+ } catch (e) {
+ caught_exception = true;
+ }
- if (caught_exception) {
- port.close();
- } else {
- asyncStart();
- stream.first.then((msg) {
- print("from worker ${msg}");
- asyncEnd();
- });
- }
- Expect.isTrue(caught_exception);
- asyncEnd();
+ if (caught_exception) {
+ port.close();
+ } else {
+ stream.first.then(expectAsync1((msg) {
+ print("from worker ${msg}");
+ }));
+ }
+ expect(caught_exception, isTrue);
+ }));
});
}
« no previous file with comments | « tests/isolate/illegal_msg_function_test.dart ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698