Commit 5396b3bc authored by Jason Lin's avatar Jason Lin Committed by Commit Bot

crostini: select the correct action button

A recent CL [1] added a second button with the class "action-button" to
the crostini installer. The existing logic assumed there is only one
"action-button" which, being no longer always true, sometimes results in
the wrong button being focussed/clicked. This CL updates the logic to
select the appropriate button, either next or install, depending on the
current state of the installation ui.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2004185

Bug: 1016195
Change-Id: I94cbba0f7610d9f444ee539ddcc910959ee817c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024232Reviewed-by: default avatarJulian Watson <juwa@google.com>
Commit-Queue: Jason Lin <lxj@google.com>
Auto-Submit: Jason Lin <lxj@google.com>
Cr-Commit-Position: refs/heads/master@{#737675}
parent be83e30f
...@@ -149,7 +149,7 @@ Polymer({ ...@@ -149,7 +149,7 @@ Polymer({
}); });
BrowserProxy.getInstance().handler.requestAmountOfFreeDiskSpace(); BrowserProxy.getInstance().handler.requestAmountOfFreeDiskSpace();
this.$$('.action-button').focus(); this.$$('.action-button:not([hidden])').focus();
}, },
/** @override */ /** @override */
......
...@@ -150,9 +150,12 @@ bool CrostiniInstallerUI::can_close() { ...@@ -150,9 +150,12 @@ bool CrostiniInstallerUI::can_close() {
} }
void CrostiniInstallerUI::ClickInstallForTesting() { void CrostiniInstallerUI::ClickInstallForTesting() {
// TODO(lxj): This assumes the config page does not show. When flag
// CrostiniUsername or CrostiniDiskResizing is turned on by default, we should
// click the "next" button first.
web_ui()->GetWebContents()->GetMainFrame()->ExecuteJavaScriptForTests( web_ui()->GetWebContents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("document.querySelector('crostini-installer-app')" base::ASCIIToUTF16("document.querySelector('crostini-installer-app')"
".$$('.action-button').click()"), ".$.install.click()"),
base::NullCallback()); base::NullCallback());
} }
......
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