forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a user selection for number reading style
Also: - fixes the handling of menuItemSelected to only be respected from a focused node (Chrome now fires it more noisely) - add a full test suite for options page testing which drives the UI end to end and verifies local ChromeVox state (this motivated the above fix) - noticed a regression in the way <select> nodes work (TODO'ed and not handled fixing in this change) - adds a unit test for verifying number style reading behavior Test: see above Change-Id: I4dce435c6de54399128c1a21f805671b54ac3904 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003895 Commit-Queue: David Tseng <dtseng@chromium.org> Reviewed-by: Akihiro Ota <akihiroota@chromium.org> Cr-Commit-Position: refs/heads/master@{#741209}
- Loading branch information
1 parent
2810e71
commit 6663f03
Showing
11 changed files
with
202 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
chrome/browser/resources/chromeos/accessibility/chromevox/background/options/options_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Include test fixture. | ||
GEN_INCLUDE([ | ||
'../../testing/chromevox_next_e2e_test_base.js', | ||
'//chrome/browser/resources/chromeos/accessibility/chromevox/testing/assert_additions.js', | ||
'//chrome/browser/resources/chromeos/accessibility/chromevox/testing/mock_feedback.js' | ||
]); | ||
|
||
/** | ||
* Test fixture for ChromeVox options page. | ||
*/ | ||
ChromeVoxOptionsTest = class extends ChromeVoxNextE2ETest { | ||
constructor() { | ||
super(); | ||
window.press = this.press; | ||
} | ||
|
||
runOnOptionsPage(callback) { | ||
const mockFeedback = this.createMockFeedback(); | ||
chrome.automation.getDesktop((desktop) => { | ||
desktop.addEventListener( | ||
chrome.automation.EventType.LOAD_COMPLETE, (evt) => { | ||
if (evt.target.docUrl.indexOf('background/options/options.html') == | ||
-1 || | ||
!evt.target.docLoaded) { | ||
return; | ||
} | ||
|
||
mockFeedback.expectSpeech('ChromeVox Options'); | ||
callback(mockFeedback, evt); | ||
}); | ||
CommandHandler.onCommand('showOptionsPage'); | ||
}); | ||
} | ||
|
||
/** | ||
* @return {!MockFeedback} | ||
*/ | ||
createMockFeedback() { | ||
const mockFeedback = | ||
new MockFeedback(this.newCallback(), this.newCallback.bind(this)); | ||
mockFeedback.install(); | ||
return mockFeedback; | ||
} | ||
|
||
press(keyCode, modifiers) { | ||
return function() { | ||
BackgroundKeyboardHandler.sendKeyPress(keyCode, modifiers); | ||
}; | ||
} | ||
}; | ||
|
||
TEST_F('ChromeVoxOptionsTest', 'NumberReadingStyleSelect', function() { | ||
this.runOnOptionsPage((mockFeedback, evt) => { | ||
const numberStyleSelect = evt.target.find({ | ||
role: chrome.automation.RoleType.POP_UP_BUTTON, | ||
attributes: {name: 'Read numbers as:'} | ||
}); | ||
assertNotNullNorUndefined(numberStyleSelect); | ||
mockFeedback.call(numberStyleSelect.focus.bind(numberStyleSelect)) | ||
.expectSpeech('Read numbers as:', 'Words', 'Collapsed') | ||
.call(numberStyleSelect.doDefault.bind(numberStyleSelect)) | ||
.expectSpeech('Expanded') | ||
|
||
// Before selecting the menu option. | ||
.call(() => { | ||
assertEquals('asWords', localStorage['numberReadingStyle']); | ||
}) | ||
|
||
.call(press(40 /* ArrowDown */)) | ||
.expectSpeech('Digits', 'Menu item', ' 2 of 2 ') | ||
.call(press(13 /* enter */)) | ||
|
||
// TODO: The underlying select behavior here is unexpected because we | ||
// never get a new focus event for the select (moving us away from the | ||
// menu item). We simply repeat the menu item. | ||
.expectSpeech('Digits', 'Menu item', ' 2 of 2 ') | ||
.call(() => { | ||
assertEquals('asDigits', localStorage['numberReadingStyle']); | ||
}) | ||
|
||
.replay(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters