| OLD | NEW |
| 1 library async_test; | 1 library async_test; |
| 2 | 2 |
| 3 import '../../pkg/unittest/lib/unittest.dart'; | 3 import '../../pkg/unittest/lib/unittest.dart'; |
| 4 import '../../pkg/unittest/lib/html_config.dart'; | 4 import '../../pkg/unittest/lib/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 oneshotTimerIsolate() { | 10 oneshotTimerIsolate() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 int counter = 0; | 22 int counter = 0; |
| 23 new Timer.periodic(const Duration(milliseconds: 10), (timer) { | 23 new Timer.periodic(const Duration(milliseconds: 10), (timer) { |
| 24 if (counter == 3) { | 24 if (counter == 3) { |
| 25 counter = 1024; | 25 counter = 1024; |
| 26 timer.cancel(); | 26 timer.cancel(); |
| 27 // Wait some more time to be sure callback won't be invoked any | 27 // Wait some more time to be sure callback won't be invoked any |
| 28 // more. | 28 // more. |
| 29 new Timer(const Duration(milliseconds: 30), () { | 29 new Timer(const Duration(milliseconds: 30), () { |
| 30 replyTo.send('DONE'); | 30 replyTo.send('DONE'); |
| 31 }); | 31 }); |
| 32 return; |
| 32 } | 33 } |
| 33 assert(counter < 3); | 34 assert(counter < 3); |
| 34 counter++; | 35 counter++; |
| 35 }); | 36 }); |
| 36 }); | 37 }); |
| 37 } | 38 } |
| 38 | 39 |
| 39 cancellingIsolate() { | 40 cancellingIsolate() { |
| 40 port.receive((msg, replyTo) { | 41 port.receive((msg, replyTo) { |
| 41 expect(msg, 'START'); | 42 expect(msg, 'START'); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 68 }); | 69 }); |
| 69 test('periodic timer in pure isolate', () { | 70 test('periodic timer in pure isolate', () { |
| 70 expect(spawnFunction(periodicTimerIsolate).call('START'), | 71 expect(spawnFunction(periodicTimerIsolate).call('START'), |
| 71 completion('DONE')); | 72 completion('DONE')); |
| 72 }); | 73 }); |
| 73 test('cancellation in pure isolate', () { | 74 test('cancellation in pure isolate', () { |
| 74 expect(spawnFunction(cancellingIsolate).call('START'), | 75 expect(spawnFunction(cancellingIsolate).call('START'), |
| 75 completion('DONE')); | 76 completion('DONE')); |
| 76 }); | 77 }); |
| 77 } | 78 } |
| OLD | NEW |