Commit 21a77aa2 authored by Nicholas Verne's avatar Nicholas Verne Committed by Commit Bot

Disable the Linux "Turn On" (install) button when the installer view is showing.

Bug: 988981
Change-Id: I8649038c3d77fad3e9daa2be5273dbf50bd6ee82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768612Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Auto-Submit: Nicholas Verne <nverne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691919}
parent a0ffc825
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<template is="dom-if" if="[[!prefs.crostini.enabled.value]]"> <template is="dom-if" if="[[!prefs.crostini.enabled.value]]">
<div class="separator"></div> <div class="separator"></div>
<cr-button id="enable" <cr-button id="enable"
disabled="[[!allowCrostini]]" disabled$="[[disableCrostiniInstall_]]"
on-click="onEnableTap_" on-click="onEnableTap_"
aria-label="$i18n{crostiniPageTitle}" aria-label="$i18n{crostiniPageTitle}"
aria-describedby="secondaryText"> aria-describedby="secondaryText">
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
Polymer({ Polymer({
is: 'settings-crostini-page', is: 'settings-crostini-page',
behaviors: [I18nBehavior, PrefsBehavior], behaviors: [I18nBehavior, PrefsBehavior, WebUIListenerBehavior],
properties: { properties: {
/** Preferences state. */ /** Preferences state. */
...@@ -49,6 +49,27 @@ Polymer({ ...@@ -49,6 +49,27 @@ Polymer({
return map; return map;
}, },
}, },
/**
* Whether the install option should be enabled.
* @private {boolean}
*/
disableCrostiniInstall_: {
type: Boolean,
},
},
attached: function() {
if (!loadTimeData.getBoolean('allowCrostini')) {
this.disableCrostiniInstall_ = true;
return;
}
this.addWebUIListener(
'crostini-installer-status-changed', (installerShowing) => {
this.disableCrostiniInstall_ = installerShowing;
});
settings.CrostiniBrowserProxyImpl.getInstance()
.requestCrostiniInstallerStatus();
}, },
/** /**
......
...@@ -51,6 +51,7 @@ suite('CrostiniPageTests', function() { ...@@ -51,6 +51,7 @@ suite('CrostiniPageTests', function() {
const button = crostiniPage.$$('#enable'); const button = crostiniPage.$$('#enable');
assertTrue(!!button); assertTrue(!!button);
assertFalse(!!crostiniPage.$$('.subpage-arrow')); assertFalse(!!crostiniPage.$$('.subpage-arrow'));
assertFalse(button.disabled);
button.click(); button.click();
Polymer.dom.flush(); Polymer.dom.flush();
...@@ -60,6 +61,26 @@ suite('CrostiniPageTests', function() { ...@@ -60,6 +61,26 @@ suite('CrostiniPageTests', function() {
assertTrue(!!crostiniPage.$$('.subpage-arrow')); assertTrue(!!crostiniPage.$$('.subpage-arrow'));
}); });
test('ButtonDisabledDuringInstall', function() {
const button = crostiniPage.$$('#enable');
assertTrue(!!button);
return flushAsync()
.then(() => {
assertFalse(button.disabled);
cr.webUIListenerCallback('crostini-installer-status-changed', true);
flushAsync();
})
.then(() => {
assertTrue(button.disabled);
cr.webUIListenerCallback(
'crostini-installer-status-changed', false);
flushAsync();
})
.then(() => {
assertFalse(button.disabled);
});
});
}); });
suite('SubPageDetails', function() { suite('SubPageDetails', function() {
......
...@@ -225,8 +225,7 @@ var OSSettingsCrostiniPageTest = class extends OSSettingsBrowserTest { ...@@ -225,8 +225,7 @@ var OSSettingsCrostiniPageTest = class extends OSSettingsBrowserTest {
} }
}; };
// TODO(crbug.com/962114): Disabled due to flakes on linux-chromeos-rel. TEST_F('OSSettingsCrostiniPageTest', 'All', () => {
TEST_F('OSSettingsCrostiniPageTest', 'DISABLED_AllJsTests', () => {
mocha.run(); mocha.run();
}); });
......
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