Title: [291401] trunk/LayoutTests
Revision
291401
Author
[email protected]
Date
2022-03-17 05:22:59 -0700 (Thu, 17 Mar 2022)

Log Message

Make accessibility/roles-exposed.html faster.
https://bugs.webkit.org/show_bug.cgi?id=237960
<rdar://problem/90371580>

Reviewed by Chris Fleizach.

Make this test to run faster by storing the output in memory and
modifying the DOM once as opposed to doing it in each iteration. This is
particularly important in isolated tree mode, since the test is failing
because it takes too long to execute.
Also modify the test and expectations to explicitly output when the AX
object cannot be retrieved, i.e., it is not exposed for some reason.

* accessibility/roles-exposed.html:
* platform/mac-wk2/accessibility/roles-exposed-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (291400 => 291401)


--- trunk/LayoutTests/ChangeLog	2022-03-17 12:01:21 UTC (rev 291400)
+++ trunk/LayoutTests/ChangeLog	2022-03-17 12:22:59 UTC (rev 291401)
@@ -1,5 +1,23 @@
 2022-03-17  Andres Gonzalez  <[email protected]>
 
+        Make accessibility/roles-exposed.html faster.
+        https://bugs.webkit.org/show_bug.cgi?id=237960
+        <rdar://problem/90371580>
+
+        Reviewed by Chris Fleizach.
+
+        Make this test to run faster by storing the output in memory and
+        modifying the DOM once as opposed to doing it in each iteration. This is
+        particularly important in isolated tree mode, since the test is failing
+        because it takes too long to execute.
+        Also modify the test and expectations to explicitly output when the AX
+        object cannot be retrieved, i.e., it is not exposed for some reason.
+
+        * accessibility/roles-exposed.html:
+        * platform/mac-wk2/accessibility/roles-exposed-expected.txt:
+
+2022-03-17  Andres Gonzalez  <[email protected]>
+
         Fix for accessibility/aria-option-role.html in isolated tree mode.
         https://bugs.webkit.org/show_bug.cgi?id=237975
         <rdar://problem/90386629>

Modified: trunk/LayoutTests/accessibility/roles-exposed.html (291400 => 291401)


--- trunk/LayoutTests/accessibility/roles-exposed.html	2022-03-17 12:01:21 UTC (rev 291400)
+++ trunk/LayoutTests/accessibility/roles-exposed.html	2022-03-17 12:22:59 UTC (rev 291401)
@@ -1,7 +1,9 @@
 <!DOCTYPE HTML>
 <html>
+<head>
+<script src=""
+</head>
 <body>
-<script src=""
 
 <!-- ==================================================================================================== -->
 <!-- HTML elements in alphabetical order, excepting the need for nesting (e.g. <li> is with its <ol> and <ul> parents) -->
@@ -395,59 +397,45 @@
     </div>
 </div>
 
