| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import "dart:platform" as platform; |
| 6 |
| 7 import "dart:isolate"; |
| 8 import "package:unittest/unittest.dart"; |
| 9 |
| 10 main() { |
| 11 var sendPort = spawnFunction(f); |
| 12 expect(sendPort.call("platform.executable"), completion(platform.executable)); |
| 13 if (platform.script != null) { |
| 14 expect(sendPort.call("platform.script").then((s) => Uri.parse(s).path), |
| 15 completion(endsWith('tests/lib/platform/isolate_test.dart'))); |
| 16 } |
| 17 expect(sendPort.call("platform.packageRoot"), |
| 18 completion(platform.packageRoot)); |
| 19 expect(sendPort.call("platform.executableArguments"), |
| 20 completion(platform.executableArguments)); |
| 21 } |
| 22 |
| 23 void f() { |
| 24 int count = 0; |
| 25 port.receive((msg, reply) { |
| 26 if (msg == "platform.executable") { |
| 27 reply.send(platform.executable); |
| 28 } |
| 29 if (msg == "platform.script") { |
| 30 reply.send(platform.script); |
| 31 } |
| 32 if (msg == "platform.packageRoot") { |
| 33 reply.send(platform.packageRoot); |
| 34 } |
| 35 if (msg == "platform.executableArguments") { |
| 36 reply.send(platform.executableArguments); |
| 37 } |
| 38 count++; |
| 39 if (count == 4) { |
| 40 port.close(); |
| 41 } |
| 42 }); |
| 43 } |
| OLD | NEW |