| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2015, 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:isolate"; |
| 6 import "package:unittest/unittest.dart"; |
| 7 |
| 8 Uri toDartDataUri(String source) { |
| 9 return Uri.parse("data:application/dart;charset=utf-8," |
| 10 "${Uri.encodeComponent(source)}"); |
| 11 } |
| 12 |
| 13 main() { |
| 14 test('Simple response', () { |
| 15 String source = """ |
| 16 import "dart:isolate"; |
| 17 main(List args, SendPort replyPort) { |
| 18 print('Child running'); |
| 19 replyPort.send(42); |
| 20 } |
| 21 """; |
| 22 |
| 23 RawReceivePort receivePort; |
| 24 receivePort = new RawReceivePort(expectAsync((int message) { |
| 25 expect(message, equals(42)); |
| 26 receivePort.close(); |
| 27 })); |
| 28 Isolate.spawnUri(toDartDataUri(source), [], receivePort.sendPort); |
| 29 }); |
| 30 } |
| OLD | NEW |