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

Unified Diff: tests/standalone/io/platform_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/io/pipe_server_test.dart ('k') | tests/standalone/io/process_shell_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/platform_test.dart
diff --git a/tests/standalone/io/platform_test.dart b/tests/standalone/io/platform_test.dart
index 2a96c3588f5c080a5a4c94b70750bb5dc29de8bd..7e9f77cc348b564f82e18adbb80bf5421fe5a378 100644
--- a/tests/standalone/io/platform_test.dart
+++ b/tests/standalone/io/platform_test.dart
@@ -34,44 +34,29 @@ test() {
(arg) => arg.contains(Platform.packageRoot)));
}
-void f() {
- port.receive((msg, reply) {
- if (msg == "Platform.executable") {
- reply.send(Platform.executable);
- }
- if (msg == "Platform.script") {
- reply.send(Platform.script);
- }
- if (msg == "Platform.packageRoot") {
- reply.send(Platform.packageRoot);
- }
- if (msg == "Platform.executableArguments") {
- reply.send(Platform.executableArguments);
- }
- if (msg == "close") {
- reply.send("closed");
- port.close();
- }
- });
+void f(reply) {
+ reply.send({"Platform.executable": Platform.executable,
+ "Platform.script": Platform.script,
+ "Platform.packageRoot": Platform.packageRoot,
+ "Platform.executableArguments": Platform.executableArguments});
}
testIsolate() {
asyncStart();
- var sendPort = spawnFunction(f);
- Future.wait([sendPort.call("Platform.executable"),
- sendPort.call("Platform.script"),
- sendPort.call("Platform.packageRoot"),
- sendPort.call("Platform.executableArguments")])
- .then((results) {
- Expect.equals(Platform.executable, results[0]);
- Uri uri = Uri.parse(results[1]);
+ ReceivePort port = new ReceivePort();
+ var remote = Isolate.spawn(f, port.sendPort);
+ port.first.then((results) {
+ Expect.equals(Platform.executable, results["Platform.executable"]);
+
+ Uri uri = Uri.parse(results["Platform.script"]);
// SpawnFunction retains the script url of the parent which in this
// case was a relative path.
Expect.equals("", uri.scheme);
Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart'));
- Expect.equals(Platform.packageRoot, results[2]);
- Expect.listEquals(Platform.executableArguments, results[3]);
- sendPort.call("close").then((_) => asyncEnd());
+ Expect.equals(Platform.packageRoot, results["Platform.packageRoot"]);
+ Expect.listEquals(Platform.executableArguments,
+ results["Platform.executableArguments"]);
+ asyncEnd();
});
}
« no previous file with comments | « tests/standalone/io/pipe_server_test.dart ('k') | tests/standalone/io/process_shell_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698