| OLD | NEW | 
|   1 library AsyncWindowTest; |   1 library AsyncWindowTest; | 
|   2 import '../../pkg/unittest/lib/unittest.dart'; |   2 import '../../pkg/unittest/lib/unittest.dart'; | 
|   3 import '../../pkg/unittest/lib/html_config.dart'; |   3 import '../../pkg/unittest/lib/html_config.dart'; | 
|   4 import 'dart:html'; |   4 import 'dart:html'; | 
 |   5 import 'dart:async'; | 
|   5  |   6  | 
|   6 main() { |   7 main() { | 
|   7   useHtmlConfiguration(); |   8   useHtmlConfiguration(); | 
|   8   test('Window.setTimeout', () { |   9   test('Timer', () { | 
|   9     window.setTimeout(expectAsync0((){}), 10); |  10     new Timer(const Duration(milliseconds: 10), expectAsync0((){})); | 
|  10   }); |  11   }); | 
|  11   test('Window.setInterval', () { |  12   test('Timer.repeating', () { | 
|  12     int counter = 0; |  13     int counter = 0; | 
|  13     int id = null; |  14     int id = null; | 
|  14     id = window.setInterval(expectAsyncUntil0( |  15     new Timer.repeating(const Duration(milliseconds: 10), | 
|  15       () { |  16         expectAsyncUntil1( | 
|  16         if (counter == 3) { |  17         (timer) { | 
|  17           counter = 1024; |  18           if (counter == 3) { | 
|  18           window.clearInterval(id); |  19             counter = 1024; | 
|  19           // Wait some more time to be sure callback won't be invoked any more. |  20             timer.cancel(); | 
|  20           window.setTimeout(expectAsync0((){}), 50); |  21             // Wait some more time to be sure callback won't be invoked any | 
|  21           return; |  22             // more. | 
|  22         } |  23             new Timer(const Duration(milliseconds: 50), expectAsync0((){})); | 
|  23         // As callback should have been cleared on 4th invocation, counter |  24             return; | 
|  24         // should never be greater than 3. |  25           } | 
|  25         assert(counter < 3); |  26           // As callback should have been cleared on 4th invocation, counter | 
|  26         counter++; |  27           // should never be greater than 3. | 
|  27       }, |  28           assert(counter < 3); | 
|  28       () => counter == 3), 10); |  29           counter++; | 
 |  30         }, | 
 |  31         () => counter == 3)); | 
|  29   }); |  32   }); | 
|  30 } |  33 } | 
| OLD | NEW |