| OLD | NEW |
| (Empty) |
| 1 #import('../../../../../dart/client/testing/unittest/unittest.dart'); | |
| 2 #import('dart:dom'); | |
| 3 | |
| 4 main() { | |
| 5 forLayoutTests(); | |
| 6 asyncTest('Window.setTimeout', 1, () { | |
| 7 window.setTimeout(callbackDone, 10); | |
| 8 }); | |
| 9 asyncTest('Window.setInterval', 1, () { | |
| 10 int counter = 0; | |
| 11 int id = null; | |
| 12 id = window.setInterval(() { | |
| 13 if (counter == 3) { | |
| 14 counter = 1024; | |
| 15 window.clearInterval(id); | |
| 16 // Wait some more time to be sure callback won't be invoked any more. | |
| 17 window.setTimeout(callbackDone, 50); | |
| 18 return; | |
| 19 } | |
| 20 // As callback should have been cleared on 4th invocation, counter | |
| 21 // should never be greater than 3. | |
| 22 assert(counter < 3); | |
| 23 counter++; | |
| 24 }, 10); | |
| 25 }); | |
| 26 } | |
| OLD | NEW |