<!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>[285924] 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/285924">285924</a></dd>
<dt>Author</dt> <dd>andresg_22@apple.com</dd>
<dt>Date</dt> <dd>2021-11-17 04:50:39 -0800 (Wed, 17 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix for accessibility/notification-listeners.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=233228
<rdar://problem/85484341>

Reviewed by Chris Fleizach.

Made this test async in order to pass in isolated tree mode.
The first accessible element needs to be retrieved with waitForElementById,
otherwise if we use accessibilityController.accessibleElementById, the
test would fail randomly (~10 out of 1000 flakiness). It requires
further investigation to determine if this is an issue with the <select>
element or with the first accessible element the test retrieves.

* accessibility/notification-listeners.html:
* platform/mac/accessibility/notification-listeners-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilitynotificationlistenershtml">trunk/LayoutTests/accessibility/notification-listeners.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitynotificationlistenersexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (285923 => 285924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-11-17 12:31:09 UTC (rev 285923)
+++ trunk/LayoutTests/ChangeLog 2021-11-17 12:50:39 UTC (rev 285924)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2021-11-17  Andres Gonzalez  <andresg_22@apple.com>
+
+        Fix for accessibility/notification-listeners.html in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=233228
+        <rdar://problem/85484341>
+
+        Reviewed by Chris Fleizach.
+
+        Made this test async in order to pass in isolated tree mode.
+        The first accessible element needs to be retrieved with waitForElementById,
+        otherwise if we use accessibilityController.accessibleElementById, the
+        test would fail randomly (~10 out of 1000 flakiness). It requires
+        further investigation to determine if this is an issue with the <select>
+        element or with the first accessible element the test retrieves.
+
+        * accessibility/notification-listeners.html:
+        * platform/mac/accessibility/notification-listeners-expected.txt:
+
</ins><span class="cx"> 2021-11-17  Rob Buis  <rbuis@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Limit logical width over-constrained direction check
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitynotificationlistenershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/notification-listeners.html (285923 => 285924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/notification-listeners.html      2021-11-17 12:31:09 UTC (rev 285923)
+++ trunk/LayoutTests/accessibility/notification-listeners.html 2021-11-17 12:50:39 UTC (rev 285924)
</span><span class="lines">@@ -1,79 +1,60 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><del>-<script src="../resources/js-test-pre.js"></script>
</del><ins>+<script src="../resources/js-test.js"></script>
+<script src="../resources/accessibility-helper.js"></script>
</ins><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> 
</span><del>-<p id="description"></p>
-
</del><span class="cx"> <select id="select" value="Select"></select>
</span><span class="cx"> 
</span><span class="cx"> <div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div>
</span><span class="cx"> 
</span><del>-<div id="console"></div>
-
</del><span class="cx"> <script>
</span><del>-description("This tests that a notification listener on an element only listens to that one element, and that a global notification listener listens to all notifications.");
</del><ins>+    description("This tests that a notification listener on an element only listens to that one element, and that a global notification listener listens to all notifications.");
</ins><span class="cx"> 
</span><del>-function runTest() {
-    window.jsTestIsAsync = true;
</del><ins>+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
</ins><span class="cx"> 
</span><del>-    window.selectNotificationCount = 0;
-    window.sliderNotificationCount = 0;
-    window.globalNotificationCount = 0;
</del><ins>+        setTimeout(async () => {
+            window.selectNotificationCount = 0;
+            window.sliderNotificationCount = 0;
+            window.globalNotificationCount = 0;
</ins><span class="cx"> 
</span><del>-    if (window.accessibilityController) {
-        document.getElementById("select").focus();
-        window.select = accessibilityController.focusedElement;
-        select.addNotificationListener(function(notification) {
-            selectNotificationCount++;
-            debug("SELECT " + notification);
-        });
</del><ins>+            let select = await waitForElementById("select");
+            select.addNotificationListener((notification) => {
+                selectNotificationCount++;
+                debug(`SELECT ${notification}`);
+            });
</ins><span class="cx"> 
</span><del>-        document.getElementById("slider").focus();
-        window.slider = accessibilityController.focusedElement;
-        slider.addNotificationListener(function(notification) {
-            sliderNotificationCount++;
-            debug("SLIDER " + notification);
-        });
</del><ins>+            let slider = accessibilityController.accessibleElementById("slider");
+            slider.addNotificationListener((notification) => {
+                sliderNotificationCount++;
+                debug(`SLIDER ${notification}`);
+            });
</ins><span class="cx"> 
</span><del>-        accessibilityController.addNotificationListener(function(element, notification) {
-            if (element.isEqual(slider) || element.isEqual(select)) {
-                globalNotificationCount++;
-                debug("GLOBAL " + notification + " on element with role " + element.role);
-            }
-        });
-    }
</del><ins>+            accessibilityController.addNotificationListener((element, notification) => {
+                if (element.isEqual(slider) || element.isEqual(select)) {
+                    globalNotificationCount++;
+                    debug(`GLOBAL ${notification} on element with role ${element.role}`);
+                }
+            });
</ins><span class="cx"> 
</span><del>-    // Ensure these elements exist in the AX tree otherwise notifications won't be generated.
-    accessibilityController.accessibleElementById("select");
-    accessibilityController.accessibleElementById("slider");
</del><ins>+            // This should trigger a "invalid status changed" notification on the select.
+            document.getElementById("select").setAttribute("aria-invalid", "true");
+            await expectAsyncExpression("selectNotificationCount", 1);
</ins><span class="cx"> 
</span><del>-    // This should trigger a "invalid status changed" notification on the select.
-    document.getElementById("select").setAttribute("aria-invalid", "true");
</del><ins>+            // This should trigger a "value changed" notification on the slider.
+            document.getElementById("slider").setAttribute("aria-valuenow", "6");
+            await expectAsyncExpression("sliderNotificationCount", 1);
</ins><span class="cx"> 
</span><del>-    // This should trigger a "value changed" notification on the slider.
-    document.getElementById("slider").setAttribute("aria-valuenow", "6");
</del><ins>+            await expectAsyncExpression("globalNotificationCount", 2);
</ins><span class="cx"> 
</span><del>-    window.setTimeout(function() {
-        shouldBe("selectNotificationCount", "1");
-        shouldBe("sliderNotificationCount", "1");
-        shouldBe("globalNotificationCount", "2");
-
-        if (window.accessibilityController) {
</del><span class="cx">             accessibilityController.removeNotificationListener();
</span><span class="cx">             select.removeNotificationListener();
</span><span class="cx">             slider.removeNotificationListener();
</span><del>-        }
-
-        finishJSTest();
-    }, 10);
-}
-
-runTest();
-
</del><ins>+            finishJSTest();
+        }, 0);
+    }
</ins><span class="cx"> </script>
</span><del>-
-<script src="../resources/js-test-post.js"></script>
</del><span class="cx"> </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitynotificationlistenersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt (285923 => 285924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt 2021-11-17 12:31:09 UTC (rev 285923)
+++ trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt    2021-11-17 12:50:39 UTC (rev 285924)
</span><span class="lines">@@ -3,16 +3,15 @@
</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>-
-Slider
</del><span class="cx"> SELECT AXInvalidStatusChanged
</span><span class="cx"> GLOBAL AXInvalidStatusChanged on element with role AXRole: AXPopUpButton
</span><ins>+PASS selectNotificationCount === 1
</ins><span class="cx"> SLIDER AXValueChanged
</span><span class="cx"> GLOBAL AXValueChanged on element with role AXRole: AXSlider
</span><del>-PASS selectNotificationCount is 1
-PASS sliderNotificationCount is 1
-PASS globalNotificationCount is 2
</del><ins>+PASS sliderNotificationCount === 1
+PASS globalNotificationCount === 2
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span><span class="cx"> 
</span><ins>+Slider
</ins></span></pre>
</div>
</div>

</body>
</html>