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

Unified Diff: tests/isolate/src/CrossIsolateMessageTest.dart

Issue 10153005: unittest step 3 and 4: remove TestFramework.dart, make test.dart use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/src/CountTest.dart ('k') | tests/isolate/src/Isolate2NegativeTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/src/CrossIsolateMessageTest.dart
diff --git a/tests/isolate/src/CrossIsolateMessageTest.dart b/tests/isolate/src/CrossIsolateMessageTest.dart
index 5b97533ff2c6c0b315f1a45be389e8ceb4308d21..f30d7b2d4bb7a25a1449bb5638fe8880ce1be680 100644
--- a/tests/isolate/src/CrossIsolateMessageTest.dart
+++ b/tests/isolate/src/CrossIsolateMessageTest.dart
@@ -7,7 +7,7 @@
#library('CrossIsolateMessageTest');
#import('dart:isolate');
-#import('TestFramework.dart');
+#import('../../../lib/unittest/unittest.dart');
class CrossIsolate1 extends Isolate {
CrossIsolate1() : super.heavy();
@@ -45,29 +45,26 @@ class CrossIsolate2 extends Isolate {
}
}
-test(TestExpectation expect) {
- // Create CrossIsolate1 and CrossIsolate2.
- expect.completes(new CrossIsolate1().spawn()).then((SendPort port1) {
- expect.completes(new CrossIsolate2().spawn()).then((SendPort port2) {
- // Create a new receive port and send it to isolate2.
- ReceivePort myPort = new ReceivePort();
- port2.call(myPort.toSendPort()).then(expect.runs1((msg) {
- Expect.equals("ready", msg[0]);
- // Send port of isolate2 to isolate1.
- port1.call(msg[1]).then(expect.runs1((msg) {
+main() {
+ test("share port, and send message cross isolates ", () {
+ // Create CrossIsolate1 and CrossIsolate2.
+ new CrossIsolate1().spawn().then(expectAsync1((SendPort port1) {
+ new CrossIsolate2().spawn().then(expectAsync1((SendPort port2) {
+ // Create a new receive port and send it to isolate2.
+ ReceivePort myPort = new ReceivePort();
+ port2.call(myPort.toSendPort()).then(expectAsync1((msg) {
Expect.equals("ready", msg[0]);
- myPort.receive(expect.runs2((msg, replyTo) {
- Expect.equals(499, msg);
- expect.succeeded();
- myPort.close();
+ // Send port of isolate2 to isolate1.
+ port1.call(msg[1]).then(expectAsync1((msg) {
+ Expect.equals("ready", msg[0]);
+ myPort.receive(expectAsync2((msg, replyTo) {
+ Expect.equals(499, msg);
+ myPort.close();
+ }));
+ msg[1].send(42, null);
}));
- msg[1].send(42, null);
}));
}));
- });
+ }));
});
}
-
-main() {
- runTests([test]);
-}
« no previous file with comments | « tests/isolate/src/CountTest.dart ('k') | tests/isolate/src/Isolate2NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698