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