mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 14:27:18 +00:00
2dcd56ef43
There are far too many files here to review everyone carefully. Spot checking most of the diffs look good as test code is generally written with less care than application code so lots of ugly formatting get through. If people notice files where the automated formatting bothers them feel free to comment indicating file names and I'll move spaces within comments to make the formatting cleaner and use comments to force block formatting as I have done for other case where formatting looked bad. BUG= R=efortuna@google.com Review-Url: https://codereview.chromium.org/2771453003 .
24 lines
577 B
Dart
24 lines
577 B
Dart
library async_periodictimer;
|
|
|
|
import 'dart:async';
|
|
import 'package:unittest/unittest.dart';
|
|
|
|
main(message, replyTo) {
|
|
var command = message.first;
|
|
expect(command, 'START');
|
|
int counter = 0;
|
|
new Timer.periodic(const Duration(milliseconds: 10), (timer) {
|
|
if (counter == 3) {
|
|
counter = 1024;
|
|
timer.cancel();
|
|
// Wait some more time to be sure callback won't be invoked any
|
|
// more.
|
|
new Timer(const Duration(milliseconds: 30), () {
|
|
replyTo.send('DONE');
|
|
});
|
|
return;
|
|
}
|
|
assert(counter < 3);
|
|
counter++;
|
|
});
|
|
}
|