Commit 94bdd340 authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

cros kiosk: Remove autolaunch notifications

This CL eliminates NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE and
NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED notifications.
These were used for the tests only. Replaced it with javascript waiter.

Bug: none
Change-Id: Iea1f187d43fc708c2c23e02e4ebfe37d8a38b329
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544138Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarAnatoliy Potapchuk <apotapchuk@chromium.org>
Commit-Queue: Anatoliy Potapchuk <apotapchuk@chromium.org>
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828179}
parent 968f303c
...@@ -171,12 +171,6 @@ enum NotificationType { ...@@ -171,12 +171,6 @@ enum NotificationType {
// NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE // NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE
NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
// Send when kiosk auto-launch warning screen is visible.
NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
// Send when kiosk auto-launch warning screen had completed.
NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED,
// Send when consumer kiosk has been enabled. // Send when consumer kiosk has been enabled.
NOTIFICATION_KIOSK_ENABLED, NOTIFICATION_KIOSK_ENABLED,
......
...@@ -835,6 +835,10 @@ class KioskTest : public OobeBaseTest { ...@@ -835,6 +835,10 @@ class KioskTest : public OobeBaseTest {
} }
} }
void WaitForAuthLaunchWarning(bool visibility) {
test::OobeJS().CreateVisibilityWaiter(visibility, {"autolaunch"})->Wait();
}
MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } MockUserManager* mock_user_manager() { return mock_user_manager_.get(); }
void set_test_app_id(const std::string& test_app_id) { void set_test_app_id(const std::string& test_app_id) {
...@@ -1146,18 +1150,12 @@ IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningCancel) { ...@@ -1146,18 +1150,12 @@ IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningCancel) {
wizard_controller->SkipToLoginForTesting(); wizard_controller->SkipToLoginForTesting();
// Wait for the auto launch warning come up. // Wait for the auto launch warning come up.
content::WindowedNotificationObserver( WaitForAuthLaunchWarning(/*visibility=*/true);
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
content::NotificationService::AllSources())
.Wait();
GetLoginUI()->CallJavascriptFunctionUnsafe( GetLoginUI()->CallJavascriptFunctionUnsafe(
"login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(false)); "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(false));
// Wait for the auto launch warning to go away. // Wait for the auto launch warning to go away.
content::WindowedNotificationObserver( WaitForAuthLaunchWarning(/*visibility=*/false);
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED,
content::NotificationService::AllSources())
.Wait();
EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled());
} }
...@@ -1179,18 +1177,13 @@ IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { ...@@ -1179,18 +1177,13 @@ IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) {
wizard_controller->SkipToLoginForTesting(); wizard_controller->SkipToLoginForTesting();
// Wait for the auto launch warning come up. // Wait for the auto launch warning come up.
content::WindowedNotificationObserver( WaitForAuthLaunchWarning(/*visibility=*/true);
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
content::NotificationService::AllSources())
.Wait();
GetLoginUI()->CallJavascriptFunctionUnsafe( GetLoginUI()->CallJavascriptFunctionUnsafe(
"login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true));
// Wait for the auto launch warning to go away. // Wait for the auto launch warning to go away.
content::WindowedNotificationObserver( WaitForAuthLaunchWarning(/*visibility=*/false);
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED,
content::NotificationService::AllSources())
.Wait();
EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty());
EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled());
...@@ -1341,10 +1334,7 @@ IN_PROC_BROWSER_TEST_F(KioskTest, NoConsumerAutoLaunchWhenUntrusted) { ...@@ -1341,10 +1334,7 @@ IN_PROC_BROWSER_TEST_F(KioskTest, NoConsumerAutoLaunchWhenUntrusted) {
wizard_controller->AdvanceToScreen(WelcomeView::kScreenId); wizard_controller->AdvanceToScreen(WelcomeView::kScreenId);
ReloadAutolaunchKioskApps(); ReloadAutolaunchKioskApps();
wizard_controller->SkipToLoginForTesting(); wizard_controller->SkipToLoginForTesting();
content::WindowedNotificationObserver( WaitForAuthLaunchWarning(/*visibility=*/true);
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
content::NotificationService::AllSources())
.Wait();
GetLoginUI()->CallJavascriptFunctionUnsafe( GetLoginUI()->CallJavascriptFunctionUnsafe(
"login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true));
...@@ -2828,10 +2818,7 @@ IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) { ...@@ -2828,10 +2818,7 @@ IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) {
EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled());
// Wait for the auto launch warning come up. // Wait for the auto launch warning come up.
content::WindowedNotificationObserver( WaitForAuthLaunchWarning(/*visibility=*/true);
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
content::NotificationService::AllSources())
.Wait();
// Wait for the wallpaper to load. // Wait for the wallpaper to load.
WaitForWallpaper(); WaitForWallpaper();
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
#include "chrome/browser/chromeos/login/oobe_screen.h" #include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h"
...@@ -21,8 +20,6 @@ ...@@ -21,8 +20,6 @@
#include "components/login/localized_values_builder.h" #include "components/login/localized_values_builder.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "ui/base/webui/web_ui_util.h" #include "ui/base/webui/web_ui_util.h"
namespace chromeos { namespace chromeos {
...@@ -115,11 +112,6 @@ void KioskAutolaunchScreenHandler::HandleOnCancel() { ...@@ -115,11 +112,6 @@ void KioskAutolaunchScreenHandler::HandleOnCancel() {
KioskAppManager::Get()->SetEnableAutoLaunch(false); KioskAppManager::Get()->SetEnableAutoLaunch(false);
if (delegate_) if (delegate_)
delegate_->OnExit(false); delegate_->OnExit(false);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
} }
void KioskAutolaunchScreenHandler::HandleOnConfirm() { void KioskAutolaunchScreenHandler::HandleOnConfirm() {
...@@ -127,11 +119,6 @@ void KioskAutolaunchScreenHandler::HandleOnConfirm() { ...@@ -127,11 +119,6 @@ void KioskAutolaunchScreenHandler::HandleOnConfirm() {
KioskAppManager::Get()->SetEnableAutoLaunch(true); KioskAppManager::Get()->SetEnableAutoLaunch(true);
if (delegate_) if (delegate_)
delegate_->OnExit(true); delegate_->OnExit(true);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
} }
void KioskAutolaunchScreenHandler::HandleOnVisible() { void KioskAutolaunchScreenHandler::HandleOnVisible() {
...@@ -140,10 +127,6 @@ void KioskAutolaunchScreenHandler::HandleOnVisible() { ...@@ -140,10 +127,6 @@ void KioskAutolaunchScreenHandler::HandleOnVisible() {
is_visible_ = true; is_visible_ = true;
UpdateKioskApp(); UpdateKioskApp();
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
} }
void KioskAutolaunchScreenHandler::OnKioskAppsSettingsChanged() { void KioskAutolaunchScreenHandler::OnKioskAppsSettingsChanged() {
......
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