Commit 9935c110 authored by Danila Kuzmin's avatar Danila Kuzmin Committed by Chromium LUCI CQ

oobe: Fix focus for several buttons on eula screen

Fix initial focus for additional terms of service button on eula screen.
And for return focus on exit from System Security setting dialog.

Bug: 1154207
Change-Id: Ie9b9d4f4ae89a7861a22ce29db23ecd1adc8b11e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593264Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Danila Kuzmin <dkuzmin@google.com>
Cr-Commit-Position: refs/heads/master@{#839108}
parent 41fb6b71
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/google_update_settings.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
#include "chromeos/dbus/cryptohome/fake_cryptohome_client.h" #include "chromeos/dbus/cryptohome/fake_cryptohome_client.h"
#include "components/guest_view/browser/guest_view_manager.h" #include "components/guest_view/browser/guest_view_manager.h"
...@@ -57,8 +58,6 @@ const test::UIPath kAcceptEulaButton = {"oobe-eula-md", "acceptButton"}; ...@@ -57,8 +58,6 @@ const test::UIPath kAcceptEulaButton = {"oobe-eula-md", "acceptButton"};
const test::UIPath kUsageStats = {"oobe-eula-md", "usageStats"}; const test::UIPath kUsageStats = {"oobe-eula-md", "usageStats"};
const test::UIPath kAdditionalTermsLink = {"oobe-eula-md", "additionalTerms"}; const test::UIPath kAdditionalTermsLink = {"oobe-eula-md", "additionalTerms"};
const test::UIPath kAdditionalTermsDialog = {"oobe-eula-md", "additionalToS"}; const test::UIPath kAdditionalTermsDialog = {"oobe-eula-md", "additionalToS"};
const test::UIPath kAdditionalTermsClose = {"oobe-eula-md",
"close-additional-tos"};
const test::UIPath kLearnMoreLink = {"oobe-eula-md", "learnMore"}; const test::UIPath kLearnMoreLink = {"oobe-eula-md", "learnMore"};
// Helper class to wait until the WebCotnents finishes loading. // Helper class to wait until the WebCotnents finishes loading.
...@@ -361,12 +360,15 @@ IN_PROC_BROWSER_TEST_F(EulaTest, AdditionalToS) { ...@@ -361,12 +360,15 @@ IN_PROC_BROWSER_TEST_F(EulaTest, AdditionalToS) {
.CreateWaiter(test::GetOobeElementPath(kAdditionalTermsDialog) + ".open") .CreateWaiter(test::GetOobeElementPath(kAdditionalTermsDialog) + ".open")
->Wait(); ->Wait();
test::OobeJS().TapOnPath(kAdditionalTermsClose); ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_RETURN, false /* control */, false /* shift */,
false /* alt */, false /* command */));
test::OobeJS() test::OobeJS()
.CreateWaiter(test::GetOobeElementPath(kAdditionalTermsDialog) + .CreateWaiter(test::GetOobeElementPath(kAdditionalTermsDialog) +
".open === false") ".open === false")
->Wait(); ->Wait();
test::OobeJS().ExpectFocused(kAdditionalTermsLink);
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples("OOBE.EulaScreen.UserActions"), histogram_tester.GetAllSamples("OOBE.EulaScreen.UserActions"),
......
...@@ -80,15 +80,13 @@ ...@@ -80,15 +80,13 @@
</div> </div>
</oobe-dialog> </oobe-dialog>
<oobe-dialog id="securitySettingsDialog" role="dialog" has-buttons <oobe-dialog id="securitySettingsDialog" role="dialog" has-buttons
title-key="eulaSystemSecuritySettings" hidden title-key="eulaSystemSecuritySettings" hidden
aria-label$="[[i18nDynamic(locale, 'eulaSystemSecuritySettings')]]"> aria-label$="[[i18nDynamic(locale, 'eulaSystemSecuritySettings')]]">
<hd-iron-icon slot="oobe-icon" <hd-iron-icon slot="oobe-icon"
icon1x="oobe-32:googleg" icon2x="oobe-64:googleg"> icon1x="oobe-32:googleg" icon2x="oobe-64:googleg">
</hd-iron-icon> </hd-iron-icon>
<div slot="subtitle" id="settingsSubtitle"> <div slot="subtitle" id="settingsSubtitle">
<div> [[i18nDynamic(locale, 'eulaTpmDesc')]]
[[i18nDynamic(locale, 'eulaTpmDesc')]]
</div>
</div> </div>
<div slot="bottom-buttons" class="flex layout horizontal"> <div slot="bottom-buttons" class="flex layout horizontal">
<div class="flex"></div> <div class="flex"></div>
...@@ -107,7 +105,7 @@ ...@@ -107,7 +105,7 @@
<webview slot="content" role="document" class="flex oobe-tos-webview" <webview slot="content" role="document" class="flex oobe-tos-webview"
id="additionalChromeToSFrame"> id="additionalChromeToSFrame">
</webview> </webview>
<oobe-text-button id="close-additional-tos" slot="buttons" <oobe-text-button id="closeAdditionalTos" slot="buttons"
on-click="hideToSDialog_" text-key="oobeModalDialogClose" inverse> on-click="hideToSDialog_" text-key="oobeModalDialogClose" inverse>
</oobe-text-button> </oobe-text-button>
</oobe-modal-dialog> </oobe-modal-dialog>
......
...@@ -412,7 +412,7 @@ Polymer({ ...@@ -412,7 +412,7 @@ Polymer({
*/ */
showAdditionalTosDialog() { showAdditionalTosDialog() {
this.$.additionalToS.showDialog(); this.$.additionalToS.showDialog();
this.$.additionalToS.focus(); this.$.closeAdditionalTos.focus();
}, },
/** /**
...@@ -422,6 +422,7 @@ Polymer({ ...@@ -422,6 +422,7 @@ Polymer({
*/ */
hideToSDialog_() { hideToSDialog_() {
this.$.additionalToS.hideDialog(); this.$.additionalToS.hideDialog();
this.focusAdditionalTermsLink_();
}, },
/** /**
...@@ -457,7 +458,6 @@ Polymer({ ...@@ -457,7 +458,6 @@ Polymer({
onSecuritySettingsCloseClicked_() { onSecuritySettingsCloseClicked_() {
this.$.securitySettingsDialog.hidden = true; this.$.securitySettingsDialog.hidden = true;
this.$.eulaDialog.hidden = false; this.$.eulaDialog.hidden = false;
this.$.eulaDialog.show();
this.$.securitySettings.focus(); this.$.securitySettings.focus();
}, },
......
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