Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / deleting-iframe-destroys-axcache.html
blobdc38ba20f0ac99aa3d9fe48dbe704ddd31ce24bd
1 <html>
2 <script src="../resources/js-test.js"></script>
3 <script src="../resources/accessibility-helper.js"></script>
4 <body>
6 <p id="before">Before</p>
8 <iframe id="iframe" src="data:text/html,<body><button>Click me</button></body>"></iframe>
10 <p id="after">After</p>
12 <p>End of test</p>
14 <p id="description"></p>
15 <div id="console"></div>
16 <script>
17 if (window.testRunner)
18 testRunner.waitUntilDone();
20 function runTest()
22 description("This tests that deleting an iframe doesn't cause the accessibility cache to be destroyed and recreated.");
24 if (window.accessibilityController) {
25 window.before = accessibilityController.accessibleElementById('before');
26 window.iframe = accessibilityController.accessibleElementById('iframe');
27 window.after = accessibilityController.accessibleElementById('after');
28 window.root = before.parentElement();
30 window.frameBody = iframe.childAtIndex(0);
31 window.frameBodyRole = frameBody.role;
32 window.frameGroup = frameBody.childAtIndex(0);
33 window.frameGroupRole = frameGroup.role;
34 window.frameButton = frameGroup.childAtIndex(0);
35 window.frameButtonRole = frameButton.role;
37 document.getElementById("console").innerText += "\nBefore:\n";
38 buildAccessibilityTree(root, 0, 1);
40 // Remove the iframe.
41 document.body.removeChild(document.getElementById("iframe"));
43 // Force layout now so that the childAtIndex calls below
44 // reflect the new render tree.
45 document.body.offsetTop;
47 window.newBefore = accessibilityController.accessibleElementById('before');
48 window.newAfter = accessibilityController.accessibleElementById('after');
49 window.newRoot = newBefore.parentElement();
51 document.getElementById("console").innerText += "\nAfter:\n";
52 buildAccessibilityTree(newRoot, 0, 1);
53 document.getElementById("console").innerText += "\n";
55 // Make sure that the accessibility objects from the iframe's nodes
56 // are now invalid by checking that their role is changed - this
57 // is because they've been deleted.
58 shouldBeFalse("frameBodyRole == frameBody.role");
59 shouldBeFalse("frameGroupRole == frameGroup.role");
60 shouldBeFalse("frameButtonRole == frameButton.role");
62 // Make sure that the other nodes are unchanged.
63 shouldBeTrue("before.isEqual(newBefore)");
64 shouldBeTrue("after.isEqual(newAfter)");
67 debug('<br /><span class="pass">TEST COMPLETE</span>');
68 if (window.testRunner)
69 testRunner.notifyDone();
72 window.addEventListener('load', function() {
73 setTimeout(runTest, 10);
74 }, false);
75 </script>
76 </body>
77 </html>