| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body id="body" onload="runTest()"> |
| <fieldset> |
| <div> |
| <input id="1"> |
| <label for="1">1</label> |
| </div> |
| <div> |
| <input id="2"> |
| <label for="2">2</label> |
| </div> |
| </fieldset> |
| <script> |
| description("This tests that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag."); |
| jsTestIsAsync = true; |
| |
| var webArea = 0; |
| var axTextFocusChangeOne = 0; |
| var axTextFocusChangeTwo = 0; |
| var axTextFocusChangeThree = 0; |
| var axTextFocusChangeFour = 0; |
| var tabCharacter = "\t"; |
| |
| function notificationCallback(notification, userInfo) { |
| if (notification == "AXSelectedTextChanged") { |
| debug("Received AXSelectedTextChanged"); |
| window.userInfo = userInfo; |
| shouldBeTrue("userInfo[\"AXTextSelectionChangedFocus\"]"); |
| } else if (notification == "AXFocusChanged") |
| debug("Received AXFocusChanged"); |
| } |
| |
| function runTest() { |
| if (window.accessibilityController) { |
| testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1); |
| |
| accessibilityController.enableEnhancedAccessibility(true); |
| webArea = accessibilityController.rootElement.childAtIndex(0); |
| webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", true) |
| |
| shouldBeTrue("webArea.addNotificationListener(notificationCallback)"); |
| evalAndLog("eventSender.keyDown(tabCharacter);"); |
| setTimeout(runTakeFocusTest, 0); |
| } else { |
| debug("window.accessibilityController is not present"); |
| finishJSTest(); |
| } |
| } |
| |
| function runTakeFocusTest() { |
| debug(''); |
| shouldBeTrue("accessibilityController.accessibleElementById(\"1\").isFocusable"); |
| evalAndLog("accessibilityController.accessibleElementById(\"1\").takeFocus()"); |
| setTimeout(runSecondTabMoveTest, 0); |
| } |
| |
| function runSecondTabMoveTest() { |
| debug(''); |
| evalAndLog("eventSender.keyDown(tabCharacter)"); |
| setTimeout(() => { |
| webArea.removeNotificationListener(); |
| finishJSTest(); |
| }, 0); |
| } |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |