Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / timers-maintain-order-while-throttled.html
blob861cfc932f24a93f637b2dd2acba039dfd98c473
1 <!doctype html>
2 <html>
4 <script src="../../resources/js-test.js"></script>
6 <script>
7 description('Checks that timers maintain their scheduled order while the page is invisible.');
9 var jsTestIsAsync = true;
10 var expectedIndices = [];
11 var indices = [];
13 function processTimer(index)
15 indices.push(index);
16 if (indices.length == expectedIndices.length) {
17 debug(indices);
18 shouldBeTrue('areArraysEqual(expectedIndices, indices)');
19 finishJSTest();
23 function runTest()
25 if (window.testRunner)
26 testRunner.setPageVisibility('hidden');
28 for (var i = 0; i < 100; i++) {
29 expectedIndices.push(i);
30 setTimeout(function(i) {
31 return function() {
32 processTimer(i);
34 }(i), 0);
37 </script>
39 <body onload="runTest()">
40 </body>
41 </html>