Commit 3d9a40f2 authored by Maggie Cai's avatar Maggie Cai Committed by Chromium LUCI CQ

Revert "OOBE: Arc-ToS Improvements"

This reverts commit ddd08c52.

Reason for revert: This CL is likly the cause for test failure DemoSetupArcSupportedTest.OnlineSetupFlowErrorDefault in builder Linux Chromium OS ASan LSan Tests (1) starting from
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20(1)/39313/blamelist

Original change's description:
> OOBE: Arc-ToS Improvements
>
> Migrate ArcToSScreen to multistep behavior.
> Get rid of display: none; and display: block;
>
> Bug: 1156667
> Change-Id: I4c2fc425edd4883c5edfceb0a5a9f67a6227de7b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2603744
> Commit-Queue: Ossama Mahmoud <osamafathy@google.com>
> Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
> Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#844554}

TBR=antrim@chromium.org,rsorokin@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com,osamafathy@google.com

Change-Id: I62973f98fccb5086b852879395d04f4a3050c244
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1156667
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636099Reviewed-by: default avatarMaggie Cai <mxcai@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844643}
parent 256dbee5
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
#include "chromeos/dbus/session_manager/fake_session_manager_client.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
...@@ -98,12 +97,11 @@ const test::UIPath kArcReviewSettingsCheckbox = {kArcTosID, ...@@ -98,12 +97,11 @@ const test::UIPath kArcReviewSettingsCheckbox = {kArcTosID,
"arcReviewSettingsCheckbox"}; "arcReviewSettingsCheckbox"};
const test::UIPath kArcTosAcceptButton = {kArcTosID, "arcTosAcceptButton"}; const test::UIPath kArcTosAcceptButton = {kArcTosID, "arcTosAcceptButton"};
const test::UIPath kArcTosBackButton = {kArcTosID, "arcTosBackButton"}; const test::UIPath kArcTosBackButton = {kArcTosID, "arcTosBackButton"};
const test::UIPath kArcTosDialog = {kArcTosID, "arcTosDialog"};
const test::UIPath kArcTosNextButton = {kArcTosID, "arcTosNextButton"}; const test::UIPath kArcTosNextButton = {kArcTosID, "arcTosNextButton"};
const test::UIPath kArcTosOverlayWebview = {kArcTosID, "arcTosOverlayWebview"}; const test::UIPath kArcTosOverlayWebview = {kArcTosID, "arcTosOverlayWebview"};
const test::UIPath kArcTosRetryButton = {kArcTosID, "arcTosRetryButton"}; const test::UIPath kArcTosRetryButton = {kArcTosID, "arcTosRetryButton"};
const test::UIPath kArcTosView = {kArcTosID, "arcTosView"}; const test::UIPath kArcTosView = {kArcTosID, "arcTosView"};
const test::UIPath kArcTosDialog = {kArcTosID, "arcTosDialog"};
const test::UIPath kArcTosErrorDialog = {kArcTosID, "arcTosErrorDialog"};
ArcPlayTermsOfServiceConsent BuildArcPlayTermsOfServiceConsent(bool accepted) { ArcPlayTermsOfServiceConsent BuildArcPlayTermsOfServiceConsent(bool accepted) {
ArcPlayTermsOfServiceConsent play_consent; ArcPlayTermsOfServiceConsent play_consent;
...@@ -263,7 +261,9 @@ class ArcTermsOfServiceScreenTest : public OobeBaseTest { ...@@ -263,7 +261,9 @@ class ArcTermsOfServiceScreenTest : public OobeBaseTest {
void WaitForTermsOfServiceWebViewToLoad() { void WaitForTermsOfServiceWebViewToLoad() {
OobeScreenWaiter(ArcTermsOfServiceScreenView::kScreenId).Wait(); OobeScreenWaiter(ArcTermsOfServiceScreenView::kScreenId).Wait();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosDialog)->Wait(); test::OobeJS()
.CreateHasClassWaiter(true, "arc-tos-loaded", kArcTosDialog)
->Wait();
} }
void WaitForScreenExitResult() { void WaitForScreenExitResult() {
...@@ -533,41 +533,6 @@ IN_PROC_BROWSER_TEST_F(ArcTermsOfServiceScreenTest, RetryAndBackButtonClicked) { ...@@ -533,41 +533,6 @@ IN_PROC_BROWSER_TEST_F(ArcTermsOfServiceScreenTest, RetryAndBackButtonClicked) {
1))); 1)));
} }
IN_PROC_BROWSER_TEST_F(ArcTermsOfServiceScreenTest,
NextAndRetryButtonsFocused) {
TriggerArcTosScreen();
WaitForTermsOfServiceWebViewToLoad();
test::OobeJS().CreateFocusWaiter(kArcTosNextButton)->Wait();
// TODO(crbug/1167720): Make this a method of JSChecker
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_RETURN, false /* control */, false /* shift */,
false /* alt */, false /* command */));
test::OobeJS().CreateVisibilityWaiter(true, kArcTosAcceptButton)->Wait();
test::ExecuteOobeJS("$('arc-tos').onTermsViewErrorOccurred();");
test::OobeJS().CreateVisibilityWaiter(true, kArcTosErrorDialog)->Wait();
test::OobeJS().CreateFocusWaiter(kArcTosRetryButton)->Wait();
test::ExecuteOobeJS("$('arc-tos').reloadsLeftForTesting_ = 1");
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_RETURN, false /* control */, false /* shift */,
false /* alt */, false /* command */));
test::OobeJS().CreateVisibilityWaiter(true, kArcTosDialog)->Wait();
EXPECT_THAT(
histogram_tester_.GetAllSamples(
"OOBE.ArcTermsOfServiceScreen.UserActions"),
ElementsAre(
base::Bucket(
static_cast<int>(
ArcTermsOfServiceScreen::UserAction::kNextButtonClicked),
1),
base::Bucket(
static_cast<int>(
ArcTermsOfServiceScreen::UserAction::kRetryButtonClicked),
1)));
}
// There are two checkboxes for enabling/disabling arc backup restore and // There are two checkboxes for enabling/disabling arc backup restore and
// arc location service. This parameterized test executes all 4 combinations // arc location service. This parameterized test executes all 4 combinations
// of enabled/disabled states and checks that advancing to the next screen by // of enabled/disabled states and checks that advancing to the next screen by
......
...@@ -74,12 +74,6 @@ constexpr char kDefaultNetworkName[] = "eth1"; ...@@ -74,12 +74,6 @@ constexpr char kDefaultNetworkName[] = "eth1";
constexpr int kInvokeDemoModeGestureTapsCount = 10; constexpr int kInvokeDemoModeGestureTapsCount = 10;
constexpr char kArcTosID[] = "arc-tos";
const test::UIPath kArcTosAcceptButton = {kArcTosID, "arcTosAcceptButton"};
const test::UIPath kArcTosBackButton = {kArcTosID, "arcTosBackButton"};
const test::UIPath kArcTosNextButton = {kArcTosID, "arcTosNextButton"};
// How js query is executed. // How js query is executed.
enum class JSExecution { kSync, kAsync }; enum class JSExecution { kSync, kAsync };
...@@ -612,9 +606,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -612,9 +606,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
ArcTermsOfServiceScreenView::kScreenId, DemoSetupDialog::kArcTos, ArcTermsOfServiceScreenView::kScreenId, DemoSetupDialog::kArcTos,
"#arcTosMetricsDemoApps")); "#arcTosMetricsDemoApps"));
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
EXPECT_TRUE(DemoSetupController::GetSubOrganizationEmail().empty()); EXPECT_TRUE(DemoSetupController::GetSubOrganizationEmail().empty());
...@@ -699,9 +694,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -699,9 +694,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId)); EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId));
SetPlayStoreTermsForTesting(); SetPlayStoreTermsForTesting();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// Verify the email corresponds to France. // Verify the email corresponds to France.
...@@ -750,9 +746,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, OnlineSetupFlowErrorDefault) { ...@@ -750,9 +746,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, OnlineSetupFlowErrorDefault) {
EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId)); EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId));
SetPlayStoreTermsForTesting(); SetPlayStoreTermsForTesting();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is // TODO(agawronska): Progress dialog transition is async - extra work is
...@@ -820,9 +817,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -820,9 +817,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId)); EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId));
SetPlayStoreTermsForTesting(); SetPlayStoreTermsForTesting();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is // TODO(agawronska): Progress dialog transition is async - extra work is
...@@ -884,9 +882,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -884,9 +882,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId)); EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId));
SetPlayStoreTermsForTesting(); SetPlayStoreTermsForTesting();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is // TODO(agawronska): Progress dialog transition is async - extra work is
...@@ -964,9 +963,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, OfflineSetupFlowSuccess) { ...@@ -964,9 +963,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, OfflineSetupFlowSuccess) {
ArcTermsOfServiceScreenView::kScreenId, DemoSetupDialog::kArcTos, ArcTermsOfServiceScreenView::kScreenId, DemoSetupDialog::kArcTos,
"#arcTosMetricsDemoApps")); "#arcTosMetricsDemoApps"));
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is // TODO(agawronska): Progress dialog transition is async - extra work is
...@@ -1024,9 +1024,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -1024,9 +1024,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId)); EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId));
SetPlayStoreTermsForTesting(); SetPlayStoreTermsForTesting();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is // TODO(agawronska): Progress dialog transition is async - extra work is
...@@ -1089,9 +1090,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -1089,9 +1090,10 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId)); EXPECT_TRUE(IsScreenShown(ArcTermsOfServiceScreenView::kScreenId));
SetPlayStoreTermsForTesting(); SetPlayStoreTermsForTesting();
test::OobeJS().CreateVisibilityWaiter(true, kArcTosNextButton)->Wait(); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
test::OobeJS().ClickOnPath(kArcTosNextButton); "#arcTosNextButton", JSExecution::kSync);
test::OobeJS().ClickOnPath(kArcTosAcceptButton); ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait(); OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is // TODO(agawronska): Progress dialog transition is async - extra work is
...@@ -1183,8 +1185,8 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, MAYBE_BackOnArcTermsScreen) { ...@@ -1183,8 +1185,8 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, MAYBE_BackOnArcTermsScreen) {
SkipToScreen(ArcTermsOfServiceScreenView::kScreenId); SkipToScreen(ArcTermsOfServiceScreenView::kScreenId);
test::OobeJS().CreateVisibilityWaiter(true, kArcTosBackButton)->Wait(); ClickOobeButton(ArcTermsOfServiceScreenView::kScreenId, OobeButton::kBack,
test::OobeJS().ClickOnPath(kArcTosBackButton); JSExecution::kSync);
OobeScreenWaiter(NetworkScreenView::kScreenId).Wait(); OobeScreenWaiter(NetworkScreenView::kScreenId).Wait();
} }
......
...@@ -80,8 +80,6 @@ using net::test_server::HttpResponse; ...@@ -80,8 +80,6 @@ using net::test_server::HttpResponse;
namespace chromeos { namespace chromeos {
namespace { namespace {
constexpr char kArcTosID[] = "arc-tos";
const test::UIPath kArcTosDialog = {kArcTosID, "arcTosDialog"};
enum class ArcState { kNotAvailable, kAcceptTerms }; enum class ArcState { kNotAvailable, kAcceptTerms };
std::string ArcStateToString(ArcState arc_state) { std::string ArcStateToString(ArcState arc_state) {
...@@ -153,7 +151,10 @@ void WaitForGaiaSignInScreen(bool arc_available) { ...@@ -153,7 +151,10 @@ void WaitForGaiaSignInScreen(bool arc_available) {
// TODO(https://crbug/com/959902): Fix ARC terms of service screen to better // TODO(https://crbug/com/959902): Fix ARC terms of service screen to better
// handle this case. // handle this case.
if (arc_available) { if (arc_available) {
test::OobeJS().CreateVisibilityWaiter(true, kArcTosDialog)->Wait(); test::OobeJS()
.CreateHasClassWaiter(true, "arc-tos-loaded",
{"arc-tos", "arcTosDialog"})
->Wait();
} }
LOG(INFO) << "OobeInteractiveUITest: Switched to 'gaia-signin' screen."; LOG(INFO) << "OobeInteractiveUITest: Switched to 'gaia-signin' screen.";
......
...@@ -18,7 +18,27 @@ cr-checkbox { ...@@ -18,7 +18,27 @@ cr-checkbox {
--cr-checkbox-label-padding-start: 16px; --cr-checkbox-label-padding-start: 16px;
} }
#errorMessage { .arc-tos-loaded .arc-tos-loading,
.arc-tos-loaded .arc-tos-error,
.arc-tos-loaded #arcTosRetryButton,
.arc-tos-loading .arc-tos-content,
.arc-tos-loading .arc-tos-error,
.arc-tos-loading #arcTosRetryButton,
.arc-tos-loading #arcTosAcceptButton,
.error .arc-tos-content,
.error .arc-tos-loading,
.error #arcTosAcceptButton,
.error #arcTosNextButton {
display: none;
}
.arc-tos-loading #arcTosNextButton,
.arc-tos-loading #arcTosRetryButton {
pointer-events: none;
}
.arc-tos-loading p,
.error p {
color: rgba(0, 0, 0, 0.87); color: rgba(0, 0, 0, 0.87);
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
...@@ -41,17 +61,33 @@ cr-checkbox { ...@@ -41,17 +61,33 @@ cr-checkbox {
font-weight: 600; font-weight: 600;
} }
#arcTosContainer::-webkit-scrollbar { #arcTosContainer::-webkit-scrollbar {
display: none; display: none;
} }
#arcTosView {
display: block;
height: 100%;
margin: auto;
min-height: 40px;
padding: 0;
width: 100%;
}
#arcTosViewContainer {
box-sizing: border-box;
margin: 0;
padding: 0;
}
#arcTosBackButton { #arcTosBackButton {
padding-inline-end: 6px; padding-inline-end: 6px;
} }
#arcTosOverlayWebview { #arcTosOverlayWebview {
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
display: flex; display: block;
height: 300px; height: 300px;
width: 100%; width: 100%;
} }
......
...@@ -19,69 +19,21 @@ ...@@ -19,69 +19,21 @@
<template> <template>
<style include="oobe-dialog-host"></style> <style include="oobe-dialog-host"></style>
<link rel="stylesheet" href="arc_terms_of_service.css"> <link rel="stylesheet" href="arc_terms_of_service.css">
<!-- LOADING DIALOG -->
<oobe-dialog id="arcTosLoadingDialog" has-buttons for-step="loading"
role="dialog"
aria-label$="[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]">
<h1 slot="title">
[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]
</h1>
<p slot="subtitle">
[[i18nDynamic(locale, 'arcTermsOfServiceScreenDescription')]]
</p>
<iron-icon src="chrome://oobe/playstore.svg" slot="oobe-icon">
</iron-icon>
<div slot="footer"
class="arc-tos-loading flex layout center-justified vertical">
<throbber-notice text-key="arcTermsOfServiceLoading">
</throbber-notice>
</div>
</oobe-dialog>
<!-- ERROR DIALOG -->
<oobe-dialog id="arcTosErrorDialog" has-buttons for-step="error"
role="dialog"
aria-label$="[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]">
<h1 slot="title">
[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]
</h1>
<p slot="subtitle">
[[i18nDynamic(locale, 'arcTermsOfServiceScreenDescription')]]
</p>
<iron-icon src="chrome://oobe/playstore.svg" slot="oobe-icon">
</iron-icon>
<div slot="footer">
<p id="errorMessage">
[[i18nDynamic(locale, 'arcTermsOfServiceError')]]
</p>
</div>
<div slot="bottom-buttons">
<oobe-text-button id="arcTosRetryButton" class="focus-on-show"
inverse on-click="onRetry_"
text-key="arcTermsOfServiceRetryButton"></oobe-text-button>
</div>
</oobe-dialog>
<!-- As this dialog have pre-loading logic that require access to elements, <!-- As this dialog have pre-loading logic that require access to elements,
dialog is marked as no-lazy. --> dialog is marked as no-lazy. -->
<oobe-dialog id="arcTosDialog" has-buttons for-step="loaded" <oobe-dialog id="arcTosDialog" has-buttons class="arc-tos-loading"
role="dialog" role="dialog"
aria-label$="[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]" aria-label$="[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]"
no-lazy> title-key="arcTermsOfServiceScreenHeading"
<h1 slot="title"> subtitle-key="arcTermsOfServiceScreenDescription" no-lazy>
[[i18nDynamic(locale, 'arcTermsOfServiceScreenHeading')]]
</h1>
<p slot="subtitle">
[[i18nDynamic(locale, 'arcTermsOfServiceScreenDescription')]]
</p>
<iron-icon src="chrome://oobe/playstore.svg" slot="oobe-icon"> <iron-icon src="chrome://oobe/playstore.svg" slot="oobe-icon">
</iron-icon> </iron-icon>
<div id="arcTosContainer" slot="footer" class="flex layout vertical"> <div id="arcTosContainer" slot="footer" class="flex layout vertical">
<webview id="arcTosView" allowTransparency <div id="arcTosViewContainer" class="arc-tos-content flex">
role="document" class="flex oobe-tos-webview" <webview id="arcTosView" allowTransparency
on-contentload="onTermsViewContentLoad_"> class="oobe-tos-webview"
</webview> on-contentload="onTermsViewContentLoad_"></webview>
</div>
<div id="arcPolicyLink" class="arc-tos-content" <div id="arcPolicyLink" class="arc-tos-content"
on-click="onPolicyLinkClick_"> on-click="onPolicyLinkClick_">
<a class="oobe-local-link" is="action-link"> <a class="oobe-local-link" is="action-link">
...@@ -161,13 +113,24 @@ ...@@ -161,13 +113,24 @@
</cr-checkbox> </cr-checkbox>
</div> </div>
</div> </div>
<div class="arc-tos-loading flex layout center-justified vertical">
<throbber-notice text-key="arcTermsOfServiceLoading">
</throbber-notice>
</div>
<div class="arc-tos-error">
<p>[[i18nDynamic(locale, 'arcTermsOfServiceError')]]</p>
</div>
</div> </div>
<div slot="back-navigation"> <div slot="back-navigation">
<oobe-back-button id="arcTosBackButton" hidden="[[!demoMode]]" <oobe-back-button id="arcTosBackButton" hidden="[[!demoMode]]"
on-click="onBack_"></oobe-back-button> on-click="onBack_"></oobe-back-button>
</div> </div>
<div slot="bottom-buttons"> <div slot="bottom-buttons">
<oobe-text-button id="arcTosNextButton" class="focus-on-show" <oobe-text-button id="arcTosRetryButton"
inverse on-click="onRetry_"
disabled="[[arcTosButtonsDisabled]]"
text-key="arcTermsOfServiceRetryButton"></oobe-text-button>
<oobe-text-button id="arcTosNextButton"
inverse on-click="onNext_" inverse on-click="onNext_"
disabled="[[arcTosButtonsDisabled]]" disabled="[[arcTosButtonsDisabled]]"
hidden="[[showFullDialog]]" hidden="[[showFullDialog]]"
...@@ -224,8 +187,7 @@ ...@@ -224,8 +187,7 @@
<oobe-modal-dialog id="arcTosOverlayPrivacyPolicy" <oobe-modal-dialog id="arcTosOverlayPrivacyPolicy"
on-close="onOverlayClosed_"> on-close="onOverlayClosed_">
<div slot="content" id = "arcTosOverlayWebviewContainer"> <div slot="content" id = "arcTosOverlayWebviewContainer">
<webview id="arcTosOverlayWebview" <webview id="arcTosOverlayWebview" hidden="[[overlayLoading_]]"
hidden="[[overlayLoading_]]" class="flex oobe-tos-webview"
on-contentload="onAcrTosOverlayContentLoad_"> on-contentload="onAcrTosOverlayContentLoad_">
</webview> </webview>
<throbber-notice class="flex layout center-justified vertical" <throbber-notice class="flex layout center-justified vertical"
......
...@@ -6,21 +6,11 @@ ...@@ -6,21 +6,11 @@
* @fileoverview Polymer element for displaying material design for ARC Terms Of * @fileoverview Polymer element for displaying material design for ARC Terms Of
* Service screen. * Service screen.
*/ */
'use strict';
(function() {
// Enum that describes the current state of the Arc Terms Of Service screen
const UIState = {
LOADING: 'loading',
LOADED: 'loaded',
ERROR: 'error',
};
Polymer({ Polymer({
is: 'arc-tos-element', is: 'arc-tos-element',
behaviors: [OobeI18nBehavior, MultiStepBehavior, LoginScreenBehavior], behaviors: [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior],
EXTERNAL_API: [ EXTERNAL_API: [
'setMetricsMode', 'setMetricsMode',
...@@ -190,13 +180,6 @@ Polymer({ ...@@ -190,13 +180,6 @@ Polymer({
*/ */
termsOfServiceHostName_: 'https://play.google.com', termsOfServiceHostName_: 'https://play.google.com',
defaultUIStep() {
return UIState.LOADING;
},
UI_STEPS: UIState,
/** @override */ /** @override */
ready() { ready() {
this.initializeLoginScreen('ArcTermsOfServiceScreen', { this.initializeLoginScreen('ArcTermsOfServiceScreen', {
...@@ -218,6 +201,7 @@ Polymer({ ...@@ -218,6 +201,7 @@ Polymer({
* Event handler that is invoked just before the screen is shown. * Event handler that is invoked just before the screen is shown.
*/ */
onBeforeShow() { onBeforeShow() {
this.focusButton_();
this.is_shown_ = true; this.is_shown_ = true;
window.setTimeout(this.applyOobeConfiguration_.bind(this), 0); window.setTimeout(this.applyOobeConfiguration_.bind(this), 0);
...@@ -283,6 +267,20 @@ Polymer({ ...@@ -283,6 +267,20 @@ Polymer({
this.$.arcTosNextButton.focus(); this.$.arcTosNextButton.focus();
}, },
focusButton_() {
var id;
if (this.hasClass_('arc-tos-loaded')) {
id = 'arcTosNextButton';
} else if (this.hasClass_('error')) {
id = 'arcTosRetryButton';
}
if (typeof id === 'undefined')
return;
Polymer.RenderStatus.afterNextRender(this, () => this.$[id].focus());
},
/** /**
* Makes sure that UI is initialized. * Makes sure that UI is initialized.
* *
...@@ -412,7 +410,7 @@ Polymer({ ...@@ -412,7 +410,7 @@ Polymer({
countryCode = countryCode.toLowerCase(); countryCode = countryCode.toLowerCase();
if (this.language_ && this.language_ == language && this.countryCode_ && if (this.language_ && this.language_ == language && this.countryCode_ &&
this.countryCode_ == countryCode && this.uiStep != UIState.ERROR && this.countryCode_ == countryCode && !this.classList.contains('error') &&
!this.usingOfflineTerms_ && this.tosContent_) { !this.usingOfflineTerms_ && this.tosContent_) {
this.enableButtons_(true); this.enableButtons_(true);
return; return;
...@@ -438,7 +436,7 @@ Polymer({ ...@@ -438,7 +436,7 @@ Polymer({
// Try to use currently loaded document first. // Try to use currently loaded document first.
var self = this; var self = this;
if (termsView.src != '' && this.isLoaded_()) { if (termsView.src != '' && this.classList.contains('arc-tos-loaded')) {
var navigateScript = 'processLangZoneTerms(true, \'' + language + var navigateScript = 'processLangZoneTerms(true, \'' + language +
'\', \'' + countryCode + '\');'; '\', \'' + countryCode + '\');';
termsView.executeScript({code: navigateScript}, function(results) { termsView.executeScript({code: navigateScript}, function(results) {
...@@ -491,7 +489,7 @@ Polymer({ ...@@ -491,7 +489,7 @@ Polymer({
* @param {boolean} child whether current account is a child account. * @param {boolean} child whether current account is a child account.
*/ */
setArcManaged(managed, child) { setArcManaged(managed, child) {
this.$.arcTosView.hidden = managed; this.$.arcTosViewContainer.hidden = managed;
this.isChild = child; this.isChild = child;
}, },
...@@ -533,7 +531,9 @@ Polymer({ ...@@ -533,7 +531,9 @@ Polymer({
this.usingOfflineTerms_ = false; this.usingOfflineTerms_ = false;
var termsView = this.$.arcTosView; var termsView = this.$.arcTosView;
termsView.src = this.termsOfServiceHostName_ + '/about/play-terms.html'; termsView.src = this.termsOfServiceHostName_ + '/about/play-terms.html';
this.setUIStep(UIState.LOADING); this.removeClass_('arc-tos-loaded');
this.removeClass_('error');
this.addClass_('arc-tos-loading');
this.enableButtons_(false); this.enableButtons_(false);
}, },
...@@ -551,6 +551,36 @@ Polymer({ ...@@ -551,6 +551,36 @@ Polymer({
this.demoMode = false; this.demoMode = false;
}, },
/**
* Adds new class to the list of classes of root OOBE style.
* @param {string} className class to remove.
*
* @private
*/
addClass_(className) {
this.$.arcTosDialog.classList.add(className);
},
/**
* Removes class from the list of classes of root OOBE style.
* @param {string} className class to remove.
*
* @private
*/
removeClass_(className) {
this.$.arcTosDialog.classList.remove(className);
},
/**
* Checks if class exists in the list of classes of root OOBE style.
* @param {string} className class to check.
*
* @private
*/
hasClass_(className) {
return this.$.arcTosDialog.classList.contains(className);
},
/** /**
* Returns a match pattern compatible version of termsOfServiceHostName_ by * Returns a match pattern compatible version of termsOfServiceHostName_ by
* stripping the port number part of the hostname. During tests * stripping the port number part of the hostname. During tests
...@@ -612,7 +642,10 @@ Polymer({ ...@@ -612,7 +642,10 @@ Polymer({
* @private * @private
*/ */
setTermsViewContentLoadedState_() { setTermsViewContentLoadedState_() {
this.setUIStep(UIState.LOADED); this.removeClass_('arc-tos-loading');
this.removeClass_('error');
this.addClass_('arc-tos-loaded');
this.enableButtons_(true); this.enableButtons_(true);
this.showFullDialog = false; this.showFullDialog = false;
this.$.arcTosNextButton.focus(); this.$.arcTosNextButton.focus();
...@@ -640,7 +673,9 @@ Polymer({ ...@@ -640,7 +673,9 @@ Polymer({
*/ */
showError_() { showError_() {
this.termsError = true; this.termsError = true;
this.setUIStep(UIState.ERROR); this.removeClass_('arc-tos-loading');
this.removeClass_('arc-tos-loaded');
this.addClass_('error');
this.enableButtons_(true); this.enableButtons_(true);
this.$.arcTosRetryButton.focus(); this.$.arcTosRetryButton.focus();
...@@ -671,7 +706,9 @@ Polymer({ ...@@ -671,7 +706,9 @@ Polymer({
* Shows loading screen for debugging purpose * Shows loading screen for debugging purpose
*/ */
showLoadingScreenForTesting() { showLoadingScreenForTesting() {
this.setUIStep(UIState.LOADING); this.removeClass_('arc-tos-loaded');
this.removeClass_('error');
this.addClass_('arc-tos-loading');
this.enableButtons_(false); this.enableButtons_(false);
}, },
...@@ -777,6 +814,5 @@ Polymer({ ...@@ -777,6 +814,5 @@ Polymer({
this.lastFocusedElement_.focus(); this.lastFocusedElement_.focus();
this.lastFocusedElement_ = null; this.lastFocusedElement_ = null;
} }
}, }
}); });
})();
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