blob: feb40614c2cc0a2ae4275d380a11e50624092607 [file] [log] [blame]
<!doctype html>
<html>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/visibility.js"></script>
<script>
description('Checks that timers maintain their scheduled order while the page is invisible.');
var jsTestIsAsync = true;
var expectedIndices = [];
var indices = [];
function processTimer(index)
{
indices.push(index);
if (indices.length == expectedIndices.length) {
debug(indices);
shouldBeTrue('areArraysEqual(expectedIndices, indices)');
finishJSTest();
}
}
function runTest()
{
assert_equals(document.visibilityState, "hidden")
for (var i = 0; i < 100; i++) {
expectedIndices.push(i);
setTimeout(function(i) {
return function() {
processTimer(i);
}
}(i), 0);
}
}
</script>
<body onload="setMainWindowHidden(true).then(runTest)">
</body>
</html>