| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <script src="../resources/js-test.js"></script> | |
| 3 <script src="../resources/accessibility-helper.js"></script> | |
| 4 <body> | |
| 5 | |
| 6 <p id="before">Before</p> | |
| 7 | |
| 8 <iframe id="iframe" src="data:text/html,<body><button>Click me</button></body>">
</iframe> | |
| 9 | |
| 10 <p id="after">After</p> | |
| 11 | |
| 12 <p>End of test</p> | |
| 13 | |
| 14 <p id="description"></p> | |
| 15 <div id="console"></div> | |
| 16 <script> | |
| 17 if (window.testRunner) | |
| 18 testRunner.waitUntilDone(); | |
| 19 | |
| 20 function runTest() | |
| 21 { | |
| 22 description("This tests that deleting an iframe doesn't cause the access
ibility cache to be destroyed and recreated."); | |
| 23 | |
| 24 if (window.accessibilityController) { | |
| 25 window.before = accessibilityController.accessibleElementById('befor
e'); | |
| 26 window.iframe = accessibilityController.accessibleElementById('ifram
e'); | |
| 27 window.after = accessibilityController.accessibleElementById('after'
); | |
| 28 window.root = before.parentElement(); | |
| 29 | |
| 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; | |
| 36 | |
| 37 document.getElementById("console").innerText += "\nBefore:\n"; | |
| 38 buildAccessibilityTree(root, 0, 1); | |
| 39 | |
| 40 // Remove the iframe. | |
| 41 document.body.removeChild(document.getElementById("iframe")); | |
| 42 | |
| 43 // Force layout now so that the childAtIndex calls below | |
| 44 // reflect the new render tree. | |
| 45 document.body.offsetTop; | |
| 46 | |
| 47 window.newBefore = accessibilityController.accessibleElementById('be
fore'); | |
| 48 window.newAfter = accessibilityController.accessibleElementById('aft
er'); | |
| 49 window.newRoot = newBefore.parentElement(); | |
| 50 | |
| 51 document.getElementById("console").innerText += "\nAfter:\n"; | |
| 52 buildAccessibilityTree(newRoot, 0, 1); | |
| 53 document.getElementById("console").innerText += "\n"; | |
| 54 | |
| 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"); | |
| 61 | |
| 62 // Make sure that the other nodes are unchanged. | |
| 63 shouldBeTrue("before.isEqual(newBefore)"); | |
| 64 shouldBeTrue("after.isEqual(newAfter)"); | |
| 65 } | |
| 66 | |
| 67 debug('<br /><span class="pass">TEST COMPLETE</span>'); | |
| 68 if (window.testRunner) | |
| 69 testRunner.notifyDone(); | |
| 70 } | |
| 71 | |
| 72 window.addEventListener('load', function() { | |
| 73 setTimeout(runTest, 10); | |
| 74 }, false); | |
| 75 </script> | |
| 76 </body> | |
| 77 </html> | |
| OLD | NEW |