Changeset 285924 in webkit
- Timestamp:
- Nov 17, 2021, 4:50:39 AM (5 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
accessibility/notification-listeners.html (modified) (2 diffs)
-
platform/mac/accessibility/notification-listeners-expected.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r285923 r285924 1 2021-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 1 19 2021-11-17 Rob Buis <rbuis@igalia.com> 2 20 -
trunk/LayoutTests/accessibility/notification-listeners.html
r228279 r285924 1 1 <html> 2 2 <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> 4 5 </head> 5 6 <body> 6 7 <p id="description"></p>8 7 9 8 <select id="select" value="Select"></select> … … 11 10 <div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div> 12 11 13 <div id="console"></div>14 15 12 <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."); 24 14 25 15 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; 32 17 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; 39 22 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 }); 47 28 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 }); 51 34 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 }); 54 41 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); 57 45 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); 62 49 63 if (window.accessibilityController) { 50 await expectAsyncExpression("globalNotificationCount", 2); 51 64 52 accessibilityController.removeNotificationListener(); 65 53 select.removeNotificationListener(); 66 54 slider.removeNotificationListener(); 67 } 68 69 finishJSTest(); 70 }, 10); 71 } 72 73 runTest(); 74 55 finishJSTest(); 56 }, 0); 57 } 75 58 </script> 76 77 <script src="../resources/js-test-post.js"></script>78 59 </body> 79 60 </html> -
trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt
r102378 r285924 4 4 5 5 6 7 Slider8 6 SELECT AXInvalidStatusChanged 9 7 GLOBAL AXInvalidStatusChanged on element with role AXRole: AXPopUpButton 8 PASS selectNotificationCount === 1 10 9 SLIDER AXValueChanged 11 10 GLOBAL AXValueChanged on element with role AXRole: AXSlider 12 PASS selectNotificationCount is 1 13 PASS sliderNotificationCount is 1 14 PASS globalNotificationCount is 2 11 PASS sliderNotificationCount === 1 12 PASS globalNotificationCount === 2 15 13 PASS successfullyParsed is true 16 14 17 15 TEST COMPLETE 18 16 17 Slider
Note:
See TracChangeset
for help on using the changeset viewer.