-<div id="console"></div>
 <script>
 if (window.testRunner && window.accessibilityController) {
     description("This tests that native elements and ARIA overrides result in the expected role, subrole and role description.")
+
     var currentPlatform = accessibilityController.platformName;
     var examples = document.querySelectorAll('.ex');
-    var indent = "\n      "; // newline and six spaces
-    var el, supportedPlatforms, ariaRole, axElement, role, subrole, roleDescription, output, result;
-    for (var i = 0, c = examples.length; i < c; i++) {
+    var indent = "      "; // six spaces
+    var output = "";
+    for (let i = 0; i < examples.length; ++i) {
         el = examples[i];
 
-        supportedPlatforms = el.getAttribute('data-platform');
+        let supportedPlatforms = el.getAttribute('data-platform');
         if (!supportedPlatforms || supportedPlatforms.indexOf(currentPlatform) == -1)
             continue;
 
-        el.id = 'ex' + i;
-        ariaRole = el.getAttribute('role');
-        axElement = accessibilityController.accessibleElementById(el.id);
-        if (axElement) {
-            role = axElement.role;
-            subrole = axElement.subrole;
-            roleDescription = axElement.roleDescription;
-        } else {
-            role = 'AXRole: ';
-            subrole = 'AXSubrole: ';
-            roleDescription = 'AXRoleDescription: ';
-        }
-
-        output = el.tagName.toLowerCase() + (ariaRole?("[role="+ariaRole+"]"):'');
-        if (el.getAttribute('data-note')) {
+        let ariaRole = el.getAttribute('role');
+        el.id = `ex${i}`;
+        output += el.tagName.toLowerCase() + (ariaRole ? ("[role=" + ariaRole + "]") : '');
+        if (el.getAttribute('data-note'))
             output += el.getAttribute('data-note');
-        }
-        output += indent;
-        output += role + indent;
+        output += "\n";
 
-        // In the Mac platform more things than just the role
-        // are tested so we need to expand a bit the output.
-        if (currentPlatform == "mac")
-            output += subrole + indent + roleDescription + indent;
-
-        result = document.getElementById('console');
-        result.innerText += output + "\n";
+        let axElement = accessibilityController.accessibleElementById(el.id);
+        if (axElement) {
+            output += `${indent}${axElement.role}\n`;
+            if (currentPlatform == "mac")
+                output += `${indent}${axElement.subrole}\n${indent}${axElement.roleDescription}\n`;
+        } else
+            output += `${indent}Could not get AX element.\n`;
+        output += "\n";
     }
+    debug(output);
 
     // Once tests are complete, hide all the example markup.
-    examples = document.querySelectorAll('.ex');
-    for (var i = 0, c = examples.length; i < c; i++) {
-        el = examples[i];
+    examples.forEach((el) => {
         if (el.style)
             el.style.display = 'none';
-    }
+    });
 }
 </script>
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt (291400 => 291401)


--- trunk/LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt	2022-03-17 12:01:21 UTC (rev 291400)
+++ trunk/LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt	2022-03-17 12:22:59 UTC (rev 291401)
@@ -1,4 +1,3 @@
-X
 This tests that native elements and ARIA overrides result in the expected role, subrole and role description.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -10,19 +9,13 @@
       AXRoleDescription: link
 
 a:not([href])
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 abbr:not([title])
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 abbr[title]
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 address
       AXRole: AXGroup
@@ -40,19 +33,13 @@
       AXRoleDescription: complementary
 
 audio
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 b
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 bdo
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 blockquote
       AXRole: AXGroup
@@ -65,9 +52,7 @@
       AXRoleDescription: button
 
 canvas
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 cite
       AXRole: AXGroup
@@ -115,9 +100,7 @@
       AXRoleDescription: group
 
 em
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 fieldset
       AXRole: AXGroup
@@ -125,9 +108,7 @@
       AXRoleDescription: group
 
 legend
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 figure
       AXRole: AXGroup
@@ -190,24 +171,16 @@
       AXRoleDescription: separator
 
 i
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 img:not([src]):not([alt])
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 img[alt='']
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 img[src]:not([alt])
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 img[alt='X']
       AXRole: AXImage
@@ -220,9 +193,7 @@
       AXRoleDescription: image map
 
 img[usemap]:not([alt])
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 input[type='button']
       AXRole: AXButton
@@ -265,9 +236,7 @@
       AXRoleDescription: file upload button
 
 input[type='hidden']
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 input[type='image']
       AXRole: AXButton
@@ -350,14 +319,10 @@
       AXRoleDescription: group
 
 map
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 area
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 mark
       AXRole: AXGroup
@@ -490,9 +455,7 @@
       AXRoleDescription: group
 
 mprescripts
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 mi
       AXRole: AXGroup
@@ -570,14 +533,10 @@
       AXRoleDescription: progress indicator
 
 q
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 s
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 samp
       AXRole: AXGroup
@@ -605,14 +564,10 @@
       AXRoleDescription: pop up button
 
 option
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 optgroup
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 select[multiple]
       AXRole: AXList
@@ -630,24 +585,16 @@
       AXRoleDescription: text
 
 small
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 span:not([onclick])
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 span[onclick]
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 strong
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 sub
       AXRole: AXGroup
@@ -660,9 +607,7 @@
       AXRoleDescription: group
 
 svg
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 table
       AXRole: AXTable
@@ -670,14 +615,10 @@
       AXRoleDescription: table
 
 caption
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 thead
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 tr
       AXRole: AXRow
@@ -690,9 +631,7 @@
       AXRoleDescription: cell
 
 tbody
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 tr
       AXRole: AXRow
@@ -705,9 +644,7 @@
       AXRoleDescription: cell
 
 tfoot
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 tr
       AXRole: AXRow
@@ -750,9 +687,7 @@
       AXRoleDescription: group
 
 wbr
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 div[role=command]
       AXRole: AXGroup
@@ -1125,9 +1060,7 @@
       AXRoleDescription: table
 
 div[role=rowgroup]
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 div[role=row]
       AXRole: AXRow
@@ -1280,9 +1213,7 @@
       AXRoleDescription: group
 
 div[role=presentation]
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 div[role=progressbar]
       AXRole: AXProgressIndicator
@@ -1420,9 +1351,7 @@
       AXRoleDescription: outline row
 
 div[role=group]
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 div[role=treeitem]
       AXRole: AXRow
@@ -1435,9 +1364,7 @@
       AXRoleDescription: table
 
 div[role=rowgroup]
-      AXRole:
-      AXSubrole:
-      AXRoleDescription:
+      Could not get AX element.
 
 div[role=row]
       AXRole: AXRow
@@ -1459,7 +1386,8 @@
       AXSubrole:
       AXRoleDescription: cell
 
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-
+X
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to