Commit 778a1f2f authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[OsSettingsDeepLinking] Add deep links to the A11y page

Adds deep links to the A11y page as well as the Manage A11y, Text
to Speech, and Switch Access subpages. Adds tests for the A11y page
and Text to Speech subpage.

Bug: 1084154
Change-Id: I822a128b7230d9fb6de250294b3e00e2e17d01bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391785
Commit-Queue: Daniel Classon <dclasson@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805580}
parent 44bea438
......@@ -28,6 +28,7 @@ js_library("os_a11y_page_browser_proxy") {
js_library("os_a11y_page") {
deps = [
":os_a11y_page_browser_proxy",
"..:deep_linking_behavior",
"..:os_route",
"../../:router",
"../../settings_page:settings_animated_pages",
......@@ -44,6 +45,7 @@ js_library("manage_a11y_page_browser_proxy") {
js_library("manage_a11y_page") {
deps = [
":manage_a11y_page_browser_proxy",
"..:deep_linking_behavior",
"..:os_route",
"..:route_origin_behavior",
"../..:router",
......@@ -60,6 +62,8 @@ js_library("switch_access_constants") {
js_library("switch_access_subpage") {
deps = [
":switch_access_constants",
"..:deep_linking_behavior",
"..:os_route",
"../..:router",
"../../prefs:prefs_behavior",
"//ui/webui/resources/js:i18n_behavior",
......@@ -78,6 +82,8 @@ js_library("tts_subpage") {
deps = [
":externs",
":tts_subpage_browser_proxy",
"..:deep_linking_behavior",
"..:os_route",
"../..:router",
"../../controls:settings_slider",
"../../languages_page:languages_browser_proxy",
......
......@@ -8,6 +8,7 @@
<link rel="import" href="../../controls/settings_slider.html">
<link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../deep_linking_behavior.html">
<link rel="import" href="../os_route.html">
<link rel="import" href="../../router.html">
<link rel="import" href="../../settings_shared_css.html">
......@@ -50,7 +51,8 @@
<h2>$i18n{textToSpeechHeading}</h2>
<settings-toggle-button
pref="{{prefs.settings.accessibility}}"
label="$i18n{chromeVoxLabel}">
label="$i18n{chromeVoxLabel}"
deep-link-focus-id$="[[Setting.kChromeVox]]">
</settings-toggle-button>
<iron-collapse opened="[[prefs.settings.accessibility.value]]">
<cr-link-row id="chromeVoxSubpageButton"
......@@ -65,7 +67,8 @@
prefs.settings.a11y.select_to_speak.value, hasKeyboard_,
'$i18nPolymer{selectToSpeakDisabledDescription}',
'$i18nPolymer{selectToSpeakDescription}',
'$i18nPolymer{selectToSpeakDescriptionWithoutKeyboard}')]]">
'$i18nPolymer{selectToSpeakDescriptionWithoutKeyboard}')]]"
deep-link-focus-id$="[[Setting.kSelectToSpeak]]">
</settings-toggle-button>
<iron-collapse opened="[[prefs.settings.a11y.select_to_speak.value]]">
<cr-link-row id="selectToSpeakSubpageButton"
......@@ -82,13 +85,15 @@
<h2>$i18n{displayHeading}</h2>
<settings-toggle-button
pref="{{prefs.settings.a11y.high_contrast_enabled}}"
label="$i18n{highContrastLabel}">
label="$i18n{highContrastLabel}"
deep-link-focus-id$="[[Setting.kHighContrastMode]]">
</settings-toggle-button>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.screen_magnifier}}"
label="$i18n{screenMagnifierLabel}"
disabled="[[prefs.ash.docked_magnifier.enabled.value]]">
disabled="[[prefs.ash.docked_magnifier.enabled.value]]"
deep-link-focus-id$="[[Setting.kFullscreenMagnifier]]">
</settings-toggle-button>
<template is="dom-if" if="[[prefs.settings.a11y.screen_magnifier.value]]">
<div class="settings-box continuation">
......@@ -106,7 +111,8 @@
class="hr"
pref="{{prefs.ash.docked_magnifier.enabled}}"
label="$i18n{dockedMagnifierLabel}"
disabled="[[prefs.settings.a11y.screen_magnifier.value]]">
disabled="[[prefs.settings.a11y.screen_magnifier.value]]"
deep-link-focus-id$="[[Setting.kDockedMagnifier]]">
</settings-toggle-button>
<template is="dom-if" if="[[prefs.ash.docked_magnifier.enabled.value]]">
<div class="settings-box continuation">
......@@ -135,34 +141,41 @@
<h2>$i18n{keyboardAndTextInputHeading}</h2>
<settings-toggle-button
pref="{{prefs.settings.a11y.sticky_keys_enabled}}"
label="$i18n{stickyKeysLabel}">
label="$i18n{stickyKeysLabel}"
deep-link-focus-id$="[[Setting.kStickyKeys]]">
</settings-toggle-button>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.virtual_keyboard}}"
label="$i18n{onScreenKeyboardLabel}">
label="$i18n{onScreenKeyboardLabel}"
deep-link-focus-id$="[[Setting.kOnScreenKeyboard]]">
</settings-toggle-button>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.dictation}}"
label="$i18n{dictationLabel}"
sub-label="$i18n{dictationDescription}">
sub-label="$i18n{dictationDescription}"
deep-link-focus-id$="[[Setting.kDictation]]">
</settings-toggle-button>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.focus_highlight}}"
label="$i18n{focusHighlightLabel}">
label="$i18n{focusHighlightLabel}"
deep-link-focus-id$="[[Setting.kHighlightKeyboardFocus]]">
</settings-toggle-button>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.caret_highlight}}"
label="$i18n{caretHighlightLabel}">
label="$i18n{caretHighlightLabel}"
deep-link-focus-id$="[[Setting.kHighlightTextCaret]]">
</settings-toggle-button>
<template is="dom-if" if="[[!isKioskModeActive_]]">
<settings-toggle-button
id="enableSwitchAccess"
class="hr"
pref="{{prefs.settings.a11y.switch_access.enabled}}"
label="$i18n{switchAccessLabel}">
label="$i18n{switchAccessLabel}"
deep-link-focus-id$="[[Setting.kEnableSwitchAccess]]">
</settings-toggle-button>
<iron-collapse
opened="[[prefs.settings.a11y.switch_access.enabled.value]]">
......@@ -182,7 +195,8 @@
<h2>$i18n{mouseAndTouchpadHeading}</h2>
<settings-toggle-button
pref="{{prefs.settings.a11y.autoclick}}"
label="$i18n{clickOnStopLabel}">
label="$i18n{clickOnStopLabel}"
deep-link-focus-id$="[[Setting.kAutoClickWhenCursorStops]]">
</settings-toggle-button>
<div class="settings-box continuation"
hidden$="[[!prefs.settings.a11y.autoclick.value]]">
......@@ -224,7 +238,8 @@
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.large_cursor_enabled}}"
label="$i18n{largeMouseCursorLabel}">
label="$i18n{largeMouseCursorLabel}"
deep-link-focus-id$="[[Setting.kLargeCursor]]">
</settings-toggle-button>
<div class="settings-box continuation"
hidden$="[[!prefs.settings.a11y.large_cursor_enabled.value]]">
......@@ -247,14 +262,16 @@
<settings-dropdown-menu aria-labeledby="cursorColorOptionsLabel"
pref="{{prefs.settings.a11y.cursor_color}}"
menu-options="[[cursorColorOptions_]]"
on-settings-control-change="onA11yCursorColorChange_">
on-settings-control-change="onA11yCursorColorChange_"
deep-link-focus-id$="[[Setting.kEnableCursorColor]]">
</settings-dropdown-menu>
</div>
</template>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.cursor_highlight}}"
label="$i18n{cursorHighlightLabel}">
label="$i18n{cursorHighlightLabel}"
deep-link-focus-id$="[[Setting.kHighlightCursorWhileMoving]]">
</settings-toggle-button>
<cr-link-row id="pointerSubpageButton" class="hr"
label="$i18n{mouseSettingsTitle}" on-click="onMouseTap_"
......@@ -279,7 +296,8 @@
label="$i18n{tabletModeShelfNavigationButtonsSettingLabel}"
sub-label="$i18n{tabletModeShelfNavigationButtonsSettingDescription}"
learn-more-url="$i18n{tabletModeShelfNavigationButtonsLearnMoreUrl}"
on-learn-more-clicked="onShelfNavigationButtonsLearnMoreClicked_">
on-learn-more-clicked="onShelfNavigationButtonsLearnMoreClicked_"
deep-link-focus-id$="[[Setting.kTabletNavigationButtons]]">
</settings-toggle-button>
<h2>$i18n{audioAndCaptionsHeading}</h2>
......@@ -295,19 +313,22 @@
pref="{{prefs.accessibility.captions.live_caption_enabled}}"
on-change="onA11yLiveCaptionChange_"
label="$i18n{captionsEnableLiveCaptionTitle}"
sub-label="$i18n{captionsEnableLiveCaptionSubtitle}">
sub-label="$i18n{captionsEnableLiveCaptionSubtitle}"
deep-link-focus-id$="[[Setting.kLiveCaptions]]">
</settings-toggle-button>
</template>
<settings-toggle-button
class="hr"
pref="{{prefs.settings.a11y.mono_audio}}"
label="$i18n{monoAudioLabel}">
label="$i18n{monoAudioLabel}"
deep-link-focus-id$="[[Setting.kMonoAudio]]">
</settings-toggle-button>
<settings-toggle-button id="startupSoundEnabled"
class="hr"
pref=" "
on-change="toggleStartupSoundEnabled_"
label="$i18n{startupSoundLabel}">
label="$i18n{startupSoundLabel}"
deep-link-focus-id$="[[Setting.kStartupSound]]">
</settings-toggle-button>
<template is="dom-if"
......
......@@ -13,7 +13,12 @@ const DEFAULT_BLACK_CURSOR_COLOR = 0;
Polymer({
is: 'settings-manage-a11y-page',
behaviors: [WebUIListenerBehavior, settings.RouteOriginBehavior],
behaviors: [
DeepLinkingBehavior,
settings.RouteObserverBehavior,
settings.RouteOriginBehavior,
WebUIListenerBehavior,
],
properties: {
/**
......@@ -230,6 +235,35 @@ Polymer({
'shelfNavigationButtonsImplicitlyEnabled_,' +
'prefs.settings.a11y.tablet_mode_shelf_nav_buttons_enabled)',
},
/**
* Used by DeepLinkingBehavior to focus this page's deep links.
* @type {!Set<!chromeos.settings.mojom.Setting>}
*/
supportedSettingIds: {
type: Object,
value: () => new Set([
chromeos.settings.mojom.Setting.kChromeVox,
chromeos.settings.mojom.Setting.kSelectToSpeak,
chromeos.settings.mojom.Setting.kHighContrastMode,
chromeos.settings.mojom.Setting.kFullscreenMagnifier,
chromeos.settings.mojom.Setting.kDockedMagnifier,
chromeos.settings.mojom.Setting.kStickyKeys,
chromeos.settings.mojom.Setting.kOnScreenKeyboard,
chromeos.settings.mojom.Setting.kDictation,
chromeos.settings.mojom.Setting.kHighlightKeyboardFocus,
chromeos.settings.mojom.Setting.kHighlightTextCaret,
chromeos.settings.mojom.Setting.kAutoClickWhenCursorStops,
chromeos.settings.mojom.Setting.kLargeCursor,
chromeos.settings.mojom.Setting.kHighlightCursorWhileMoving,
chromeos.settings.mojom.Setting.kTabletNavigationButtons,
chromeos.settings.mojom.Setting.kMonoAudio,
chromeos.settings.mojom.Setting.kStartupSound,
chromeos.settings.mojom.Setting.kEnableSwitchAccess,
chromeos.settings.mojom.Setting.kLiveCaptions,
chromeos.settings.mojom.Setting.kEnableCursorColor,
]),
},
},
observers: [
......@@ -284,6 +318,19 @@ Polymer({
this.addFocusConfig_(r.POINTERS, '#pointerSubpageButton');
},
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.MANAGE_ACCESSIBILITY) {
return;
}
this.attemptDeepLink();
},
/**
* @param {boolean} hasMouse
* @param {boolean} hasTouchpad
......
......@@ -5,6 +5,7 @@
<link rel="import" href="../../a11y_page/captions_subpage.html">
<link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../deep_linking_behavior.html">
<link rel="import" href="../os_route.html">
<link rel="import" href="../../router.html">
<link rel="import" href="../../settings_page/settings_animated_pages.html">
......@@ -28,14 +29,16 @@
pref="{{prefs.settings.a11y.enable_accessibility_image_labels}}"
on-change="onToggleAccessibilityImageLabels_"
label="$i18n{accessibleImageLabelsTitle}"
sub-label="$i18n{accessibleImageLabelsSubtitle}">
sub-label="$i18n{accessibleImageLabelsSubtitle}"
deep-link-focus-id$="[[Setting.kGetImageDescriptionsFromGoogle]]">
</settings-toggle-button>
</template>
<settings-toggle-button id="optionsInMenuToggle"
class="hr"
hidden="[[isKioskModeActive_]]"
label="$i18n{optionsInMenuLabel}"
pref="{{prefs.settings.a11y.enable_menu}}">
pref="{{prefs.settings.a11y.enable_menu}}"
deep-link-focus-id$="[[Setting.kA11yQuickSettings]]">
</settings-toggle-button>
<cr-link-row class="hr" id="subpage-trigger"
label="$i18n{manageAccessibilityFeatures}"
......
......@@ -10,7 +10,11 @@
Polymer({
is: 'os-settings-a11y-page',
behaviors: [WebUIListenerBehavior],
behaviors: [
DeepLinkingBehavior,
settings.RouteObserverBehavior,
WebUIListenerBehavior,
],
properties: {
/**
......@@ -60,6 +64,18 @@ Polymer({
return loadTimeData.getBoolean('isKioskModeActive');
}
},
/**
* Used by DeepLinkingBehavior to focus this page's deep links.
* @type {!Set<!chromeos.settings.mojom.Setting>}
*/
supportedSettingIds: {
type: Object,
value: () => new Set([
chromeos.settings.mojom.Setting.kA11yQuickSettings,
chromeos.settings.mojom.Setting.kGetImageDescriptionsFromGoogle,
]),
},
},
/** @private {?OsA11yPageBrowserProxy} */
......@@ -80,6 +96,19 @@ Polymer({
this.browserProxy_.a11yPageReady();
},
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.OS_ACCESSIBILITY) {
return;
}
this.attemptDeepLink();
},
/**
* @private
* @param {boolean} hasScreenReader Whether a screen reader is enabled.
......
......@@ -5,6 +5,9 @@
<link rel="import" href="../../controls/settings_dropdown_menu.html">
<link rel="import" href="../../controls/settings_slider.html">
<link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../deep_linking_behavior.html">
<link rel="import" href="../os_route.html">
<link rel="import" href="../../router.html">
<link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../../prefs/prefs_behavior.html">
<link rel="import" href="../../settings_shared_css.html">
......@@ -25,7 +28,8 @@
</div>
<settings-dropdown-menu label="$i18n{assignSelectSwitchLabel}"
pref="{{prefs.settings.a11y.switch_access.select.setting}}"
menu-options="[[optionsForSelect_]]" id="selectAssignmentDropdown">
menu-options="[[optionsForSelect_]]" id="selectAssignmentDropdown"
deep-link-focus-id$="[[Setting.kSwitchActionAssignment]]">
</settings-dropdown-menu>
</div>
<div class="settings-box continuation list-item">
......@@ -52,7 +56,8 @@
<div class="list-frame">
<settings-toggle-button class="list-item"
pref="{{prefs.settings.a11y.switch_access.auto_scan.enabled}}"
label="$i18n{switchAccessAutoScanLabel}">
label="$i18n{switchAccessAutoScanLabel}"
deep-link-focus-id$="[[Setting.kSwitchActionAutoScan]]">
</settings-toggle-button>
<div class="settings-box continuation list-item"
hidden$="[[!prefs.settings.a11y.switch_access.auto_scan.enabled.value]]">
......@@ -68,7 +73,7 @@
label-aria="$i18n{switchAccessAutoScanSpeedLabel}"
label-min="[[minScanSpeedLabelSec_]]"
label-max="[[maxScanSpeedLabelSec_]]">
</settings-dropdown-menu>
</settings-slider>
</div>
<div class="settings-box continuation list-item"
hidden$="[[!showKeyboardScanSettings_(
......@@ -84,8 +89,9 @@
max="[[maxScanSpeedMs_]]"
label-aria="$i18n{switchAccessAutoScanKeyboardSpeedLabel}"
label-min="[[minScanSpeedLabelSec_]]"
label-max="[[maxScanSpeedLabelSec_]]">
</settings-dropdown-menu>
label-max="[[maxScanSpeedLabelSec_]]"
deep-link-focus-id$="[[Setting.kSwitchActionAutoScanKeyboard]]">
</settings-slider>
</div>
</div>
</template>
......
......@@ -77,8 +77,10 @@ Polymer({
is: 'settings-switch-access-subpage',
behaviors: [
DeepLinkingBehavior,
I18nBehavior,
PrefsBehavior,
settings.RouteObserverBehavior,
],
properties: {
......@@ -166,6 +168,19 @@ Polymer({
return [{value: -1, name: 'Placeholder'}];
}
},
/**
* Used by DeepLinkingBehavior to focus this page's deep links.
* @type {!Set<!chromeos.settings.mojom.Setting>}
*/
supportedSettingIds: {
type: Object,
value: () => new Set([
chromeos.settings.mojom.Setting.kSwitchActionAssignment,
chromeos.settings.mojom.Setting.kSwitchActionAutoScan,
chromeos.settings.mojom.Setting.kSwitchActionAutoScanKeyboard,
]),
},
},
/** @override */
......@@ -189,6 +204,19 @@ Polymer({
this.updateOptionsForDropdowns_();
},
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.MANAGE_SWITCH_ACCESS_SETTINGS) {
return;
}
this.attemptDeepLink();
},
/**
* @private {?Array<{value: !SwitchAccessAssignmentValue, name: string}>}
*/
......
......@@ -8,6 +8,9 @@
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="../../controls/settings_slider.html">
<link rel="import" href="../deep_linking_behavior.html">
<link rel="import" href="../os_route.html">
<link rel="import" href="../../router.html">
<link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../../languages_page/languages_browser_proxy.html">
<link rel="import" href="../../settings_shared_css.html">
......@@ -43,11 +46,13 @@
$i18n{textToSpeechRate}
</div>
<settings-slider show-markers
id="textToSpeechRate"
pref="{{prefs.settings.tts.speech_rate}}"
ticks="[[speechRateTicks_()]]"
label-aria="$i18n{textToSpeechRate}"
label-min="$i18n{textToSpeechRateMinimumLabel}"
label-max="$i18n{textToSpeechRateMaximumLabel}">
label-max="$i18n{textToSpeechRateMaximumLabel}"
deep-link-focus-id$="[[Setting.kTextToSpeechRate]]">
</settings-slider>
</div>
<div class="settings-box continuation">
......@@ -59,7 +64,8 @@
ticks="[[speechPitchTicks_()]]"
label-aria="$i18n{textToSpeechPitch}"
label-min="$i18n{textToSpeechPitchMinimumLabel}"
label-max="$i18n{textToSpeechPitchMaximumLabel}">
label-max="$i18n{textToSpeechPitchMaximumLabel}"
deep-link-focus-id$="[[Setting.kTextToSpeechPitch]]">
</settings-slider>
</div>
<div class="settings-box continuation">
......@@ -71,7 +77,8 @@
ticks="[[speechVolumeTicks_()]]"
label-aria="$i18n{textToSpeechVolume}"
label-min="$i18n{textToSpeechVolumeMinimumLabel}"
label-max="$i18n{textToSpeechVolumeMaximumLabel}">
label-max="$i18n{textToSpeechVolumeMaximumLabel}"
deep-link-focus-id$="[[Setting.kTextToSpeechVolume]]">
</settings-slider>
</div>
......@@ -84,7 +91,8 @@
<select id="previewVoice" class="md-select"
aria-labelledby="textToSpeechPreviewVoice"
value="{{defaultPreviewVoice}}"
disabled="[[!hasVoices]]">
disabled="[[!hasVoices]]"
deep-link-focus-id$="[[Setting.kTextToSpeechVoice]]">
<template is="dom-repeat" id="previewVoiceOptions"
items="[[allVoices]]" as="voice">
<!-- TODO: Use a combobox with a search field instead. -->
......@@ -160,9 +168,11 @@
<div id="extension_name_[[index]]" class="start settings-box-text">
[[extension.name]]
</div>
<cr-button on-click="onEngineSettingsTap_"
<cr-button id="extensionOptionsButton_[[index]]"
on-click="onEngineSettingsTap_"
aria-describedby$="extension_name_[[index]]"
hidden$="[[!extension.optionsPage]]">
hidden$="[[!extension.optionsPage]]"
deep-link-focus-id$="[[Setting.kTextToSpeechEngines]]">
$i18n{settings}
</cr-button>
</div>
......
......@@ -10,7 +10,12 @@
Polymer({
is: 'settings-tts-subpage',
behaviors: [WebUIListenerBehavior, I18nBehavior],
behaviors: [
DeepLinkingBehavior,
I18nBehavior,
settings.RouteObserverBehavior,
WebUIListenerBehavior,
],
properties: {
/**
......@@ -75,6 +80,21 @@ Polymer({
type: Boolean,
value: false,
},
/**
* Used by DeepLinkingBehavior to focus this page's deep links.
* @type {!Set<!chromeos.settings.mojom.Setting>}
*/
supportedSettingIds: {
type: Object,
value: () => new Set([
chromeos.settings.mojom.Setting.kTextToSpeechRate,
chromeos.settings.mojom.Setting.kTextToSpeechPitch,
chromeos.settings.mojom.Setting.kTextToSpeechVolume,
chromeos.settings.mojom.Setting.kTextToSpeechVoice,
chromeos.settings.mojom.Setting.kTextToSpeechEngines,
]),
},
},
/** @private {?TtsSubpageBrowserProxy} */
......@@ -105,6 +125,19 @@ Polymer({
},
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.MANAGE_TTS_SETTINGS) {
return;
}
this.attemptDeepLink();
},
/*
* Ticks for the Speech Rate slider. Valid rates are between 0.1 and 5.
* @return {!Array<!cr_slider.SliderTick>}
* @private
......
......@@ -64,6 +64,7 @@ suite('ManageAccessibilityPageTests', function() {
if (page) {
page.remove();
}
settings.Router.getInstance().resetRouteForTesting();
});
test('Pointers row only visible if mouse/touchpad present', function() {
......@@ -115,4 +116,25 @@ suite('ManageAccessibilityPageTests', function() {
// Additional features link is not visible.
assertFalse(isVisible(page.$.additionalFeaturesLink));
});
test('Deep link to switch access', async () => {
loadTimeData.overrideValues({
isKioskModeActive: false,
isDeepLinkingEnabled: true,
});
initPage();
const params = new URLSearchParams;
params.append('settingId', '1522');
settings.Router.getInstance().navigateTo(
settings.routes.MANAGE_ACCESSIBILITY, params);
Polymer.dom.flush();
const deepLinkElement = page.$$('#enableSwitchAccess').$$('cr-toggle');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Switch access toggle should be focused for settingId=1522.');
});
});
// 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.
suite('A11yPageTests', function() {
/** @type {SettingsA11yPageElement} */
let a11yPage = null;
setup(function() {
PolymerTest.clearBody();
a11yPage = document.createElement('os-settings-a11y-page');
document.body.appendChild(a11yPage);
Polymer.dom.flush();
});
teardown(function() {
a11yPage.remove();
settings.Router.getInstance().resetRouteForTesting();
});
test('Deep link to always show a11y settings', async () => {
loadTimeData.overrideValues({
isDeepLinkingEnabled: true,
});
const params = new URLSearchParams;
params.append('settingId', '1500');
settings.Router.getInstance().navigateTo(
settings.routes.OS_ACCESSIBILITY, params);
Polymer.dom.flush();
const deepLinkElement = a11yPage.$$('#optionsInMenuToggle').$$('cr-toggle');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Always show a11y toggle should be focused for settingId=1500.');
});
});
\ No newline at end of file
......@@ -1795,6 +1795,27 @@ TEST_F('OSSettingsSmbPageTest', 'AllJsTests', () => {
mocha.run();
});
// Test fixture for the OS Accessibility page.
// eslint-disable-next-line no-var
var OSSettingsAccessibilityPageTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload + 'chromeos/os_a11y_page/os_a11y_page.html';
}
/** @override */
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + '../test_util.js',
'os_a11y_page_tests.js',
]);
}
};
TEST_F('OSSettingsAccessibilityPageTest', 'AllJsTests', () => {
mocha.run();
});
// Test fixture for the Manage Accessibility page.
// eslint-disable-next-line no-var
var OSSettingsManageAccessibilityPageTest =
......@@ -1808,6 +1829,7 @@ var OSSettingsManageAccessibilityPageTest =
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + '../test_browser_proxy.js',
BROWSER_SETTINGS_PATH + '../test_util.js',
'manage_accessibility_page_tests.js',
]);
}
......@@ -1817,6 +1839,29 @@ TEST_F('OSSettingsManageAccessibilityPageTest', 'AllJsTests', () => {
mocha.run();
});
// Test fixture for the OS Accessibility Text-to-Speech subpage.
// eslint-disable-next-line no-var
var OSSettingsTextToSpeechSubpageTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload + 'chromeos/os_a11y_page/tts_subpage.html';
}
/** @override */
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + '../test_browser_proxy.js',
BROWSER_SETTINGS_PATH + '../test_util.js',
'text_to_speech_subpage_tests.js',
]);
}
};
TEST_F('OSSettingsTextToSpeechSubpageTest', 'AllJsTests', () => {
mocha.run();
});
// Test fixture for the Switch Access page.
// eslint-disable-next-line no-var
var OSSettingsSwitchAccessSubpageTest = class extends OSSettingsBrowserTest {
......@@ -1830,6 +1875,7 @@ var OSSettingsSwitchAccessSubpageTest = class extends OSSettingsBrowserTest {
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + '../test_browser_proxy.js',
BROWSER_SETTINGS_PATH + '../test_util.js',
'switch_access_subpage_tests.js',
]);
}
......
......@@ -14,9 +14,8 @@ function hasOptionWithValue(options, value) {
suite('ManageAccessibilityPageTests', function() {
let page = null;
function initPage() {
page = document.createElement('settings-switch-access-subpage');
page.prefs = {
function getDefaultPrefs() {
return {
settings: {
a11y: {
switch_access: {
......@@ -24,7 +23,7 @@ suite('ManageAccessibilityPageTests', function() {
enabled: {
key: 'settings.a11y.switch_access.auto_scan.enabled',
type: chrome.settingsPrivate.PrefType.BOOLEAN,
value: false
value: false,
}
},
next: {
......@@ -52,6 +51,12 @@ suite('ManageAccessibilityPageTests', function() {
}
}
};
}
/** @param {?Object} prefs */
function initPage(prefs) {
page = document.createElement('settings-switch-access-subpage');
page.prefs = prefs || getDefaultPrefs();
document.body.appendChild(page);
}
......@@ -64,6 +69,7 @@ suite('ManageAccessibilityPageTests', function() {
if (page) {
page.remove();
}
settings.Router.getInstance().resetRouteForTesting();
});
test(
......@@ -88,4 +94,28 @@ suite('ManageAccessibilityPageTests', function() {
hasOptionWithValue(page.optionsForPrevious_, assignedValue));
assertFalse(hasOptionWithValue(page.optionsForSelect_, assignedValue));
});
test('Deep link to auto-scan keyboards', async () => {
loadTimeData.overrideValues({
isDeepLinkingEnabled: true,
showExperimentalAccessibilitySwitchAccessImprovedTextInput: true,
});
prefs = getDefaultPrefs();
prefs.settings.a11y.switch_access.auto_scan.enabled.value = true;
initPage(prefs);
Polymer.dom.flush();
const params = new URLSearchParams;
params.append('settingId', '1525');
settings.Router.getInstance().navigateTo(
settings.routes.MANAGE_SWITCH_ACCESS_SETTINGS, params);
const deepLinkElement = page.$$('#keyboardScanSpeedSlider').$$('cr-slider');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Auto-scan keyboard toggle should be focused for settingId=1525.');
});
});
// 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.
/**
* @implements {TtsSubpageBrowserProxy}
*/
class TestTtsSubpageBrowserProxy extends TestBrowserProxy {
constructor() {
super([
'getAllTtsVoiceData',
'getTtsExtensions',
'previewTtsVoice',
'wakeTtsEngine',
]);
}
/** @override */
getAllTtsVoiceData() {
this.methodCalled('getAllTtsVoiceData');
}
/** @override */
getTtsExtensions() {
this.methodCalled('getTtsExtensions');
}
/** @override */
previewTtsVoice(previewText, previewVoice) {
this.methodCalled('previewTtsVoice', [previewText, previewVoice]);
}
/** @override */
wakeTtsEngine() {
this.methodCalled('wakeTtsEngine');
}
}
suite('TextToSpeechSubpageTests', function() {
/** @type {SettingsTtsSubpageElement} */
let ttsPage = null;
/** @type {?TestTtsSubpageBrowserProxy} */
let browserProxy = null;
function getDefaultPrefs() {
return {
settings: {
language: {
preferred_languages: {
key: 'settings.language.preferred_languages',
type: chrome.settingsPrivate.PrefType.STRING,
value: '',
},
},
tts: {
lang_to_voice_name: {
key: 'prefs.settings.tts.lang_to_voice_name',
type: chrome.settingsPrivate.PrefType.DICTIONARY,
value: {},
},
},
},
};
}
setup(function() {
browserProxy = new TestTtsSubpageBrowserProxy();
TtsSubpageBrowserProxyImpl.instance_ = browserProxy;
PolymerTest.clearBody();
ttsPage = document.createElement('settings-tts-subpage');
ttsPage.prefs = getDefaultPrefs();
document.body.appendChild(ttsPage);
Polymer.dom.flush();
});
teardown(function() {
ttsPage.remove();
settings.Router.getInstance().resetRouteForTesting();
});
test('Deep link to text to speech rate', async () => {
loadTimeData.overrideValues({
isDeepLinkingEnabled: true,
});
const params = new URLSearchParams;
params.append('settingId', '1503');
settings.Router.getInstance().navigateTo(
settings.routes.MANAGE_TTS_SETTINGS, params);
Polymer.dom.flush();
const deepLinkElement = ttsPage.$$('#textToSpeechRate').$$('cr-slider');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Text to speech rate slider should be focused for settingId=1503.');
});
test('Deep link to text to speech engines', async () => {
loadTimeData.overrideValues({
isDeepLinkingEnabled: true,
});
ttsPage.extensions = [{
name: 'extension1',
extensionId: 'extension1_id',
optionsPage: 'extension1_page'
}];
Polymer.dom.flush();
const params = new URLSearchParams;
params.append('settingId', '1507');
settings.Router.getInstance().navigateTo(
settings.routes.MANAGE_TTS_SETTINGS, params);
const deepLinkElement = ttsPage.$$('#extensionOptionsButton_0');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Text to speech engine options should be focused for settingId=1507.');
});
});
\ No newline at end of file
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