Index: LayoutTests/accessibility/loading-iframe-sends-notification.html |
diff --git a/LayoutTests/accessibility/loading-iframe-sends-notification.html b/LayoutTests/accessibility/loading-iframe-sends-notification.html |
index 5ce8e0268b89d7d3c8948bae5ab2c4c708cb3d4e..e133e9472656569e5029997a3952c7c8bfea065f 100644 |
--- a/LayoutTests/accessibility/loading-iframe-sends-notification.html |
+++ b/LayoutTests/accessibility/loading-iframe-sends-notification.html |
@@ -20,45 +20,51 @@ |
if (window.testRunner) |
testRunner.waitUntilDone(); |
- else |
- debug("This test requires window.accessibilityController and must be run in content_shell with --dump-render-tree.") |
window.jsTestIsAsync = true; |
function runTest() |
{ |
+ window.gotIframeNotification = false; |
+ |
if (window.accessibilityController) { |
// Initially, the iframe should not be loaded, so we shouldn't be able to find this button. |
- shouldBeUndefined("accessibilityController.accessibleElementById('innerbutton')"); |
+ shouldBeFalse("accessibilityController.accessibleElementById('innerbutton') != null"); |
window.accessibilityController.addNotificationListener(function (target, notification) { |
- if (!target.parentElement() || !target.parentElement().parentElement()) |
+ // Ignore this notification if it's not on the iframe. |
+ if (target.description.indexOf("InnerFrame") == -1) |
return; |
- // Ignore this notification if it's not within the subtree of the iframe. |
- var frameTarget = target.parentElement().parentElement(); |
- if (frameTarget.description.indexOf("InnerFrame") == -1) |
- return; |
- |
- // Even still we'll get LayoutComplete notifications sooner than we want. |
- if (!accessibilityController.accessibleElementById('innerbutton')) |
- return; |
+ debug("Got notification on iframe."); |
+ gotIframeNotification = true; |
// Check that the button within the iframe is now reachable from the root. |
- shouldBeDefined("accessibilityController.accessibleElementById('innerbutton')"); |
+ shouldBeTrue("accessibilityController.accessibleElementById('innerbutton') != null"); |
+ }); |
+ } |
+ |
+ window.iframeElement = document.getElementById("iframe"); |
+ iframeElement.addEventListener("load", function() { |
+ window.setTimeout(function() { |
+ shouldBeTrue("gotIframeNotification"); |
if (window.accessibilityController) |
accessibilityController.removeNotificationListener(); |
finishJSTest(); |
- }); |
- } |
+ }, 10); |
+ }, false); |
// Load content into the iframe. This will trigger the event |
// handler above, which will check that the accessibility tree |
// was updated with new content. |
- document.getElementById("iframe").src = "data:text/html,<body><button id='innerbutton'>InnerButton</button></body>"; |
+ window.iframeElement.src = "data:text/html,<body><button id='innerbutton'>InnerButton</button></body>"; |
} |
- window.addEventListener('load', runTest); |
+ |
+ window.addEventListener('load', function() { |
+ setTimeout(runTest, 10); |
+ }, false); |
+ |
</script> |
</body> |