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

Unified Diff: tests/standalone/package/package_isolate_test.dart

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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
« no previous file with comments | « tests/standalone/issue14236_test.dart ('k') | tests/standalone/package/sibling_isolate.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/package/package_isolate_test.dart
diff --git a/tests/standalone/package/package_isolate_test.dart b/tests/standalone/package/package_isolate_test.dart
index f826c5fdca1b50be9095951b808d01c12e65a237..f3a6bec467c73620596dc6c195d3ba8684ff598c 100644
--- a/tests/standalone/package/package_isolate_test.dart
+++ b/tests/standalone/package/package_isolate_test.dart
@@ -7,44 +7,44 @@
library package_isolate_test;
import 'package:shared.dart' as shared;
import 'dart:isolate';
-import '../../../pkg/unittest/lib/unittest.dart';
+import '../../../pkg/async_helper/lib/async_helper.dart';
+import '../../../pkg/expect/lib/expect.dart';
expectResponse() {
+ asyncStart();
var receivePort = new ReceivePort();
- receivePort.receive(expectAsync2((msg, r) {
- expect('isolate', msg);
- expect('main', shared.output);
- receivePort.close();
- }));
+ receivePort.first.then((msg) {
+ Expect.equals('isolate', msg);
+ Expect.equals('main', shared.output);
+ asyncEnd();
+ });
return receivePort;
}
void main() {
- test("package in spawnFunction()", () {
- var replyPort = expectResponse().toSendPort();
+ {
+ var replyPort = expectResponse().sendPort;
shared.output = 'main';
- var sendPort = spawnFunction(isolate_main);
- sendPort.send("sendPort", replyPort);
- });
-
- test("package in spawnUri() of sibling file", () {
- var replyPort = expectResponse().toSendPort();
+ Isolate.spawn(isolate_main, replyPort);
+ }
+
+ {
+ // Package in spawnUri() of sibling file.
+ var replyPort = expectResponse().sendPort;
shared.output = 'main';
- var sendPort = spawnUri('sibling_isolate.dart');
- sendPort.send('sendPort', replyPort);
- });
+ Isolate.spawnUri(Uri.parse('sibling_isolate.dart'), [], replyPort);
+ }
- test("package in spawnUri() of file in folder", () {
- var replyPort = expectResponse().toSendPort();
+ {
+ // Package in spawnUri() of file in folder.
+ var replyPort = expectResponse().sendPort;
shared.output = 'main';
- var sendPort = spawnUri('test_folder/folder_isolate.dart');
- sendPort.send('sendPort', replyPort);
- });
+ Isolate.spawnUri(Uri.parse('test_folder/folder_isolate.dart'),
+ [], replyPort);
+ }
}
-void isolate_main() {
+void isolate_main(SendPort replyTo) {
shared.output = 'isolate';
- port.receive((msg, replyTo) {
- replyTo.send(shared.output);
- });
+ replyTo.send(shared.output);
}
« no previous file with comments | « tests/standalone/issue14236_test.dart ('k') | tests/standalone/package/sibling_isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698