OLD | NEW |
(Empty) | |
| 1 library async_spawnuri_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 // OtherScripts=async_oneshot.dart async_periodictimer.dart async_cancellingisol
ate.dart |
| 11 main() { |
| 12 useHtmlConfiguration(); |
| 13 |
| 14 test('one shot timer in pure isolate', () { |
| 15 var response = new ReceivePort(); |
| 16 var remote = Isolate.spawnUri(Uri.parse('async_oneshot.dart'), |
| 17 ['START'], response.sendPort); |
| 18 remote.catchError((x) => expect("Error in oneshot isolate", x)); |
| 19 expect(remote.then((_) => response.first), completion('DONE')); |
| 20 }); |
| 21 |
| 22 test('periodic timer in pure isolate', () { |
| 23 var response = new ReceivePort(); |
| 24 var remote = Isolate.spawnUri(Uri.parse('async_periodictimer.dart'), |
| 25 ['START'], response.sendPort); |
| 26 remote.catchError((x) => expect("Error in periodic timer isolate", x)); |
| 27 expect(remote.then((_) => response.first), completion('DONE')); |
| 28 }); |
| 29 |
| 30 test('cancellation in pure isolate', () { |
| 31 var response = new ReceivePort(); |
| 32 var remote = Isolate.spawnUri(Uri.parse('async_cancellingisolate.dart'), |
| 33 ['START'], response.sendPort); |
| 34 remote.catchError((x) => expect("Error in cancelling isolate", x)); |
| 35 expect(remote.then((_) => response.first), completion('DONE')); |
| 36 }); |
| 37 } |
OLD | NEW |