| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 library deferred_in_isolate2_test; | 5 library deferred_in_isolate2_test; |
| 6 | 6 |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| 11 import 'deferred_in_isolate2_lib.dart' deferred as lib; | 11 import 'deferred_in_isolate2_lib.dart' deferred as lib; |
| 12 | 12 |
| 13 loadDeferred(port) { | 13 loadDeferred(port) { |
| 14 lib.loadLibrary().then((_) { | 14 lib.loadLibrary().then((_) { |
| 15 port.send(lib.f()); | 15 port.send(lib.f()); |
| 16 }); | 16 }); |
| 17 } | 17 } |
| 18 | 18 |
| 19 main() { | 19 main() { |
| 20 test("Deferred loading in isolate", () { | 20 test("Deferred loading in isolate", () { |
| 21 ReceivePort port = new ReceivePort(); | 21 ReceivePort port = new ReceivePort(); |
| 22 port.first.then(expectAsync((msg) { | 22 port.first.then(expectAsync((msg) { |
| 23 expect(msg, equals("hi")); | 23 expect(msg, equals("hi")); |
| 24 })); | 24 })); |
| 25 Isolate.spawn(loadDeferred, port.sendPort); | 25 Isolate.spawn(loadDeferred, port.sendPort); |
| 26 }); | 26 }); |
| 27 } | 27 } |
| OLD | NEW |