Chromium Code Reviews| Index: tests/isolate/timer_repeat_test.dart |
| diff --git a/tests/isolate/timer_repeat_test.dart b/tests/isolate/timer_repeat_test.dart |
| index f65b1e18f9e723e3c32215c99abbe74011181fcb..53a83ce1efa11c548b970b50e5696190783242c1 100644 |
| --- a/tests/isolate/timer_repeat_test.dart |
| +++ b/tests/isolate/timer_repeat_test.dart |
| @@ -5,39 +5,30 @@ |
| #library('timer_repeat_test'); |
| #import("dart:isolate"); |
| - |
| -class TimerRepeatTest { |
| - |
| - static const int _TIMEOUT = 500; |
| - static const int _ITERATIONS = 5; |
| - |
| - static void testRepeatTimer() { |
| - |
| - void timeoutHandler(Timer timer) { |
| - int endTime = (new Date.now()).millisecondsSinceEpoch; |
| - _iteration++; |
| - if (_iteration < _ITERATIONS) { |
| - _startTime = (new Date.now()).millisecondsSinceEpoch; |
| - } else { |
| - Expect.equals(_iteration, _ITERATIONS); |
| - timer.cancel(); |
| - } |
| +#import('../../pkg/unittest/unittest.dart'); |
| + |
| + const int _TIMEOUT = 500; |
| + const int _ITERATIONS = 5; |
| + |
| + Timer timer; |
| + int _startTime; |
| + int _iteration; |
| + |
| + void timeoutHandler(Timer timer) { |
| + int endTime = (new Date.now()).millisecondsSinceEpoch; |
| + _iteration++; |
| + if (_iteration < _ITERATIONS) { |
| + _startTime = (new Date.now()).millisecondsSinceEpoch; |
| + } else { |
| + expect(_iteration, _ITERATIONS); |
| + timer.cancel(); |
| } |
| - |
| - _iteration = 0; |
| - _startTime = (new Date.now()).millisecondsSinceEpoch; |
| - timer = new Timer.repeating(_TIMEOUT, timeoutHandler); |
| } |
| - static void testMain() { |
| - testRepeatTimer(); |
| - } |
| - |
| - static Timer timer; |
| - static int _startTime; |
| - static int _iteration; |
| -} |
| - |
| main() { |
| - TimerRepeatTest.testMain(); |
| + test("timer_repeat", () { |
| + _iteration = 0; |
| + _startTime = (new Date.now()).millisecondsSinceEpoch; |
| + timer = new Timer.repeating(_TIMEOUT, expectAsync1(timeoutHandler, count: _ITERATIONS)); |
|
Siggi Cherem (dart-lang)
2012/10/08 21:50:07
80 col
justinfagnani
2012/10/08 22:12:48
Done.
|
| + }); |
| } |