Commit abfa65ab authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[OsSettingsDeepLinking] Add deep links to the Crostini Page.

Adds deep links to the Crostini Page, including the Crostini Details,
Import Export, and Android ADB subpages.

Bug: 1084154
Change-Id: I0dd75e13999b5ce7f8c17b39442d20dc0bfea59b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2381072Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Daniel Classon <dclasson@google.com>
Cr-Commit-Position: refs/heads/master@{#805970}
parent 7fdffd4f
...@@ -22,6 +22,7 @@ js_type_check("closure_compile") { ...@@ -22,6 +22,7 @@ js_type_check("closure_compile") {
js_library("crostini_arc_adb") { js_library("crostini_arc_adb") {
deps = [ deps = [
":crostini_browser_proxy", ":crostini_browser_proxy",
"..:deep_linking_behavior",
"..:metrics_recorder", "..:metrics_recorder",
"..:os_route", "..:os_route",
"../localized_link:localized_link", "../localized_link:localized_link",
...@@ -38,6 +39,7 @@ js_library("crostini_browser_proxy") { ...@@ -38,6 +39,7 @@ js_library("crostini_browser_proxy") {
js_library("crostini_export_import") { js_library("crostini_export_import") {
deps = [ deps = [
":crostini_browser_proxy", ":crostini_browser_proxy",
"..:deep_linking_behavior",
"//ui/webui/resources/js:web_ui_listener_behavior", "//ui/webui/resources/js:web_ui_listener_behavior",
] ]
} }
...@@ -53,6 +55,7 @@ js_library("crostini_disk_resize_dialog") { ...@@ -53,6 +55,7 @@ js_library("crostini_disk_resize_dialog") {
js_library("crostini_page") { js_library("crostini_page") {
deps = [ deps = [
":crostini_browser_proxy", ":crostini_browser_proxy",
"..:deep_linking_behavior",
"..:os_route", "..:os_route",
"../..:router", "../..:router",
"../../prefs:prefs_behavior", "../../prefs:prefs_behavior",
...@@ -104,6 +107,7 @@ js_library("crostini_port_forwarding_add_port_dialog") { ...@@ -104,6 +107,7 @@ js_library("crostini_port_forwarding_add_port_dialog") {
js_library("crostini_subpage") { js_library("crostini_subpage") {
deps = [ deps = [
":crostini_browser_proxy", ":crostini_browser_proxy",
"..:deep_linking_behavior",
"..:metrics_recorder", "..:metrics_recorder",
"..:os_route", "..:os_route",
"..:route_origin_behavior", "..:route_origin_behavior",
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
<link rel="import" href="crostini_browser_proxy.html"> <link rel="import" href="crostini_browser_proxy.html">
<link rel="import" href="crostini_arc_adb_confirmation_dialog.html"> <link rel="import" href="crostini_arc_adb_confirmation_dialog.html">
<link rel="import" href="../localized_link/localized_link.html"> <link rel="import" href="../localized_link/localized_link.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="../../i18n_setup.html">
<link rel="import" href="../../settings_shared_css.html"> <link rel="import" href="../../settings_shared_css.html">
...@@ -39,7 +42,8 @@ ...@@ -39,7 +42,8 @@
checked$="[[arcAdbEnabled_]]" checked$="[[arcAdbEnabled_]]"
disabled="[[shouldDisable_(canChangeAdbSideloading_, disabled="[[shouldDisable_(canChangeAdbSideloading_,
arcAdbNeedPowerwash_)]]" arcAdbNeedPowerwash_)]]"
on-change="onArcAdbToggleChanged_"> on-change="onArcAdbToggleChanged_"
deep-link-focus-id$="[[Setting.kCrostiniAdbDebugging]]">
</cr-toggle> </cr-toggle>
</div> </div>
......
...@@ -10,7 +10,12 @@ ...@@ -10,7 +10,12 @@
Polymer({ Polymer({
is: 'settings-crostini-arc-adb', is: 'settings-crostini-arc-adb',
behaviors: [I18nBehavior, WebUIListenerBehavior], behaviors: [
DeepLinkingBehavior,
I18nBehavior,
settings.RouteObserverBehavior,
WebUIListenerBehavior,
],
properties: { properties: {
/** @private {boolean} */ /** @private {boolean} */
...@@ -57,6 +62,16 @@ Polymer({ ...@@ -57,6 +62,16 @@ Polymer({
type: Boolean, type: Boolean,
value: false, 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.kCrostiniAdbDebugging]),
},
}, },
attached() { attached() {
...@@ -80,6 +95,19 @@ Polymer({ ...@@ -80,6 +95,19 @@ Polymer({
.getCanChangeArcAdbSideloading(); .getCanChangeArcAdbSideloading();
}, },
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.CROSTINI_ANDROID_ADB) {
return;
}
this.attemptDeepLink();
},
/** /**
* Returns whether the toggle is changeable by the user. See * Returns whether the toggle is changeable by the user. See
* CrostiniFeatures::CanChangeAdbSideloading(). Note that the actual * CrostiniFeatures::CanChangeAdbSideloading(). Note that the actual
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html"> <link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="crostini_browser_proxy.html"> <link rel="import" href="crostini_browser_proxy.html">
<link rel="import" href="crostini_import_confirmation_dialog.html"> <link rel="import" href="crostini_import_confirmation_dialog.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="../../i18n_setup.html">
<link rel="import" href="../../settings_shared_css.html"> <link rel="import" href="../../settings_shared_css.html">
...@@ -16,7 +19,8 @@ ...@@ -16,7 +19,8 @@
$i18n{crostiniExportLabel} $i18n{crostiniExportLabel}
</div> </div>
<cr-button on-click="onExportClick_" disabled="[[!enableButtons_]]" <cr-button on-click="onExportClick_" disabled="[[!enableButtons_]]"
aria-labelledby="exportCrostiniLabel"> aria-labelledby="exportCrostiniLabel"
deep-link-focus-id$="[[Setting.kBackupLinuxAppsAndFiles]]">
$i18n{crostiniExport} $i18n{crostiniExport}
</cr-button> </cr-button>
</div> </div>
...@@ -25,7 +29,8 @@ ...@@ -25,7 +29,8 @@
$i18n{crostiniImportLabel} $i18n{crostiniImportLabel}
</div> </div>
<cr-button on-click="onImportClick_" disabled="[[!enableButtons_]]" <cr-button on-click="onImportClick_" disabled="[[!enableButtons_]]"
aria-labelledby="importCrostiniLabel"> aria-labelledby="importCrostiniLabel"
deep-link-focus-id$="[[Setting.kRestoreLinuxAppsAndFiles]]">
$i18n{crostiniImport} $i18n{crostiniImport}
</cr-button> </cr-button>
</div> </div>
......
...@@ -11,7 +11,11 @@ ...@@ -11,7 +11,11 @@
Polymer({ Polymer({
is: 'settings-crostini-export-import', is: 'settings-crostini-export-import',
behaviors: [WebUIListenerBehavior], behaviors: [
DeepLinkingBehavior,
settings.RouteObserverBehavior,
WebUIListenerBehavior,
],
properties: { properties: {
/** @private */ /** @private */
...@@ -42,6 +46,17 @@ Polymer({ ...@@ -42,6 +46,17 @@ Polymer({
value: false, 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.kBackupLinuxAppsAndFiles,
chromeos.settings.mojom.Setting.kRestoreLinuxAppsAndFiles,
]),
},
}, },
attached() { attached() {
...@@ -60,6 +75,19 @@ Polymer({ ...@@ -60,6 +75,19 @@ Polymer({
.requestCrostiniInstallerStatus(); .requestCrostiniInstallerStatus();
}, },
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.CROSTINI_EXPORT_IMPORT) {
return;
}
this.attemptDeepLink();
},
/** @private */ /** @private */
onExportClick_() { onExportClick_() {
settings.CrostiniBrowserProxyImpl.getInstance().exportCrostiniContainer(); settings.CrostiniBrowserProxyImpl.getInstance().exportCrostiniContainer();
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="../../i18n_setup.html"> <link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../../prefs/prefs_behavior.html"> <link rel="import" href="../../prefs/prefs_behavior.html">
<link rel="import" href="../deep_linking_behavior.html">
<link rel="import" href="../os_route.html"> <link rel="import" href="../os_route.html">
<link rel="import" href="../../router.html"> <link rel="import" href="../../router.html">
<link rel="import" href="../../settings_page/settings_animated_pages.html"> <link rel="import" href="../../settings_page/settings_animated_pages.html">
...@@ -55,7 +56,8 @@ ...@@ -55,7 +56,8 @@
disabled$="[[disableCrostiniInstall_]]" disabled$="[[disableCrostiniInstall_]]"
on-click="onEnableTap_" on-click="onEnableTap_"
aria-label="$i18n{crostiniPageTitle}" aria-label="$i18n{crostiniPageTitle}"
aria-describedby="secondaryText"> aria-describedby="secondaryText"
deep-link-focus-id$="[[Setting.kSetUpCrostini]]">
$i18n{crostiniEnable} $i18n{crostiniEnable}
</cr-button> </cr-button>
</template> </template>
......
...@@ -12,7 +12,13 @@ ...@@ -12,7 +12,13 @@
Polymer({ Polymer({
is: 'settings-crostini-page', is: 'settings-crostini-page',
behaviors: [I18nBehavior, PrefsBehavior, WebUIListenerBehavior], behaviors: [
DeepLinkingBehavior,
I18nBehavior,
PrefsBehavior,
settings.RouteObserverBehavior,
WebUIListenerBehavior,
],
properties: { properties: {
/** Preferences state. */ /** Preferences state. */
...@@ -67,6 +73,15 @@ Polymer({ ...@@ -67,6 +73,15 @@ Polymer({
disableCrostiniInstall_: { disableCrostiniInstall_: {
type: Boolean, type: Boolean,
}, },
/**
* 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.kSetUpCrostini]),
},
}, },
attached() { attached() {
...@@ -82,6 +97,19 @@ Polymer({ ...@@ -82,6 +97,19 @@ Polymer({
.requestCrostiniInstallerStatus(); .requestCrostiniInstallerStatus();
}, },
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.CROSTINI) {
return;
}
this.attemptDeepLink();
},
/** /**
* @param {!Event} event * @param {!Event} event
* @private * @private
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<link rel="import" href="../../controls/settings_toggle_button.html"> <link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../../i18n_setup.html"> <link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../../prefs/prefs_behavior.html"> <link rel="import" href="../../prefs/prefs_behavior.html">
<link rel="import" href="../deep_linking_behavior.html">
<link rel="import" href="../os_route.html"> <link rel="import" href="../os_route.html">
<link rel="import" href="../../router.html"> <link rel="import" href="../../router.html">
<link rel="import" href="../route_origin_behavior.html"> <link rel="import" href="../route_origin_behavior.html">
...@@ -36,7 +37,8 @@ ...@@ -36,7 +37,8 @@
on-click="onContainerUpgradeClick_" on-click="onContainerUpgradeClick_"
aria-labelledby="containerUpgradeLabel containerUpgradeButton" aria-labelledby="containerUpgradeLabel containerUpgradeButton"
aria-describedby="containerUpgradeDescription" aria-describedby="containerUpgradeDescription"
disabled="[[disableUpgradeButton_]]"> disabled="[[disableUpgradeButton_]]"
deep-link-focus-id$="[[Setting.kCrostiniContainerUpgrade]]">
$i18n{crostiniContainerUpgradeButton} $i18n{crostiniContainerUpgradeButton}
</cr-button> </cr-button>
</div> </div>
...@@ -95,7 +97,8 @@ ...@@ -95,7 +97,8 @@
<cr-button on-click="onDiskResizeClick_" hidden="[[!canDiskResize_]]" <cr-button on-click="onDiskResizeClick_" hidden="[[!canDiskResize_]]"
aria-label="[[diskResizeButtonAriaLabel_]]" aria-label="[[diskResizeButtonAriaLabel_]]"
aria-describedby="diskSizeDescription" aria-describedby="diskSizeDescription"
id="showDiskResizeButton"> id="showDiskResizeButton"
deep-link-focus-id$="[[Setting.kCrostiniDiskResize]]">
[[diskResizeButtonLabel_]] [[diskResizeButtonLabel_]]
</cr-button> </cr-button>
</div> </div>
...@@ -118,7 +121,8 @@ ...@@ -118,7 +121,8 @@
<cr-toggle id="crostini-mic-sharing-toggle" <cr-toggle id="crostini-mic-sharing-toggle"
checked="[[crostiniMicSharingEnabled_]]" checked="[[crostiniMicSharingEnabled_]]"
on-change="onMicSharingChange_" on-change="onMicSharingChange_"
aria-describedby="crostini-mic-sharing-label"> aria-describedby="crostini-mic-sharing-label"
deep-link-focus-id$="[[Setting.kCrostiniMicAccess]]">
</cr-toggle> </cr-toggle>
</div> </div>
<template is="dom-if" if="[[!hideCrostiniUninstall_]]"> <template is="dom-if" if="[[!hideCrostiniUninstall_]]">
...@@ -127,7 +131,8 @@ ...@@ -127,7 +131,8 @@
$i18n{crostiniRemove} $i18n{crostiniRemove}
</div> </div>
<cr-button on-click="onRemoveClick_" <cr-button on-click="onRemoveClick_"
aria-labelledby="removeCrostiniLabel"> aria-labelledby="removeCrostiniLabel"
deep-link-focus-id$="[[Setting.kUninstallCrostini]]">
$i18n{crostiniRemoveButton} $i18n{crostiniRemoveButton}
</cr-button> </cr-button>
</div> </div>
......
...@@ -19,8 +19,12 @@ const ConfirmationState = { ...@@ -19,8 +19,12 @@ const ConfirmationState = {
Polymer({ Polymer({
is: 'settings-crostini-subpage', is: 'settings-crostini-subpage',
behaviors: behaviors: [
[PrefsBehavior, WebUIListenerBehavior, settings.RouteOriginBehavior], DeepLinkingBehavior,
PrefsBehavior,
settings.RouteOriginBehavior,
WebUIListenerBehavior,
],
properties: { properties: {
/** Preferences state. */ /** Preferences state. */
...@@ -175,6 +179,20 @@ Polymer({ ...@@ -175,6 +179,20 @@ Polymer({
type: Boolean, type: Boolean,
value: false, 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.kUninstallCrostini,
chromeos.settings.mojom.Setting.kCrostiniDiskResize,
chromeos.settings.mojom.Setting.kCrostiniMicAccess,
chromeos.settings.mojom.Setting.kCrostiniContainerUpgrade,
]),
},
}, },
/** settings.RouteOriginBehavior override */ /** settings.RouteOriginBehavior override */
...@@ -229,6 +247,19 @@ Polymer({ ...@@ -229,6 +247,19 @@ Polymer({
r.CROSTINI_PORT_FORWARDING, '#crostini-port-forwarding'); r.CROSTINI_PORT_FORWARDING, '#crostini-port-forwarding');
}, },
/**
* @param {!settings.Route} route
* @param {!settings.Route} oldRoute
*/
currentRouteChanged(route, oldRoute) {
// Does not apply to this page.
if (route !== settings.routes.CROSTINI_DETAILS) {
return;
}
this.attemptDeepLink();
},
/** @private */ /** @private */
onCrostiniEnabledChanged_(enabled) { onCrostiniEnabledChanged_(enabled) {
if (!enabled && if (!enabled &&
......
...@@ -13,9 +13,13 @@ function setCrostiniPrefs(enabled, optional = {}) { ...@@ -13,9 +13,13 @@ function setCrostiniPrefs(enabled, optional = {}) {
sharedPaths = {}, sharedPaths = {},
sharedUsbDevices = [], sharedUsbDevices = [],
forwardedPorts = [], forwardedPorts = [],
crostiniMicSharingEnabled = false crostiniMicSharingEnabled = false,
arcEnabled = false,
} = optional; } = optional;
crostiniPage.prefs = { crostiniPage.prefs = {
arc: {
enabled: {value: arcEnabled},
},
crostini: { crostini: {
enabled: {value: enabled}, enabled: {value: enabled},
port_forwarding: {ports: {value: forwardedPorts}}, port_forwarding: {ports: {value: forwardedPorts}},
...@@ -88,6 +92,22 @@ suite('CrostiniPageTests', function() { ...@@ -88,6 +92,22 @@ suite('CrostiniPageTests', function() {
await test_util.flushTasks(); await test_util.flushTasks();
assertFalse(button.disabled); assertFalse(button.disabled);
}); });
test('Deep link to setup Crostini', async () => {
loadTimeData.overrideValues({isDeepLinkingEnabled: true});
assertTrue(loadTimeData.getBoolean('isDeepLinkingEnabled'));
const params = new URLSearchParams;
params.append('settingId', '800');
settings.Router.getInstance().navigateTo(
settings.routes.CROSTINI, params);
const deepLinkElement = crostiniPage.$$('#enable');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Enable Crostini button should be focused for settingId=800.');
});
}); });
suite('SubPageDetails', function() { suite('SubPageDetails', function() {
...@@ -95,12 +115,13 @@ suite('CrostiniPageTests', function() { ...@@ -95,12 +115,13 @@ suite('CrostiniPageTests', function() {
let subpage; let subpage;
setup(async function() { setup(async function() {
setCrostiniPrefs(true); setCrostiniPrefs(true, {arcEnabled: true});
loadTimeData.overrideValues({ loadTimeData.overrideValues({
showCrostiniExportImport: true, showCrostiniExportImport: true,
showCrostiniContainerUpgrade: true, showCrostiniContainerUpgrade: true,
showCrostiniPortForwarding: true, showCrostiniPortForwarding: true,
showCrostiniDiskResize: true, showCrostiniDiskResize: true,
arcAdbSideloadingSupported: true,
}); });
settings.Router.getInstance().navigateTo(settings.routes.CROSTINI); settings.Router.getInstance().navigateTo(settings.routes.CROSTINI);
...@@ -116,6 +137,7 @@ suite('CrostiniPageTests', function() { ...@@ -116,6 +137,7 @@ suite('CrostiniPageTests', function() {
assertTrue(!!subpage.$$('#crostini-shared-paths')); assertTrue(!!subpage.$$('#crostini-shared-paths'));
assertTrue(!!subpage.$$('#crostini-shared-usb-devices')); assertTrue(!!subpage.$$('#crostini-shared-usb-devices'));
assertTrue(!!subpage.$$('#crostini-export-import')); assertTrue(!!subpage.$$('#crostini-export-import'));
assertTrue(!!subpage.$$('#crostini-enable-arc-adb'));
assertTrue(!!subpage.$$('#remove')); assertTrue(!!subpage.$$('#remove'));
assertTrue(!!subpage.$$('#container-upgrade')); assertTrue(!!subpage.$$('#container-upgrade'));
assertTrue(!!subpage.$$('#crostini-port-forwarding')); assertTrue(!!subpage.$$('#crostini-port-forwarding'));
...@@ -193,6 +215,25 @@ suite('CrostiniPageTests', function() { ...@@ -193,6 +215,25 @@ suite('CrostiniPageTests', function() {
1, crostiniBrowserProxy.getCallCount('exportCrostiniContainer')); 1, crostiniBrowserProxy.getCallCount('exportCrostiniContainer'));
}); });
test('Deep link to backup linux', async () => {
loadTimeData.overrideValues({isDeepLinkingEnabled: true});
assertTrue(loadTimeData.getBoolean('isDeepLinkingEnabled'));
const params = new URLSearchParams;
params.append('settingId', '802');
settings.Router.getInstance().navigateTo(
settings.routes.CROSTINI_EXPORT_IMPORT, params);
Polymer.dom.flush();
subpage = crostiniPage.$$('settings-crostini-export-import');
const deepLinkElement = subpage.$$('#export cr-button');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Export button should be focused for settingId=802.');
});
test('Import', async function() { test('Import', async function() {
assertTrue(!!subpage.$$('#crostini-export-import')); assertTrue(!!subpage.$$('#crostini-export-import'));
subpage.$$('#crostini-export-import').click(); subpage.$$('#crostini-export-import').click();
...@@ -375,6 +416,26 @@ suite('CrostiniPageTests', function() { ...@@ -375,6 +416,26 @@ suite('CrostiniPageTests', function() {
const dialog = subpage.$$('settings-crostini-disk-resize-dialog'); const dialog = subpage.$$('settings-crostini-disk-resize-dialog');
assertTrue(!!dialog); assertTrue(!!dialog);
}); });
test('Deep link to resize disk', async () => {
loadTimeData.overrideValues({isDeepLinkingEnabled: true});
assertTrue(loadTimeData.getBoolean('isDeepLinkingEnabled'));
assertTrue(!!subpage.$$('#showDiskResizeButton'));
await crostiniBrowserProxy.resolvePromises(
'getCrostiniDiskInfo',
{succeeded: true, canResize: true, isUserChosenSize: true});
const params = new URLSearchParams;
params.append('settingId', '805');
settings.Router.getInstance().navigateTo(
settings.routes.CROSTINI_DETAILS, params);
const deepLinkElement = subpage.$$('#showDiskResizeButton');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Resize disk button should be focused for settingId=805.');
});
}); });
suite('SubPagePortForwarding', function() { suite('SubPagePortForwarding', function() {
...@@ -1039,4 +1100,41 @@ suite('CrostiniPageTests', function() { ...@@ -1039,4 +1100,41 @@ suite('CrostiniPageTests', function() {
assertEquals(1, subpage.shadowRoot.querySelectorAll('.toggle').length); assertEquals(1, subpage.shadowRoot.querySelectorAll('.toggle').length);
}); });
}); });
suite('SubPageArcAdb', function() {
let subpage;
setup(async function() {
setCrostiniPrefs(true, {arcEnabled: true});
loadTimeData.overrideValues({
arcAdbSideloadingSupported: true,
});
await test_util.flushTasks();
settings.Router.getInstance().navigateTo(
settings.routes.CROSTINI_ANDROID_ADB);
await test_util.flushTasks();
subpage = crostiniPage.$$('settings-crostini-arc-adb');
assertTrue(!!subpage);
});
test('Deep link to enable adb debugging', async () => {
loadTimeData.overrideValues({isDeepLinkingEnabled: true});
assertTrue(loadTimeData.getBoolean('isDeepLinkingEnabled'));
const params = new URLSearchParams;
params.append('settingId', '804');
settings.Router.getInstance().navigateTo(
settings.routes.CROSTINI_ANDROID_ADB, params);
Polymer.dom.flush();
const deepLinkElement = subpage.$$('#arcAdbEnabledButton');
await test_util.waitAfterNextRender(deepLinkElement);
assertEquals(
deepLinkElement, getDeepActiveElement(),
'Enable adb debugging button should be focused for settingId=804.');
});
});
}); });
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