| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/run-after-layout-and-paint.js"></script> |
| |
| <input autofocus id="input" value="input"> |
| |
| <script> |
| 'use strict'; |
| |
| async_test_after_layout_and_paint((t) => { |
| const inputElement = document.getElementById('input'); |
| const axRootElement = accessibilityController.rootElement; |
| const axInputElement = accessibilityController.accessibleElementById('input'); |
| |
| let gotDocumentSelectionChanged = false; |
| let gotSelectedTextChanged = false; |
| const succeedIfDone = t.step_func(() => { |
| if (gotDocumentSelectionChanged && gotSelectedTextChanged) |
| t.done(); |
| }); |
| |
| axRootElement.setNotificationListener(function(notification, intents) { |
| if (notification == 'DocumentSelectionChanged') { |
| assert_array_equals(intents, |
| ['AXEventIntent(setSelection,none,character,forward)']); |
| gotDocumentSelectionChanged = true; |
| axRootElement.unsetNotificationListener(); |
| succeedIfDone(); |
| } |
| }); |
| |
| axInputElement.setNotificationListener(function(notification, intents) { |
| if (notification == 'SelectedTextChanged') { |
| assert_array_equals(intents, |
| ['AXEventIntent(setSelection,none,character,forward)']); |
| gotSelectedTextChanged = true; |
| axInputElement.unsetNotificationListener(); |
| succeedIfDone(); |
| } |
| }); |
| |
| inputElement.setSelectionRange(0, 1); |
| }); |
| |
| </script> |