Commit 24d7413c authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Add spoken feedback for ejecting a volume

Add a message to screen reader once a volume has been ejected, it uses
|speakA11yMessage| function introduced on crrev.com/c/1347956.

--gtest_filter="Providers/FilesAppBrowserTest.Test/providerEject"

Test: browser_test
Bug: 758638
Change-Id: I16e20f828c05368a41046d71fcfbcf04cfb212f4
Reviewed-on: https://chromium-review.googlesource.com/c/1348880Reviewed-by: default avatarAnand Mistry <amistry@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610526}
parent 3f5b1841
......@@ -1268,6 +1268,9 @@
<message name="IDS_FILE_BROWSER_OPEN_A11Y_PLURAL" desc="Text to be used by screen reader to indicate users that the opening multiple files is being executed.">
Opening <ph name="NUMBER_FILES"> $1<ex>3</ex> files.</ph>
</message>
<message name="IDS_FILE_BROWSER_A11Y_VOLUME_EJECT" desc="Text to be used by screen reader to indicate users that the eject volume action has finished.">
<ph name="VOLUME_NAME">$1<ex>file_name.rar</ex> has been ejected.</ph>
</message>
<!-- Common for Audio player and Media player -->
<message name="IDS_MEDIA_PLAYER_PLAY_BUTTON_LABEL" desc="Label for the Play button of media players (audio player / video player).">
......
04111c75cd9cf7f0ef9310dbeff0c51ffbaf90f5
\ No newline at end of file
......@@ -830,6 +830,7 @@ ExtensionFunction::ResponseAction FileManagerPrivateGetStringsFunction::Run() {
SET_STRING("SEE_MENU_FOR_ACTIONS", IDS_FILE_BROWSER_SEE_MENU_FOR_ACTIONS);
SET_STRING("OPEN_A11Y", IDS_FILE_BROWSER_OPEN_A11Y);
SET_STRING("OPEN_A11Y_PLURAL", IDS_FILE_BROWSER_OPEN_A11Y_PLURAL);
SET_STRING("A11Y_VOLUME_EJECT", IDS_FILE_BROWSER_A11Y_VOLUME_EJECT);
SET_STRING("FILEMANAGER_APP_NAME", IDS_FILEMANAGER_APP_NAME);
#undef SET_STRING
......
......@@ -734,7 +734,8 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
::testing::Values(TestCase("requestMount"),
TestCase("requestMountMultipleMounts"),
TestCase("requestMountSourceDevice"),
TestCase("requestMountSourceFile")));
TestCase("requestMountSourceFile"),
TestCase("providerEject")));
WRAPPED_INSTANTIATE_TEST_CASE_P(
GearMenu, /* gear_menu.js */
......
......@@ -530,7 +530,10 @@ CommandHandler.COMMANDS_['unmount'] = /** @type {Command} */ ({
return;
}
fileManager.volumeManager.unmount(volumeInfo, function() {
const label = volumeInfo.label || '';
fileManager.volumeManager.unmount(volumeInfo, () => {
const msg = strf('A11Y_VOLUME_EJECT', label);
fileManager.ui.speakA11yMessage(msg);
}, errorCallback.bind(null, volumeInfo.volumeType));
},
/**
......
......@@ -271,4 +271,43 @@ testcase.requestMountSourceFile = function() {
requestMountNotInMenuInternal('manifest_source_file.json');
};
/**
* Tests that pressing the eject button on a FSP adds a message to screen
* reader.
*/
testcase.providerEject = function() {
const manifest = 'manifest_source_file.json';
const steps = getSetupSteps(manifest).concat([
// Click to eject Test (1) provider/volume.
function() {
const ejectQuery =
['#directory-tree [volume-type-for-testing="provided"] .root-eject'];
remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ejectQuery, this.next);
},
// Wait a11y-msg to have some text.
function(result) {
chrome.test.assertTrue(result, 'click eject failed');
remoteCall.waitForElement(appId, '#a11y-msg:not(:empty)').then(this.next);
},
// Fetch A11y messages.
function() {
remoteCall.callRemoteTestUtil('getA11yAnnounces', appId, [])
.then(this.next);
},
// Check that opening the file was announced to screen reader.
function(a11yMessages) {
chrome.test.assertTrue(a11yMessages instanceof Array);
chrome.test.assertEq(1, a11yMessages.length);
chrome.test.assertEq('Test (1) has been ejected.', a11yMessages[0]);
this.next();
},
function() {
checkIfNoErrorsOccured(this.next);
}
]);
StepsRunner.run(steps);
};
})();
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