Title: [282900] trunk/LayoutTests
Revision
282900
Author
andresg...@apple.com
Date
2021-09-22 18:16:01 -0700 (Wed, 22 Sep 2021)

Log Message

Fix for LayoutTests/accessibility/heading-level.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=230654
<rdar://problem/83422965>

Reviewed by Chris Fleizach.

Rewrote this test using Promises so that it works in isolated tree mode.

* accessibility/heading-level-expected.txt:
* accessibility/heading-level.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (282899 => 282900)


--- trunk/LayoutTests/ChangeLog	2021-09-23 00:52:25 UTC (rev 282899)
+++ trunk/LayoutTests/ChangeLog	2021-09-23 01:16:01 UTC (rev 282900)
@@ -1,3 +1,16 @@
+2021-09-22  Andres Gonzalez  <andresg...@apple.com>
+
+        Fix for LayoutTests/accessibility/heading-level.html in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=230654
+        <rdar://problem/83422965>
+
+        Reviewed by Chris Fleizach.
+
+        Rewrote this test using Promises so that it works in isolated tree mode.
+
+        * accessibility/heading-level-expected.txt:
+        * accessibility/heading-level.html:
+
 2021-09-22  Ayumi Kojima  <ayumi_koj...@apple.com>
 
         REGRESSION (r282865?): ASSERTION FAILED: Unsafe to ref/deref from different threads m_isOwnedByMainThread == isMainThread().

Modified: trunk/LayoutTests/accessibility/heading-level-expected.txt (282899 => 282900)


--- trunk/LayoutTests/accessibility/heading-level-expected.txt	2021-09-23 00:52:25 UTC (rev 282899)
+++ trunk/LayoutTests/accessibility/heading-level-expected.txt	2021-09-23 01:16:01 UTC (rev 282900)
@@ -3,31 +3,31 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS: level is 1.
-PASS: level is 2.
-PASS: level is 3.
-PASS: level is 4.
-PASS: level is 5.
-PASS: level is 6.
-PASS: level is 1.
-PASS: level is 2.
-PASS: level is 3.
-PASS: level is 4.
-PASS: level is 5.
-PASS: level is 6.
-PASS: level is 1.
-PASS: level is 2.
-PASS: level is 3.
-PASS: level is 4.
-PASS: level is 5.
-PASS: level is 6.
-PASS: level is 1.
-PASS: level is 2.
-PASS: level is 3.
-PASS: level is 4.
-PASS: level is 5.
-PASS: level is 6.
-PASS: level is 2.
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
+PASS axElement.intValue is parseInt(el.getAttribute('data-expected'))
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/heading-level.html (282899 => 282900)


--- trunk/LayoutTests/accessibility/heading-level.html	2021-09-23 00:52:25 UTC (rev 282899)
+++ trunk/LayoutTests/accessibility/heading-level.html	2021-09-23 01:16:01 UTC (rev 282900)
@@ -1,7 +1,10 @@
 <!DOCTYPE HTML>
 <html>
+<head>
+<script src=""
+<script src=""
+</head>
 <body>
-<script src=""
 
 <!-- implicit level of tag -->
 <h1 class="ex" data-expected="1">X</h1>
@@ -40,27 +43,33 @@
 
 <!-- todo: h1 elements nested in section elements should inherit nested level. -->
 
-<div id="console"></div>
 <script>
-if (window.testRunner && window.accessibilityController) {
     description("This tests that headings have a level matching the implicit default value or explicitly defined aria-level value.")
-    var examples = document.querySelectorAll('.ex');
-    for (var i = 0, c = examples.length; i < c; i++) {
-        var el = examples[i];
-        el.id = 'ex' + i;
-        var axElement = accessibilityController.accessibleElementById(el.id);
-        var result = document.getElementById('console');
-        
-        // Test AXLevel.
-        if (axElement.intValue == parseInt(el.getAttribute('data-expected'))) {
-            result.innerText += "PASS: level is " + axElement.intValue + ".\n";
-        } else {
-            result.innerText += "FAIL: level is " + axElement.intValue + " for " + el.outerHTML + ", expected " + parseInt(el.getAttribute('data-expected')) + ".\n";
-        }
-        el.style.display = 'none'; // Hide each example after verification.
+
+    if (window.testRunner && window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        setTimeout(async () => {
+            var examples = document.querySelectorAll('.ex');
+            for (let i = 0; i < examples.length; ++i) {
+                window.el = examples[i];
+                el.id = `ex${i}`;
+
+                window.axElement = null;
+                await waitFor(() => {
+                    axElement = accessibilityController.accessibleElementById(el.id);
+                    return axElement;
+                });
+
+                // Test AXLevel.
+                shouldBe("axElement.intValue", "parseInt(el.getAttribute('data-expected'))");
+
+                el.style.display = 'none'; // Hide each example after verification.
+            }
+
+            finishJSTest();
+        }, 0);
     }
-}
 </script>
-<script src=""
 </body>
-</html>
\ No newline at end of file
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to