AX: fix accessibility/loading-iframe-updates-axtree.html test for mac
[WebKit-https.git] / LayoutTests / accessibility / loading-iframe-updates-axtree.html
1 <html>
2 <head>
3 <script src="../resources/js-test-pre.js"></script>
4
5   <script>
6     if (window.testRunner)
7         testRunner.waitUntilDone();
8
9     function runTest()
10     {
11         description("This tests that if an iframe loads new content after its accessibility object has already been accessed, the iframe accessibility object's descendants are the new scroll area and web area, not the old deleted ones.");
12
13         if (window.accessibilityController) {
14             window.iframe = accessibilityController.accessibleElementById('iframeContainer');
15             window.scrollarea = iframe.childAtIndex(0);
16             window.subwebarea = scrollarea.childAtIndex(0);
17         }
18
19         window.iframeElement = document.getElementById("iframe");
20         iframeElement.addEventListener("load", function() {
21             if (window.accessibilityController) {
22                 window.newIframe = accessibilityController.accessibleElementById('iframeContainer');
23                 window.newScrollarea = newIframe.childAtIndex(0);
24                 window.newSubwebarea = newScrollarea.childAtIndex(0);
25
26                 // for WK1, the scroll area does not change
27                 var iframeEqual = iframe.isEqual(newIframe);
28                 var scrollareaEqual = scrollarea.isEqual(newScrollarea);
29                 var subwebareaEqual = subwebarea.isEqual(newSubwebarea);
30                 debug("iframe.isEqual(newIframe): " + iframeEqual);
31                 debug("scrollarea.isEqual(newScrollarea): " + scrollareaEqual);
32                 debug("subwebarea.isEqual(newSubwebarea): " + subwebareaEqual);
33                 shouldBeTrue("newSubwebarea.childrenCount > 0");
34             }
35
36             debug('<br /><span class="pass">TEST COMPLETE</span>');
37             if (window.testRunner)
38                 testRunner.notifyDone();
39         }, false);
40
41         // Load content into the iframe. This will trigger the event
42         // handler above, which will check that the accessibility tree
43         // was updated with new content.
44         window.iframeElement.src = "data:text/html,<body><button>Click me</button></body>";
45
46     }
47
48     window.addEventListener('load', function() {
49         setTimeout(runTest, 10);
50     }, false);
51
52   </script>
53 </head>
54 <body>
55
56 <p>Before</p>
57
58 <div id="iframeContainer">
59 <iframe id="iframe"></iframe>
60 </div>
61
62 <p>After</p>
63
64 <p>End of test</p>
65
66 <p id="description"></p>
67 <div id="console"></div>
68
69 </body>
70 </html>