Chromium Code Reviews| 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 e133e9472656569e5029997a3952c7c8bfea065f..50613eb29b0fb9fe95168881d6d3e17e59f04af6 100644 |
| --- a/LayoutTests/accessibility/loading-iframe-sends-notification.html |
| +++ b/LayoutTests/accessibility/loading-iframe-sends-notification.html |
| @@ -20,51 +20,42 @@ |
| 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. |
| - shouldBeFalse("accessibilityController.accessibleElementById('innerbutton') != null"); |
| + shouldBeUndefined("accessibilityController.accessibleElementById('innerbutton')"); |
| window.accessibilityController.addNotificationListener(function (target, notification) { |
| - // Ignore this notification if it's not on the iframe. |
| - if (target.description.indexOf("InnerFrame") == -1) |
| + if (!target.parentElement() || !target.parentElement().parentElement()) |
| return; |
| - debug("Got notification on iframe."); |
| - gotIframeNotification = true; |
| + var frameTarget = target.parentElement().parentElement(); |
| + // Ignore this notification if it's not on the iframe. |
|
dmazzoni
2014/04/22 20:41:24
This should probably say: "Ignore this notificatio
|
| + if (frameTarget.description.indexOf("InnerFrame") == -1) |
| + return; |
| + debug("Got notification: " + notification + " on grand child of InnerFrame."); |
| // Check that the button within the iframe is now reachable from the root. |
| - shouldBeTrue("accessibilityController.accessibleElementById('innerbutton') != null"); |
| - }); |
| - } |
| - |
| - window.iframeElement = document.getElementById("iframe"); |
| - iframeElement.addEventListener("load", function() { |
| - window.setTimeout(function() { |
| - shouldBeTrue("gotIframeNotification"); |
| + shouldNotBe("accessibilityController.accessibleElementById('innerbutton')", "null"); |
|
dmazzoni
2014/04/22 20:41:24
I guess it should not be undefined, but in the wor
|
| 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. |
| - window.iframeElement.src = "data:text/html,<body><button id='innerbutton'>InnerButton</button></body>"; |
| + document.getElementById("iframe").src = "data:text/html,<body><button id='innerbutton'>InnerButton</button></body>"; |
| } |
| - |
| - window.addEventListener('load', function() { |
| - setTimeout(runTest, 10); |
| - }, false); |
| - |
| + window.addEventListener('load', runTest); |
| </script> |
| </body> |