<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[187595] trunk/LayoutTests</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/187595">187595</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-07-30 11:39:42 -0700 (Thu, 30 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>aria-liveregions-notifications tests are very flaky
https://bugs.webkit.org/show_bug.cgi?id=147299
<rdar://problem/21998675>
Patch by Nan Wang <n_wang@apple.com> on 2015-07-30
Reviewed by Chris Fleizach.
These tests were flaky because they relied on timer notification callbacks.
Fixed these tests by using different objects to capture the notifications instead.
* platform/mac/TestExpectations:
* platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt:
* platform/mac/accessibility/aria-liveregions-notifications-always-sent.html:
* platform/mac/accessibility/aria-liveregions-notifications-expected.txt:
* platform/mac/accessibility/aria-liveregions-notifications.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssentexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssenthtml">trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationshtml">trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (187594 => 187595)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-07-30 18:36:59 UTC (rev 187594)
+++ trunk/LayoutTests/ChangeLog        2015-07-30 18:39:42 UTC (rev 187595)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-07-30 Nan Wang <n_wang@apple.com>
+
+ aria-liveregions-notifications tests are very flaky
+ https://bugs.webkit.org/show_bug.cgi?id=147299
+ <rdar://problem/21998675>
+
+ Reviewed by Chris Fleizach.
+
+ These tests were flaky because they relied on timer notification callbacks.
+ Fixed these tests by using different objects to capture the notifications instead.
+
+ * platform/mac/TestExpectations:
+ * platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt:
+ * platform/mac/accessibility/aria-liveregions-notifications-always-sent.html:
+ * platform/mac/accessibility/aria-liveregions-notifications-expected.txt:
+ * platform/mac/accessibility/aria-liveregions-notifications.html:
+
</ins><span class="cx"> 2015-07-30 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Selecting in an iframe can cause main page scrolling
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (187594 => 187595)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2015-07-30 18:36:59 UTC (rev 187594)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2015-07-30 18:39:42 UTC (rev 187595)
</span><span class="lines">@@ -1302,9 +1302,6 @@
</span><span class="cx"> # <rdar://problem/21857102>
</span><span class="cx"> [ ElCapitan+ ] fast/canvas/canvas-too-large-to-draw.html [ Crash ]
</span><span class="cx">
</span><del>-webkit.org/b/147299 platform/mac/accessibility/aria-liveregions-notifications-always-sent.html [ Pass Failure ]
-webkit.org/b/147299 platform/mac/accessibility/aria-liveregions-notifications.html [ Pass Failure ]
-
</del><span class="cx"> # rdar://problem/22014672
</span><span class="cx"> [ ElCapitan+ ] imported/w3c/canvas/2d.composite.uncovered.fill.destination-atop.html [ Pass Failure ]
</span><span class="cx"> [ ElCapitan+ ] imported/w3c/canvas/2d.composite.uncovered.fill.destination-in.html [ Pass Failure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt (187594 => 187595)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt        2015-07-30 18:36:59 UTC (rev 187594)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt        2015-07-30 18:39:42 UTC (rev 187595)
</span><span class="lines">@@ -1,11 +1,12 @@
</span><del>-Test test0test1test2
</del><ins>+Test test1
+test2
</ins><span class="cx"> This tests that ARIA live region notifications are sent even when an assistive technology is not accessing them directly on each update.
</span><span class="cx">
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="cx">
</span><del>-PASS addedNotification is true
-PASS liveRegionChangeCount == 3 is true
</del><ins>+PASS addedNotification1 is true
+PASS addedNotification2 is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html (187594 => 187595)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html        2015-07-30 18:36:59 UTC (rev 187594)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html        2015-07-30 18:39:42 UTC (rev 187595)
</span><span class="lines">@@ -5,9 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body id="body">
</span><span class="cx">
</span><del>-<div role="group" tabindex=0 id="liveregion" aria-live="polite" aria-relevant="additions">
</del><ins>+<div role="group" tabindex=0 id="liveregion1" aria-live="polite" aria-relevant="additions">
</ins><span class="cx"> Test
</span><span class="cx"> </div>
</span><ins>+<div role="group" tabindex=0 id="liveregion2" aria-live="polite" aria-relevant="additions"></div>
</ins><span class="cx">
</span><span class="cx"> <p id="description"></p>
</span><span class="cx"> <div id="console"></div>
</span><span class="lines">@@ -19,44 +20,43 @@
</span><span class="cx">
</span><span class="cx"> if (window.accessibilityController) {
</span><span class="cx">
</span><del>- liveRegion = accessibilityController.accessibleElementById("liveregion");
</del><ins>+ var liveRegion1 = accessibilityController.accessibleElementById("liveregion1");
+ var liveRegion2 = accessibilityController.accessibleElementById("liveregion2");
</ins><span class="cx">
</span><del>- var liveRegionChangeCount = 0;
- function ariaCallback(notification) {
</del><ins>+ var liveRegion1Changed = false;
+ var liveRegion2Changed = false;
+ function ariaCallback1(notification) {
</ins><span class="cx"> if (notification == "AXLiveRegionChanged") {
</span><del>- liveRegionChangeCount++;
</del><ins>+ liveRegion1Changed = true;
+ finishTest();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- var addedNotification = liveRegion.addNotificationListener(ariaCallback);
- shouldBe("addedNotification", "true");
</del><ins>+ function ariaCallback2(notification) {
+ if (notification == "AXLiveRegionChanged") {
+ liveRegion2Changed = true;
+ finishTest();
+ }
+ }
</ins><span class="cx">
</span><ins>+ addedNotification1 = liveRegion1.addNotificationListener(ariaCallback1);
+ shouldBe("addedNotification1", "true");
+ addedNotification2 = liveRegion2.addNotificationListener(ariaCallback2);
+ shouldBe("addedNotification2", "true");
+
</ins><span class="cx"> // this should trigger our live region callback for a new element.
</span><del>- for (var k = 0; k < 3; k++) {
- // AXLiveRegionsChanged notifications are sent after a delay, so in order to ensure we
- // get an notification for each operation we should avoid coalescing which can occur
- doSetTimeout(k);
</del><ins>+ for (var k = 1; k < 3; k++) {
+ var textNode = document.createTextNode("test" + k);
+ document.getElementById("liveregion" + k).appendChild(textNode);
</ins><span class="cx"> }
</span><del>-
- // add a short delay to check after all the operations if we have exactly three notificaitons
- setTimeout("finishTest()", 200);
</del><span class="cx"> }
</span><span class="cx">
</span><del>- function doSetTimeout(k) {
- setTimeout(function() {
- operation(k);
- }, k * 30);
- }
-
- function operation(k) {
- var textNode = document.createTextNode("test" + k);
- document.getElementById("liveregion").appendChild(textNode);
- }
-
</del><span class="cx"> function finishTest() {
</span><del>- // We should get a total of three live region changes.
- liveRegion.removeNotificationListener();
- shouldBeTrue("liveRegionChangeCount == 3");
- finishJSTest();
</del><ins>+ // We should get a total of two live region changes.
+ if (liveRegion1Changed && liveRegion2Changed) {
+ liveRegion1.removeNotificationListener();
+ liveRegion2.removeNotificationListener();
+ finishJSTest();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt (187594 => 187595)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt        2015-07-30 18:36:59 UTC (rev 187594)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt        2015-07-30 18:39:42 UTC (rev 187595)
</span><span class="lines">@@ -1,11 +1,16 @@
</span><del>- new text element
</del><ins>+changed text
+
+new text element
+
</ins><span class="cx"> This tests that ARIA live regions are sending out the correct notifications. We perform four operations (add, remove, change text, change alt tag), each one should trigger a live region notification
</span><span class="cx">
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="cx">
</span><del>-PASS addedNotification is true
-PASS liveRegionChangeCount == 4 is true
</del><ins>+PASS addedNotification1 is true
+PASS addedNotification2 is true
+PASS addedNotification3 is true
+PASS addedNotification4 is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityarialiveregionsnotificationshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html (187594 => 187595)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html        2015-07-30 18:36:59 UTC (rev 187594)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html        2015-07-30 18:39:42 UTC (rev 187595)
</span><span class="lines">@@ -5,11 +5,21 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body id="body">
</span><span class="cx">
</span><del>-<div role="group" tabindex=0 id="liveregion" aria-live="polite" aria-relevant="additions">
-<h3 id="innerlive">text</h3>
</del><ins>+<div role="group" tabindex=0 id="liveregion1" aria-live="polite" aria-relevant="additions">
+<h3 id="innerlive1">text</h3>
+</div>
+
+<div role="group" tabindex=0 id="liveregion2" aria-live="polite" aria-relevant="additions"></div>
+
+<div role="group" tabindex=0 id="liveregion3" aria-live="polite" aria-relevant="additions">
</ins><span class="cx"> <img src="test.gif" width=100 height=100 alt="alt text" tabindex=0 id="image">
</span><span class="cx"> </div>
</span><span class="cx">
</span><ins>+<div role="group" tabindex=0 id="liveregion4" aria-live="polite" aria-relevant="additions">
+<h3 id="innerlive2">text</h3>
+</div>
+
+
</ins><span class="cx"> <p id="description"></p>
</span><span class="cx"> <div id="console"></div>
</span><span class="cx">
</span><span class="lines">@@ -18,63 +28,93 @@
</span><span class="cx">
</span><span class="cx"> description("This tests that ARIA live regions are sending out the correct notifications. We perform four operations (add, remove, change text, change alt tag), each one should trigger a live region notification");
</span><span class="cx">
</span><del>- var liveRegion = 0;
- var liveRegionChangeCount = 0;
- function ariaCallback(notification) {
</del><ins>+ var receivedTextChangeNotification = false;
+ var receivedNewElementNotification = false;
+ var receivedAlternativeChangeNotification = false;
+ var receivedRemoveElementNotification = false;
+
+ // notification callbacks
+ function textChangeCallback(notification) {
</ins><span class="cx"> if (notification == "AXLiveRegionChanged") {
</span><del>- liveRegionChangeCount++;
</del><ins>+ receivedTextChangeNotification = true;
+ finishTest();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ function newElementCallback(notification) {
+ if (notification == "AXLiveRegionChanged") {
+ receivedNewElementNotification = true;
+ finishTest();
+ }
+ }
+ function alternativeChangeCallback(notification) {
+ if (notification == "AXLiveRegionChanged") {
+ receivedAlternativeChangeNotification = true;
+ finishTest();
+ }
+ }
+ function removeElementCallback(notification) {
+ if (notification == "AXLiveRegionChanged") {
+ receivedRemoveElementNotification = true;
+ finishTest();
+ }
+ }
</ins><span class="cx">
</span><ins>+ function finishTest() {
+ // We should get a total of four live region changes.
+ if(receivedTextChangeNotification
+ && receivedNewElementNotification
+ && receivedAlternativeChangeNotification
+ && receivedRemoveElementNotification) {
+ liveRegion1.removeNotificationListener();
+ liveRegion2.removeNotificationListener();
+ liveRegion3.removeNotificationListener();
+ liveRegion4.removeNotificationListener();
+ finishJSTest();
+ }
+ }
+
</ins><span class="cx"> if (window.accessibilityController) {
</span><span class="cx">
</span><del>- liveRegion = accessibilityController.accessibleElementById("liveregion");
</del><ins>+ liveRegion1 = accessibilityController.accessibleElementById("liveregion1");
+ liveRegion2 = accessibilityController.accessibleElementById("liveregion2");
+ liveRegion3 = accessibilityController.accessibleElementById("liveregion3");
+ liveRegion4 = accessibilityController.accessibleElementById("liveregion4");
</ins><span class="cx">
</span><del>- var addedNotification = liveRegion.addNotificationListener(ariaCallback);
- shouldBe("addedNotification", "true");
</del><ins>+ var addedNotification1 = liveRegion1.addNotificationListener(textChangeCallback);
+ shouldBe("addedNotification1", "true");
+ var addedNotification2 = liveRegion2.addNotificationListener(newElementCallback);
+ shouldBe("addedNotification2", "true");
+ var addedNotification3 = liveRegion3.addNotificationListener(alternativeChangeCallback);
+ shouldBe("addedNotification3", "true");
+ var addedNotification4 = liveRegion4.addNotificationListener(removeElementCallback);
+ shouldBe("addedNotification4", "true");
</ins><span class="cx">
</span><del>- // AXLiveRegionsChanged notifications are sent after a delay, so in order to ensure we
- // get an notification for each operation we should avoid coalescing which can occur
- setTimeout("textChangeOperation()", 0);
- setTimeout("newElementOperation()", 30);
- setTimeout("alternativeChangeOperation()", 60);
- setTimeout("removeElementOperation()", 90);
-
- // add a short delay to check after all the operations if we have exactly four notificaitons
- setTimeout("finishTest()", 200);
</del><ins>+ textChangeOperation();
+ newElementOperation();
+ alternativeChangeOperation();
+ removeElementOperation();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function textChangeOperation() {
</span><span class="cx"> // this should trigger our live region callback for a text change.
</span><del>- document.getElementById("liveregion").childNodes[0].innerText = "changed text";
</del><ins>+ document.getElementById("innerlive1").innerText = "changed text";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function newElementOperation() {
</span><span class="cx"> // this should trigger our live region callback for a new element.
</span><del>- document.getElementById("liveregion").innerHTML += "new text element";
</del><ins>+ document.getElementById("liveregion2").innerHTML += "new text element";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function alternativeChangeOperation() {
</span><span class="cx"> // this should also trigger our live region change because its a text alternative change.
</span><span class="cx"> document.getElementById("image").setAttribute('alt', "new image text");
</span><del>-
- // Access the accessibility tree here because AX won't post the live region change
- // notification twice when the children have already been marked as dirty.
- liveRegion.childAtIndex(0);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function removeElementOperation() {
</span><span class="cx"> // this should trigger our live region callback for a removed element.
</span><del>- document.getElementById("liveregion").removeChild(document.getElementById("innerlive"));
</del><ins>+ document.getElementById("liveregion4").removeChild(document.getElementById("innerlive2"));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- function finishTest() {
- // We should get a total of four live region changes.
- liveRegion.removeNotificationListener();
- shouldBeTrue("liveRegionChangeCount == 4");
- finishJSTest();
- }
-
</del><span class="cx"> </script>
</span><span class="cx">
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</span></span></pre>
</div>
</div>
</body>
</html>