OLD | NEW |
(Empty) | |
| 1 library async_test; |
| 2 |
| 3 import 'package:unittest/unittest.dart'; |
| 4 import 'package:unittest/html_config.dart'; |
| 5 |
| 6 import 'dart:async'; |
| 7 import 'dart:isolate'; |
| 8 import 'dart:html'; |
| 9 |
| 10 import 'async_oneshot.dart' as oneshot_test show main; |
| 11 import 'async_periodictimer.dart' as periodictimer_test show main; |
| 12 import 'async_cancellingisolate.dart' as cancelling_test show main; |
| 13 |
| 14 oneshot(message) => oneshot_test.main(message.first, message.last); |
| 15 periodicTimerIsolate(message) => |
| 16 periodictimer_test.main(message.first, message.last); |
| 17 cancellingIsolate(message) => cancelling_test.main(message.first, message.last); |
| 18 |
| 19 main() { |
| 20 useHtmlConfiguration(); |
| 21 |
| 22 test('one shot timer in pure isolate', () { |
| 23 var response = new ReceivePort(); |
| 24 var remote = Isolate.spawn(oneshot, |
| 25 [['START'], response.sendPort]); |
| 26 expect(remote.then((_) => response.first), completion('DONE')); |
| 27 }); |
| 28 |
| 29 test('periodic timer in pure isolate', () { |
| 30 var response = new ReceivePort(); |
| 31 var remote = Isolate.spawn(periodicTimerIsolate, |
| 32 [['START'], response.sendPort]); |
| 33 expect(remote.then((_) => response.first), completion('DONE')); |
| 34 }); |
| 35 |
| 36 test('cancellation in pure isolate', () { |
| 37 var response = new ReceivePort(); |
| 38 var remote = Isolate.spawn(cancellingIsolate, |
| 39 [['START'], response.sendPort]); |
| 40 expect(remote.then((_) => response.first), completion('DONE')); |
| 41 }); |
| 42 } |
OLD | NEW |