d840507c3d662f625e2cf3ebd3e42ce0e7a2edb6
[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('iframe');
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('iframe');
23                 window.newScrollarea = newIframe.childAtIndex(0);
24                 window.newSubwebarea = newScrollarea.childAtIndex(0);
25
26                 shouldBeTrue("iframe.isEqual(newIframe)");
27                 shouldBeFalse("scrollarea.isEqual(newScrollarea)");
28                 shouldBeFalse("subwebarea.isEqual(newSubwebarea)");
29                 shouldBeTrue("newSubwebarea.childrenCount > 0");
30             }
31
32             debug('<br /><span class="pass">TEST COMPLETE</span>');
33             if (window.testRunner)
34                 testRunner.notifyDone();
35         }, false);
36
37         // Load content into the iframe. This will trigger the event
38         // handler above, which will check that the accessibility tree
39         // was updated with new content.
40         window.iframeElement.src = "data:text/html,<body><button>Click me</button></body>";
41
42     }
43
44     window.addEventListener('load', function() {
45         setTimeout(runTest, 10);
46     }, false);
47
48   </script>
49 </head>
50 <body>
51
52 <p>Before</p>
53
54 <iframe id="iframe" role="group"></iframe>
55
56 <p>After</p>
57
58 <p>End of test</p>
59
60 <p id="description"></p>
61 <div id="console"></div>
62
63 </body>
64 </html>