3 <script src="../resources/js-test.js"></script>
7 testRunner.waitUntilDone();
9 function buildAccessibilityTree(accessibilityObject, indent) {
11 for (var i = 0; i < indent; i++)
13 str += accessibilityObject.role;
14 str += " " + accessibilityObject.stringValue;
16 if (accessibilityObject.role == '')
17 str += accessibilityObject.allAttributes();
20 document.getElementById("console").innerText += str;
22 if (accessibilityObject.stringValue.indexOf('End of test') >= 0)
25 var count = accessibilityObject.childrenCount;
26 for (var i = 0; i < count; ++i) {
27 if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1))
36 description("This tests that deleting an iframe doesn't cause the accessibility cache to be destroyed and recreated.");
38 if (window.accessibilityController) {
39 window.root = accessibilityController.rootElement;
40 window.body = root.childAtIndex(0);
41 window.before = body.childAtIndex(0).childAtIndex(0);
42 window.iframe = body.childAtIndex(1).childAtIndex(0);
43 window.after = body.childAtIndex(2).childAtIndex(0);
45 window.frameBody = window.iframe.childAtIndex(0);
46 window.frameBodyRole = window.frameBody.role;
47 window.frameGroup = window.frameBody.childAtIndex(0);
48 window.frameGroupRole = window.frameGroup.role;
49 window.frameButton = window.frameGroup.childAtIndex(0);
50 window.frameButtonRole = window.frameButton.role;
52 document.getElementById("console").innerText += "\nBefore:\n";
53 buildAccessibilityTree(root, 0);
56 document.body.removeChild(document.getElementById("iframe"));
58 // Force layout now so that the childAtIndex calls below
59 // reflect the new render tree.
60 document.body.offsetTop;
62 window.newRoot = accessibilityController.rootElement;
63 window.newBody = newRoot.childAtIndex(0);
64 window.newBefore = newBody.childAtIndex(0).childAtIndex(0);
65 window.newAfter = newBody.childAtIndex(1).childAtIndex(0);
67 document.getElementById("console").innerText += "\nAfter:\n";
68 buildAccessibilityTree(newRoot, 0);
69 document.getElementById("console").innerText += "\n";
71 // Make sure that the accessibility objects from the iframe's nodes
72 // are now invalid by checking that their role is changed - this
73 // is because they've been deleted.
74 shouldBeFalse("frameBodyRole == frameBody.role");
75 shouldBeFalse("frameGroupRole == frameGroup.role");
76 shouldBeFalse("frameButtonRole == frameButton.role");
78 // Make sure that the other nodes are unchanged.
79 shouldBeTrue("body.isEqual(newBody)");
80 shouldBeTrue("before.isEqual(newBefore)");
81 shouldBeTrue("after.isEqual(newAfter)");
84 debug('<br /><span class="pass">TEST COMPLETE</span>');
85 if (window.testRunner)
86 testRunner.notifyDone();
89 window.addEventListener('load', function() {
90 setTimeout(runTest, 10);
99 <iframe id="iframe" src="data:text/html,<body><button>Click me</button></body>"></iframe>
105 <p id="description"></p>
106 <div id="console"></div>