⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285924 in webkit


Ignore:
Timestamp:
Nov 17, 2021, 4:50:39 AM (5 years ago)
Author:
Andres Gonzalez
Message:

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:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285923 r285924  
     12021-11-17  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for accessibility/notification-listeners.html in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=233228
     5        <rdar://problem/85484341>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        Made this test async in order to pass in isolated tree mode.
     10        The first accessible element needs to be retrieved with waitForElementById,
     11        otherwise if we use accessibilityController.accessibleElementById, the
     12        test would fail randomly (~10 out of 1000 flakiness). It requires
     13        further investigation to determine if this is an issue with the <select>
     14        element or with the first accessible element the test retrieves.
     15
     16        * accessibility/notification-listeners.html:
     17        * platform/mac/accessibility/notification-listeners-expected.txt:
     18
    1192021-11-17  Rob Buis  <rbuis@igalia.com>
    220
  • trunk/LayoutTests/accessibility/notification-listeners.html

    r228279 r285924  
    11<html>
    22<head>
    3 <script src="../resources/js-test-pre.js"></script>
     3<script src="../resources/js-test.js"></script>
     4<script src="../resources/accessibility-helper.js"></script>
    45</head>
    56<body>
    6 
    7 <p id="description"></p>
    87
    98<select id="select" value="Select"></select>
     
    1110<div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div>
    1211
    13 <div id="console"></div>
    14 
    1512<script>
    16 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.");
    17 
    18 function runTest() {
    19     window.jsTestIsAsync = true;
    20 
    21     window.selectNotificationCount = 0;
    22     window.sliderNotificationCount = 0;
    23     window.globalNotificationCount = 0;
     13    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.");
    2414
    2515    if (window.accessibilityController) {
    26         document.getElementById("select").focus();
    27         window.select = accessibilityController.focusedElement;
    28         select.addNotificationListener(function(notification) {
    29             selectNotificationCount++;
    30             debug("SELECT " + notification);
    31         });
     16        window.jsTestIsAsync = true;
    3217
    33         document.getElementById("slider").focus();
    34         window.slider = accessibilityController.focusedElement;
    35         slider.addNotificationListener(function(notification) {
    36             sliderNotificationCount++;
    37             debug("SLIDER " + notification);
    38         });
     18        setTimeout(async () => {
     19            window.selectNotificationCount = 0;
     20            window.sliderNotificationCount = 0;
     21            window.globalNotificationCount = 0;
    3922
    40         accessibilityController.addNotificationListener(function(element, notification) {
    41             if (element.isEqual(slider) || element.isEqual(select)) {
    42                 globalNotificationCount++;
    43                 debug("GLOBAL " + notification + " on element with role " + element.role);
    44             }
    45         });
    46     }
     23            let select = await waitForElementById("select");
     24            select.addNotificationListener((notification) => {
     25                selectNotificationCount++;
     26                debug(`SELECT ${notification}`);
     27            });
    4728
    48     // Ensure these elements exist in the AX tree otherwise notifications won't be generated.
    49     accessibilityController.accessibleElementById("select");
    50     accessibilityController.accessibleElementById("slider");
     29            let slider = accessibilityController.accessibleElementById("slider");
     30            slider.addNotificationListener((notification) => {
     31                sliderNotificationCount++;
     32                debug(`SLIDER ${notification}`);
     33            });
    5134
    52     // This should trigger a "invalid status changed" notification on the select.
    53     document.getElementById("select").setAttribute("aria-invalid", "true");
     35            accessibilityController.addNotificationListener((element, notification) => {
     36                if (element.isEqual(slider) || element.isEqual(select)) {
     37                    globalNotificationCount++;
     38                    debug(`GLOBAL ${notification} on element with role ${element.role}`);
     39                }
     40            });
    5441
    55     // This should trigger a "value changed" notification on the slider.
    56     document.getElementById("slider").setAttribute("aria-valuenow", "6");
     42            // This should trigger a "invalid status changed" notification on the select.
     43            document.getElementById("select").setAttribute("aria-invalid", "true");
     44            await expectAsyncExpression("selectNotificationCount", 1);
    5745
    58     window.setTimeout(function() {
    59         shouldBe("selectNotificationCount", "1");
    60         shouldBe("sliderNotificationCount", "1");
    61         shouldBe("globalNotificationCount", "2");
     46            // This should trigger a "value changed" notification on the slider.
     47            document.getElementById("slider").setAttribute("aria-valuenow", "6");
     48            await expectAsyncExpression("sliderNotificationCount", 1);
    6249
    63         if (window.accessibilityController) {
     50            await expectAsyncExpression("globalNotificationCount", 2);
     51
    6452            accessibilityController.removeNotificationListener();
    6553            select.removeNotificationListener();
    6654            slider.removeNotificationListener();
    67         }
    68 
    69         finishJSTest();
    70     }, 10);
    71 }
    72 
    73 runTest();
    74 
     55            finishJSTest();
     56        }, 0);
     57    }
    7558</script>
    76 
    77 <script src="../resources/js-test-post.js"></script>
    7859</body>
    7960</html>
  • trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt

    r102378 r285924  
    44
    55
    6 
    7 Slider
    86SELECT AXInvalidStatusChanged
    97GLOBAL AXInvalidStatusChanged on element with role AXRole: AXPopUpButton
     8PASS selectNotificationCount === 1
    109SLIDER AXValueChanged
    1110GLOBAL AXValueChanged on element with role AXRole: AXSlider
    12 PASS selectNotificationCount is 1
    13 PASS sliderNotificationCount is 1
    14 PASS globalNotificationCount is 2
     11PASS sliderNotificationCount === 1
     12PASS globalNotificationCount === 2
    1513PASS successfullyParsed is true
    1614
    1715TEST COMPLETE
    1816
     17Slider
Note: See TracChangeset for help on using the changeset viewer.