OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 import "dart:isolate"; | 7 import "dart:isolate"; |
8 | 8 |
9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 30 matching lines...) Expand all Loading... |
41 "Platform.executableArguments": Platform.executableArguments}); | 41 "Platform.executableArguments": Platform.executableArguments}); |
42 } | 42 } |
43 | 43 |
44 testIsolate() { | 44 testIsolate() { |
45 asyncStart(); | 45 asyncStart(); |
46 ReceivePort port = new ReceivePort(); | 46 ReceivePort port = new ReceivePort(); |
47 var remote = Isolate.spawn(f, port.sendPort); | 47 var remote = Isolate.spawn(f, port.sendPort); |
48 port.first.then((results) { | 48 port.first.then((results) { |
49 Expect.equals(Platform.executable, results["Platform.executable"]); | 49 Expect.equals(Platform.executable, results["Platform.executable"]); |
50 | 50 |
51 Uri uri = Uri.file(results["Platform.script"]); | 51 Uri uri = new Uri.file(results["Platform.script"]); |
52 // SpawnFunction retains the script url of the parent which in this | 52 // SpawnFunction retains the script url of the parent which in this |
53 // case was a relative path. | 53 // case was a relative path. |
54 Expect.equals("", uri.scheme); | 54 Expect.equals("file", uri.scheme); |
55 Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart')); | 55 Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart')); |
56 Expect.equals(Platform.packageRoot, results["Platform.packageRoot"]); | 56 Expect.equals(Platform.packageRoot, results["Platform.packageRoot"]); |
57 Expect.listEquals(Platform.executableArguments, | 57 Expect.listEquals(Platform.executableArguments, |
58 results["Platform.executableArguments"]); | 58 results["Platform.executableArguments"]); |
59 asyncEnd(); | 59 asyncEnd(); |
60 }); | 60 }); |
61 } | 61 } |
62 | 62 |
63 main() { | 63 main() { |
64 test(); | 64 test(); |
65 testIsolate(); | 65 testIsolate(); |
66 } | 66 } |
OLD | NEW |