OLD | NEW |
1 library async_cancellingisolate; | 1 library async_cancellingisolate; |
2 | 2 |
3 import 'dart:async'; | 3 import 'dart:async'; |
4 import 'package:unittest/unittest.dart'; | 4 import 'package:unittest/unittest.dart'; |
5 | 5 |
6 main(message, replyTo) { | 6 main(message, replyTo) { |
7 var command = message.first; | 7 var command = message.first; |
8 expect(command, 'START'); | 8 expect(command, 'START'); |
9 var shot = false; | 9 var shot = false; |
10 var oneshot; | 10 var oneshot; |
(...skipping 10 matching lines...) Expand all Loading... |
21 replyTo.send('DONE'); | 21 replyTo.send('DONE'); |
22 }); | 22 }); |
23 }); | 23 }); |
24 // We launch the oneshot timer after the periodic timer. Otherwise a | 24 // We launch the oneshot timer after the periodic timer. Otherwise a |
25 // (very long) context switch could make this test flaky: assume the | 25 // (very long) context switch could make this test flaky: assume the |
26 // oneshot timer is created first and then there is a 30ms context switch. | 26 // oneshot timer is created first and then there is a 30ms context switch. |
27 // when the periodic timer is scheduled it would execute after the oneshot. | 27 // when the periodic timer is scheduled it would execute after the oneshot. |
28 oneshot = new Timer(const Duration(milliseconds: 30), () { | 28 oneshot = new Timer(const Duration(milliseconds: 30), () { |
29 fail('Should never be invoked'); | 29 fail('Should never be invoked'); |
30 }); | 30 }); |
31 } | 31 } |
OLD | NEW |