Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / accessibility / slow-document-load.html
blob4653f31a13e0e369fd2a06c96d59ca6b952a3e75
1 <!DOCTYPE html>
2 <head>
3 <title>Accessibility: slow document load</title>
4 <script src="/js-test-resources/js-test.js"></script>
5 </head>
6 <body>
8 <div id="console"></div>
10 <script>
11 description("This tests that accessibility events will be fired after the first layout, rather than only after the document loads.");
12 window.jsTestIsAsync = true;
14 if (window.testRunner && window.accessibilityController) {
15 testRunner.dumpAsText();
17 startTime = new Date();
18 gotLayoutCompleteBeforeOneSecond = false;
20 accessibilityController.addNotificationListener(function (target, notification) {
21 elapsedTime = new Date() - startTime;
22 if (notification == "LayoutComplete" && elapsedTime < 900) {
23 gotLayoutCompleteBeforeOneSecond = true;
26 if (notification == "LoadComplete") {
27 accessibilityController.removeNotificationListener();
28 shouldBeGreaterThanOrEqual("elapsedTime", "900");
29 shouldBeTrue("gotLayoutCompleteBeforeOneSecond");
30 finishJSTest();
32 });
35 setTimeout(function() {
36 // Cause an incremental layout.
37 document.body.offsetTop;
38 }, 10);
39 </script>
41 <!-- This is a cgi script that waits 1 second before loading.
42 In practice, it seems to sometimes load after slightly less
43 time, like 996 ms, so that's why we use 900 ms as the threshold
44 in the tests, above.
45 -->
46 <script src="slow-loading-script.cgi"></script>
48 </body>
49 </html>