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() { ...@@ -401,36 +401,28 @@ TEST_F('ChromeVoxBackgroundTest', 'FocusInputElement', function() {
}.bind(this)); }.bind(this));
}); });
// Flaky, see https://crbug.com/622387. TEST_F('ChromeVoxBackgroundTest', 'UseEditableState', function() {
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_UseEditableState', function() { const site = `
this.runWithLoadedTree(
`
<input type="text"></input> <input type="text"></input>
<p tabindex=0>hi</p> <p tabindex=0>hi</p>
`, `;
function(rootNode) { this.runWithLoadedTree(site, async function(rootNode) {
const assertExists = this.newCallback(function(evt) { const nonEditable = rootNode.find({role: RoleType.PARAGRAPH});
assertNotNullNorUndefined( const editable = rootNode.find({role: RoleType.TEXT_FIELD});
DesktopAutomationHandler.instance.textEditHandler);
evt.stopPropagation(); nonEditable.focus();
await new Promise(resolve => {
this.listenOnce(nonEditable, 'focus', resolve);
}); });
const assertDoesntExist = this.newCallback(function(evt) { assertTrue(!DesktopAutomationHandler.instance.textEditHandler);
assertTrue(!DesktopAutomationHandler.instance.textEditHandler
.editableTextHandler_);
evt.stopPropagation();
// Focus the other text field here to make this test not racey.
editable.focus(); 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() { TEST_F('ChromeVoxBackgroundTest', 'EarconsForControls', function() {
...@@ -1181,22 +1173,22 @@ TEST_F('ChromeVoxBackgroundTest', 'HeadingLevels', function() { ...@@ -1181,22 +1173,22 @@ TEST_F('ChromeVoxBackgroundTest', 'HeadingLevels', function() {
}); });
}); });
// Flaky, see https://crbug.com/622387. TEST_F('ChromeVoxBackgroundTest', 'EditableNavigation', function() {
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_EditableNavigation', function() {
const mockFeedback = this.createMockFeedback(); const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree( const site = `
`
<div contenteditable>this is a test</div> <div contenteditable>this is a test</div>
`, `;
function(root) { this.runWithLoadedTree(site, function(root) {
mockFeedback.call(doCmd('nextObject')) mockFeedback.call(doCmd('nextObject'))
.expectSpeech('this is a test') .expectSpeech('this is a test')
.call(doCmd('nextObject')) .call(doCmd('nextObject'))
.expectSpeech(/data*/)
.call(doCmd('nextObject'))
.expectSpeech('this is a test') .expectSpeech('this is a test')
.call(doCmd('nextWord')) .call(doCmd('nextWord'))
.expectSpeech('is', 'selected') .expectSpeech('is')
.call(doCmd('nextWord'))
.expectSpeech('a')
.call(doCmd('nextWord'))
.expectSpeech('test')
.replay(); .replay();
}); });
}); });
...@@ -1368,20 +1360,18 @@ TEST_F('ChromeVoxBackgroundTest', 'NodeVsSubnode', function() { ...@@ -1368,20 +1360,18 @@ TEST_F('ChromeVoxBackgroundTest', 'NodeVsSubnode', function() {
}); });
}); });
// TODO(crbug.com/1085666): Test is flaky. TEST_F('ChromeVoxBackgroundTest', 'NativeFind', function() {
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_NativeFind', function() {
const mockFeedback = this.createMockFeedback(); const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree( const site = `
`
<a href="#">grape</a> <a href="#">grape</a>
<a href="#">pineapple</a> <a href="#">pineapple</a>
`, `;
function(root) { this.runWithLoadedTree(site, function(root) {
mockFeedback.call(press(KeyCode.F, {ctrl: true})) mockFeedback.call(press(KeyCode.F, {ctrl: true}))
.expectSpeech('Find', 'Edit text') .expectSpeech('Find', 'Edit text')
.call(press(KeyCode.G)) .call(press(KeyCode.G))
.expectSpeech('grape', 'Link') .expectSpeech('grape', 'Link')
.call(press(KeyCode.Back)) .call(press(KeyCode.BACK))
.call(press(KeyCode.L)) .call(press(KeyCode.L))
.expectSpeech('pineapple', 'Link') .expectSpeech('pineapple', 'Link')
.replay(); .replay();
...@@ -1519,41 +1509,35 @@ TEST_F('ChromeVoxBackgroundTest', 'TableColumnHeaders', function() { ...@@ -1519,41 +1509,35 @@ TEST_F('ChromeVoxBackgroundTest', 'TableColumnHeaders', function() {
}); });
}); });
// Flaky, see https://crbug.com/622387. TEST_F('ChromeVoxBackgroundTest', 'ActiveDescendantUpdates', function() {
TEST_F(
'ChromeVoxBackgroundTest', 'DISABLED_ActiveDescendantUpdates', function() {
const mockFeedback = this.createMockFeedback(); const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree( const site = `
`
<div aria-label="container" tabindex=0 role="group" id="active" <div aria-label="container" tabindex=0 role="group" id="active"
aria-activedescendant="1"> aria-activedescendant="1">
<div id="1" role="treeitem"></div> <div id="1" role="treeitem" aria-selected="false"></div>
<div id="2" role="treeitem"></div> <div id="2" role="treeitem" aria-selected="true"></div>
<script> <script>
let alt = false; let alt = false;
let active = document.getElementById('active'); let active = document.getElementById('active');
let one = document.getElementById('1'); let one = document.getElementById('1');
let two = document.getElementById('2'); let two = document.getElementById('2');
active.addEventListener('click', function() { active.addEventListener('click', function() {
let sel = alt ? one : two; let descendant = alt ? one : two;
let unsel = alt ? two : one; active.setAttribute('aria-activedescendant', descendant.id);
active.setAttribute('aria-activedescendant', sel.id);
sel.setAttribute('aria-selected', true);
unsel.setAttribute('aria-selected', false);
alt = !alt; alt = !alt;
}); });
</script> </script>
`, `;
function(root) { this.runWithLoadedTree(site, function(root) {
const group = root.firstChild; const group = root.firstChild;
mockFeedback.call(group.focus.bind(group)) mockFeedback.call(group.focus.bind(group))
.call(group.doDefault.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)) .call(group.doDefault.bind(group))
.expectSpeech('Tree item', 'Selected', ' 1 of 2 ') .expectSpeech('Tree item', 'Not selected', ' 1 of 2 ')
.replay(); .replay();
}); });
}); });
TEST_F('ChromeVoxBackgroundTest', 'NavigationEscapesEdit', function() { TEST_F('ChromeVoxBackgroundTest', 'NavigationEscapesEdit', function() {
const mockFeedback = this.createMockFeedback(); const mockFeedback = this.createMockFeedback();
...@@ -1628,26 +1612,32 @@ TEST_F('ChromeVoxBackgroundTest', 'NavigationEscapesEdit', function() { ...@@ -1628,26 +1612,32 @@ TEST_F('ChromeVoxBackgroundTest', 'NavigationEscapesEdit', function() {
}); });
}); });
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_NavigationSyncsSelect', function() { TEST_F('ChromeVoxBackgroundTest', 'SelectDoesNotSyncNavigation', function() {
const mockFeedback = this.createMockFeedback(); const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree( const site = `
`
<select> <select>
<option>apple</option> <option>apple</option>
<option>grape</option> <option>grape</option>
</select> </select>
`, `;
function(root) { this.runWithLoadedTree(site, function(root) {
const select = root.find({role: RoleType.POP_UP_BUTTON}); const select = root.find({role: RoleType.POP_UP_BUTTON});
mockFeedback.call(select.doDefault.bind(select)) mockFeedback.expectSpeech('Button', 'has pop up', 'Collapsed')
.expectSpeech('apple', 'Menu item', ' 1 of 2 ') .call(select.doDefault.bind(select))
.call(doCmd('nextObject')) .expectSpeech('Expanded')
.expectNextSpeechUtteranceIsNot('Selected') .call(
.expectNextSpeechUtteranceIsNot('Unselected') () => assertEquals(
.expectSpeech('grape', 'Menu item') select, ChromeVoxState.instance.currentRange.start.node))
.expectNextSpeechUtteranceIsNot('Selected') .call(press(KeyCode.DOWN))
.expectNextSpeechUtteranceIsNot('Unselected') .expectSpeech('grape', 'List item', ' 2 of 2 ')
.expectSpeech(' 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(); .replay();
}); });
}); });
...@@ -2025,13 +2015,12 @@ TEST_F('ChromeVoxBackgroundTest', 'AriaSliderWithValueText', function() { ...@@ -2025,13 +2015,12 @@ TEST_F('ChromeVoxBackgroundTest', 'AriaSliderWithValueText', function() {
}); });
}); });
// See https://crbug.com/924976 TEST_F('ChromeVoxBackgroundTest', 'SelectValidityOutput', function() {
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_ValidationTest', function() {
const mockFeedback = this.createMockFeedback(); const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree( const site = `
` <p>start</p>
<label for="in1">Name:</label> <label for="in1">Name:</label>
<input id="in1" required autofocus> <input id="in1" required>
<script> <script>
const in1 = document.querySelector('input'); const in1 = document.querySelector('input');
in1.addEventListener('focus', () => { in1.addEventListener('focus', () => {
...@@ -2041,9 +2030,11 @@ TEST_F('ChromeVoxBackgroundTest', 'DISABLED_ValidationTest', function() { ...@@ -2041,9 +2030,11 @@ TEST_F('ChromeVoxBackgroundTest', 'DISABLED_ValidationTest', function() {
}, 500); }, 500);
}); });
</script> </script>
`, `;
function(root) { this.runWithLoadedTree(site, function(root) {
mockFeedback.expectSpeech('Name:') mockFeedback.expectSpeech('start')
.call(doCmd('nextObject'))
.expectSpeech('Name:')
.expectSpeech('Edit text') .expectSpeech('Edit text')
.expectSpeech('Required') .expectSpeech('Required')
.expectSpeech('Alert') .expectSpeech('Alert')
...@@ -2070,15 +2061,13 @@ TEST_F('ChromeVoxBackgroundTest', 'EventFromAction', function() { ...@@ -2070,15 +2061,13 @@ TEST_F('ChromeVoxBackgroundTest', 'EventFromAction', function() {
}); });
}); });
TEST_F('ChromeVoxBackgroundTest', 'DISABLED_EventFromUser', function() { TEST_F('ChromeVoxBackgroundTest', 'EventFromUser', function() {
this.runWithLoadedTree( const site = `
`
<button>ok</button><button>cancel</button> <button>ok</button><button>cancel</button>
`, `;
function(root) { this.runWithLoadedTree(site, function(root) {
const button = root.findAll({role: RoleType.BUTTON})[1]; const button = root.findAll({role: RoleType.BUTTON})[1];
button.addEventListener( button.addEventListener(EventType.FOCUS, this.newCallback(function(evt) {
EventType.FOCUS, this.newCallback(function(evt) {
assertEquals(RoleType.BUTTON, evt.target.role); assertEquals(RoleType.BUTTON, evt.target.role);
assertEquals('user', evt.eventFrom); assertEquals('user', evt.eventFrom);
assertEquals('cancel', evt.target.name); 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