Commit b50f0971 authored by David Tseng's avatar David Tseng Committed by Chromium LUCI CQ

Fix and re-enable tests in c/b/r/c/a/c/b/background_test.js

R=akihiroota@chromium.org

AX-Relnotes: n/a
Fixed: 924976, 622387, 1085666
Change-Id: Id331e8cb005a54b2cbd804ac563b8c814bc80668
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2585680Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836257}
parent 2f8ad5bd
......@@ -401,36 +401,28 @@ TEST_F('ChromeVoxBackgroundTest', 'FocusInputElement', function() {
}.bind(this));
});
// Flaky, see https://crbug.com/622387.
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_UseEditableState', function() {
this.runWithLoadedTree(
`
TEST_F('ChromeVoxBackgroundTest', 'UseEditableState', function() {
const site = `
<input type="text"></input>
<p tabindex=0>hi</p>
`,
function(rootNode) {
const assertExists = this.newCallback(function(evt) {
assertNotNullNorUndefined(
DesktopAutomationHandler.instance.textEditHandler);
evt.stopPropagation();
`;
this.runWithLoadedTree(site, async function(rootNode) {
const nonEditable = rootNode.find({role: RoleType.PARAGRAPH});
const editable = rootNode.find({role: RoleType.TEXT_FIELD});
nonEditable.focus();
await new Promise(resolve => {
this.listenOnce(nonEditable, 'focus', resolve);
});
const assertDoesntExist = this.newCallback(function(evt) {
assertTrue(!DesktopAutomationHandler.instance.textEditHandler
.editableTextHandler_);
evt.stopPropagation();
assertTrue(!DesktopAutomationHandler.instance.textEditHandler);
// Focus the other text field here to make this test not racey.
editable.focus();
await new Promise(resolve => {
this.listenOnce(editable, 'focus', resolve);
});
assertNotNullNorUndefined(
DesktopAutomationHandler.instance.textEditHandler);
});
const editable = rootNode.find({role: RoleType.TEXT_FIELD});
const nonEditable = rootNode.find({role: RoleType.PARAGRAPH});
this.listenOnce(nonEditable, 'focus', assertDoesntExist);
this.listenOnce(editable, 'focus', assertExists);
nonEditable.focus();
}.bind(this));
});
TEST_F('ChromeVoxBackgroundTest', 'EarconsForControls', function() {
......@@ -1181,22 +1173,22 @@ TEST_F('ChromeVoxBackgroundTest', 'HeadingLevels', function() {
});
});
// Flaky, see https://crbug.com/622387.
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_EditableNavigation', function() {
TEST_F('ChromeVoxBackgroundTest', 'EditableNavigation', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
const site = `
<div contenteditable>this is a test</div>
`,
function(root) {
`;
this.runWithLoadedTree(site, function(root) {
mockFeedback.call(doCmd('nextObject'))
.expectSpeech('this is a test')
.call(doCmd('nextObject'))
.expectSpeech(/data*/)
.call(doCmd('nextObject'))
.expectSpeech('this is a test')
.call(doCmd('nextWord'))
.expectSpeech('is', 'selected')
.expectSpeech('is')
.call(doCmd('nextWord'))
.expectSpeech('a')
.call(doCmd('nextWord'))
.expectSpeech('test')
.replay();
});
});
......@@ -1368,20 +1360,18 @@ TEST_F('ChromeVoxBackgroundTest', 'NodeVsSubnode', function() {
});
});
// TODO(crbug.com/1085666): Test is flaky.
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_NativeFind', function() {
TEST_F('ChromeVoxBackgroundTest', 'NativeFind', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
const site = `
<a href="#">grape</a>
<a href="#">pineapple</a>
`,
function(root) {
`;
this.runWithLoadedTree(site, function(root) {
mockFeedback.call(press(KeyCode.F, {ctrl: true}))
.expectSpeech('Find', 'Edit text')
.call(press(KeyCode.G))
.expectSpeech('grape', 'Link')
.call(press(KeyCode.Back))
.call(press(KeyCode.BACK))
.call(press(KeyCode.L))
.expectSpeech('pineapple', 'Link')
.replay();
......@@ -1519,41 +1509,35 @@ TEST_F('ChromeVoxBackgroundTest', 'TableColumnHeaders', function() {
});
});
// Flaky, see https://crbug.com/622387.
TEST_F(
'ChromeVoxBackgroundTest', 'DISABLED_ActiveDescendantUpdates', function() {
TEST_F('ChromeVoxBackgroundTest', 'ActiveDescendantUpdates', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
const site = `
<div aria-label="container" tabindex=0 role="group" id="active"
aria-activedescendant="1">
<div id="1" role="treeitem"></div>
<div id="2" role="treeitem"></div>
<div id="1" role="treeitem" aria-selected="false"></div>
<div id="2" role="treeitem" aria-selected="true"></div>
<script>
let alt = false;
let active = document.getElementById('active');
let one = document.getElementById('1');
let two = document.getElementById('2');
active.addEventListener('click', function() {
let sel = alt ? one : two;
let unsel = alt ? two : one;
active.setAttribute('aria-activedescendant', sel.id);
sel.setAttribute('aria-selected', true);
unsel.setAttribute('aria-selected', false);
let descendant = alt ? one : two;
active.setAttribute('aria-activedescendant', descendant.id);
alt = !alt;
});
</script>
`,
function(root) {
`;
this.runWithLoadedTree(site, function(root) {
const group = root.firstChild;
mockFeedback.call(group.focus.bind(group))
.call(group.doDefault.bind(group))
.expectSpeech('Tree item', 'Selected', ' 2 of 2 ')
.expectSpeech('Tree item', ' 2 of 2 ')
.call(group.doDefault.bind(group))
.expectSpeech('Tree item', 'Selected', ' 1 of 2 ')
.expectSpeech('Tree item', 'Not selected', ' 1 of 2 ')
.replay();
});
});
});
TEST_F('ChromeVoxBackgroundTest', 'NavigationEscapesEdit', function() {
const mockFeedback = this.createMockFeedback();
......@@ -1628,26 +1612,32 @@ TEST_F('ChromeVoxBackgroundTest', 'NavigationEscapesEdit', function() {
});
});
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_NavigationSyncsSelect', function() {
TEST_F('ChromeVoxBackgroundTest', 'SelectDoesNotSyncNavigation', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
const site = `
<select>
<option>apple</option>
<option>grape</option>
</select>
`,
function(root) {
`;
this.runWithLoadedTree(site, function(root) {
const select = root.find({role: RoleType.POP_UP_BUTTON});
mockFeedback.call(select.doDefault.bind(select))
.expectSpeech('apple', 'Menu item', ' 1 of 2 ')
.call(doCmd('nextObject'))
.expectNextSpeechUtteranceIsNot('Selected')
.expectNextSpeechUtteranceIsNot('Unselected')
.expectSpeech('grape', 'Menu item')
.expectNextSpeechUtteranceIsNot('Selected')
.expectNextSpeechUtteranceIsNot('Unselected')
.expectSpeech(' 2 of 2 ')
mockFeedback.expectSpeech('Button', 'has pop up', 'Collapsed')
.call(select.doDefault.bind(select))
.expectSpeech('Expanded')
.call(
() => assertEquals(
select, ChromeVoxState.instance.currentRange.start.node))
.call(press(KeyCode.DOWN))
.expectSpeech('grape', 'List item', ' 2 of 2 ')
.call(
() => assertEquals(
select, ChromeVoxState.instance.currentRange.start.node))
.call(press(KeyCode.UP))
.expectSpeech('apple', 'List item', ' 1 of 2 ')
.call(
() => assertEquals(
select, ChromeVoxState.instance.currentRange.start.node))
.replay();
});
});
......@@ -2025,13 +2015,12 @@ TEST_F('ChromeVoxBackgroundTest', 'AriaSliderWithValueText', function() {
});
});
// See https://crbug.com/924976
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_ValidationTest', function() {
TEST_F('ChromeVoxBackgroundTest', 'SelectValidityOutput', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
const site = `
<p>start</p>
<label for="in1">Name:</label>
<input id="in1" required autofocus>
<input id="in1" required>
<script>
const in1 = document.querySelector('input');
in1.addEventListener('focus', () => {
......@@ -2041,9 +2030,11 @@ TEST_F('ChromeVoxBackgroundTest', 'DISABLED_ValidationTest', function() {
}, 500);
});
</script>
`,
function(root) {
mockFeedback.expectSpeech('Name:')
`;
this.runWithLoadedTree(site, function(root) {
mockFeedback.expectSpeech('start')
.call(doCmd('nextObject'))
.expectSpeech('Name:')
.expectSpeech('Edit text')
.expectSpeech('Required')
.expectSpeech('Alert')
......@@ -2070,15 +2061,13 @@ TEST_F('ChromeVoxBackgroundTest', 'EventFromAction', function() {
});
});
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_EventFromUser', function() {
this.runWithLoadedTree(
`
TEST_F('ChromeVoxBackgroundTest', 'EventFromUser', function() {
const site = `
<button>ok</button><button>cancel</button>
`,
function(root) {
`;
this.runWithLoadedTree(site, function(root) {
const button = root.findAll({role: RoleType.BUTTON})[1];
button.addEventListener(
EventType.FOCUS, this.newCallback(function(evt) {
button.addEventListener(EventType.FOCUS, this.newCallback(function(evt) {
assertEquals(RoleType.BUTTON, evt.target.role);
assertEquals('user', evt.eventFrom);
assertEquals('cancel', evt.target.name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment