Commit 36aaf5ba authored by Yunke Zhou's avatar Yunke Zhou Committed by Commit Bot

Oobe: refactor SupervisionTransitionScreen to use LoginScreenBehavior

Bug: 1134052
Change-Id: Ia6dcf95339d38029b1de4fa9234d1bc7910ba932
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2440532Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Yunke Zhou <yunkez@google.com>
Cr-Commit-Position: refs/heads/master@{#813143}
parent f128a6a6
...@@ -34,6 +34,18 @@ ...@@ -34,6 +34,18 @@
namespace chromeos { namespace chromeos {
namespace {
constexpr char kSupervisionTransitionId[] = "supervision-transition";
const test::UIPath kSupervisionDialog = {kSupervisionTransitionId,
"supervisionTransitionDialog"};
const test::UIPath kErrorDialog = {kSupervisionTransitionId,
"supervisionTransitionErrorDialog"};
const test::UIPath kAcceptButton = {kSupervisionTransitionId, "accept-button"};
} // namespace
// Param returns the original user type. // Param returns the original user type.
class SupervisionTransitionScreenTest class SupervisionTransitionScreenTest
: public MixinBasedInProcessBrowserTest, : public MixinBasedInProcessBrowserTest,
...@@ -100,10 +112,8 @@ IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest, ...@@ -100,10 +112,8 @@ IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest,
IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest, SuccessfulTransition) { IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest, SuccessfulTransition) {
OobeScreenWaiter(SupervisionTransitionScreenView::kScreenId).Wait(); OobeScreenWaiter(SupervisionTransitionScreenView::kScreenId).Wait();
test::OobeJS().ExpectVisiblePath( test::OobeJS().ExpectVisiblePath(kSupervisionDialog);
{"supervision-transition-md", "supervisionTransitionDialog"}); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(
{"supervision-transition-md", "supervisionTransitionErrorDialog"});
EXPECT_FALSE(ash::LoginScreenTestApi::IsGuestButtonShown()); EXPECT_FALSE(ash::LoginScreenTestApi::IsGuestButtonShown());
EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown()); EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown());
...@@ -129,10 +139,8 @@ IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest, ...@@ -129,10 +139,8 @@ IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest,
DISABLED_TransitionTimeout) { DISABLED_TransitionTimeout) {
OobeScreenWaiter(SupervisionTransitionScreenView::kScreenId).Wait(); OobeScreenWaiter(SupervisionTransitionScreenView::kScreenId).Wait();
test::OobeJS().ExpectVisiblePath( test::OobeJS().ExpectVisiblePath(kSupervisionDialog);
{"supervision-transition-md", "supervisionTransitionDialog"}); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(
{"supervision-transition-md", "supervisionTransitionErrorDialog"});
EXPECT_FALSE(ash::LoginScreenTestApi::IsGuestButtonShown()); EXPECT_FALSE(ash::LoginScreenTestApi::IsGuestButtonShown());
EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown()); EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown());
...@@ -148,17 +156,13 @@ IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest, ...@@ -148,17 +156,13 @@ IN_PROC_BROWSER_TEST_P(SupervisionTransitionScreenTest,
EXPECT_TRUE(ProfileManager::GetPrimaryUserProfile()->GetPrefs()->GetBoolean( EXPECT_TRUE(ProfileManager::GetPrimaryUserProfile()->GetPrefs()->GetBoolean(
arc::prefs::kArcDataRemoveRequested)); arc::prefs::kArcDataRemoveRequested));
test::OobeJS() test::OobeJS().CreateVisibilityWaiter(true, kErrorDialog)->Wait();
.CreateVisibilityWaiter(true, {"supervision-transition-md", test::OobeJS().ExpectHiddenPath(kSupervisionDialog);
"supervisionTransitionErrorDialog"})
->Wait();
test::OobeJS().ExpectHiddenPath(
{"supervision-transition-md", "supervisionTransitionDialog"});
EXPECT_FALSE(ash::LoginScreenTestApi::IsGuestButtonShown()); EXPECT_FALSE(ash::LoginScreenTestApi::IsGuestButtonShown());
EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown()); EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown());
test::OobeJS().TapOnPath({"supervision-transition-md", "accept-button"}); test::OobeJS().TapOnPath(kAcceptButton);
logged_in_user_mixin().GetLoginManagerMixin()->WaitForActiveSession(); logged_in_user_mixin().GetLoginManagerMixin()->WaitForActiveSession();
} }
......
...@@ -249,6 +249,7 @@ js_library("oobe_reset") { ...@@ -249,6 +249,7 @@ js_library("oobe_reset") {
js_library("oobe_supervision_transition") { js_library("oobe_supervision_transition") {
deps = [ deps = [
"components:login_screen_behavior",
"components:oobe_dialog_host_behavior", "components:oobe_dialog_host_behavior",
"components:oobe_i18n_behavior", "components:oobe_i18n_behavior",
] ]
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
<link rel="stylesheet" href="oobe_screen_enable_debugging.css"> <link rel="stylesheet" href="oobe_screen_enable_debugging.css">
<link rel="stylesheet" href="oobe_screen_autolaunch.css"> <link rel="stylesheet" href="oobe_screen_autolaunch.css">
<link rel="stylesheet" href="oobe_screen_auto_enrollment_check.css"> <link rel="stylesheet" href="oobe_screen_auto_enrollment_check.css">
<link rel="stylesheet" href="oobe_screen_supervision_transition.css">
<link rel="stylesheet" href="screen_app_launch_splash.css"> <link rel="stylesheet" href="screen_app_launch_splash.css">
<link rel="stylesheet" href="screen_error_message.css"> <link rel="stylesheet" href="screen_error_message.css">
<link rel="stylesheet" href="screen_fatal_error.css"> <link rel="stylesheet" href="screen_fatal_error.css">
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
// src="../../../../../ui/login/account_picker/chromeos_user_pod_row.js"> // src="../../../../../ui/login/account_picker/chromeos_user_pod_row.js">
// <include src="cr_ui.js"> // <include src="cr_ui.js">
// <include src="oobe_screen_autolaunch.js"> // <include src="oobe_screen_autolaunch.js">
// <include src="oobe_screen_supervision_transition.js">
// <include src="oobe_screen_assistant_optin_flow.js"> // <include src="oobe_screen_assistant_optin_flow.js">
// <include src="oobe_select.js"> // <include src="oobe_select.js">
...@@ -61,7 +60,6 @@ cr.define('cr.ui.Oobe', function() { ...@@ -61,7 +60,6 @@ cr.define('cr.ui.Oobe', function() {
login.AppLaunchSplashScreen.register(); login.AppLaunchSplashScreen.register();
login.FatalErrorScreen.register(); login.FatalErrorScreen.register();
login.EncryptionMigrationScreen.register(); login.EncryptionMigrationScreen.register();
login.SupervisionTransitionScreen.register();
login.UpdateRequiredScreen.register(); login.UpdateRequiredScreen.register();
login.DiscoverScreen.register(); login.DiscoverScreen.register();
login.AssistantOptInFlowScreen.register(); login.AssistantOptInFlowScreen.register();
......
/* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
#supervision-transition {
display: flex;
flex-flow: column;
font-size: 16px;
min-height: 0;
}
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<div class="step hidden" id="supervision-transition"
role="group" hidden>
<supervision-transition-md id="supervision-transition-md">
</supervision-transition-md>
</div>
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Oobe Supervision Transition screen implementation.
*/
login.createScreen(
'SupervisionTransitionScreen', 'supervision-transition', function() {
return {
/** @override */
get defaultControl() {
return $('supervision-transition-md');
},
/** @override */
onBeforeShow(data) {
$('supervision-transition-md')
.setIsRemovingSupervision(
data['isRemovingSupervision'] ? true : false);
},
};
});
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Use of this source code is governed by a BSD-style license that can be Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. --> found in the LICENSE file. -->
<dom-module id="supervision-transition-md"> <dom-module id="supervision-transition">
<template> <template>
<style include="oobe-dialog-host"></style> <style include="oobe-dialog-host"></style>
<link rel="stylesheet" href="oobe_supervision_transition.css"> <link rel="stylesheet" href="oobe_supervision_transition.css">
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
*/ */
Polymer({ Polymer({
is: 'supervision-transition-md', is: 'supervision-transition',
behaviors: [OobeI18nBehavior, OobeDialogHostBehavior], behaviors: [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior],
properties: { properties: {
/** /**
...@@ -19,6 +19,16 @@ Polymer({ ...@@ -19,6 +19,16 @@ Polymer({
isRemovingSupervision_: Boolean, isRemovingSupervision_: Boolean,
}, },
ready() {
this.initializeLoginScreen('SupervisionTransitionScreen', {
resetAllowed: false,
});
},
onBeforeShow(data) {
this.setIsRemovingSupervision(data['isRemovingSupervision']);
},
setIsRemovingSupervision(is_removing_supervision) { setIsRemovingSupervision(is_removing_supervision) {
this.isRemovingSupervision_ = is_removing_supervision; this.isRemovingSupervision_ = is_removing_supervision;
}, },
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<!-- Login-specific screens --> <!-- Login-specific screens -->
<terms-of-service id="terms-of-service" class="step hidden"> <terms-of-service id="terms-of-service" class="step hidden">
</terms-of-service> </terms-of-service>
<include src="../oobe_screen_supervision_transition.html"> <supervision-transition id="supervision-transition" class="step hidden" hidden>
</supervision-transition>
<gaia-password-changed id="gaia-password-changed" <gaia-password-changed id="gaia-password-changed"
class="step hidden" hidden> class="step hidden" hidden>
</gaia-password-changed> </gaia-password-changed>
......
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