blob: 4b23a050341ad7b752b1166b7b729b48065885d6 [file] [log] [blame]
<!DOCTYPE html>
<head>
<title>Accessibility: slow document load</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test((t) => {
startTime = new Date();
gotLayoutCompleteBeforeOneSecond = false;
accessibilityController.addNotificationListener(
t.step_func((target, notification) => {
elapsedTime = new Date() - startTime;
if (notification == "LayoutComplete" && elapsedTime < 500) {
// See comment below if you're confused by this
gotLayoutCompleteBeforeOneSecond = true;
}
if (notification == "LoadComplete") {
accessibilityController.removeNotificationListener();
assert_greater_than_equal(elapsedTime, 500);
assert_true(gotLayoutCompleteBeforeOneSecond);
t.done();
}
}));
window.setTimeout(function() {
assert_unreached("Did not receive all accessibility notifications");
t.done();
}, 1500);
}, "This tests that accessibility events will be fired after the first layout, rather than only after the document loads.");
setTimeout(function() {
// Cause a lifecycle update
document.body.click();
}, 0);
</script>
<!-- This is a cgi script that waits 1 second before loading.
In practice, it seems to sometimes load after less time, so
that's why we use 500 ms as the threshold in the tests, above.
-->
<script src="slow-loading-script.cgi"></script>
</body>
</html>