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