Commit 5f174dae authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

cros kiosk: Remove kiosk notifications

This CL removes NOTIFICATION_KIOSK_ENABLED and
NOTIFICATION_KIOSK_APPS_LOADED notifications.
These were used for the tests. Replaced with
ash::LoginScreenTestApi::WaitForUiUpdate

I'm gonna fix KioskErrorScreenTest.OpenCertificateConfig in a separate
CL

Bug: none
Change-Id: I61a19f708683c16d7a2ec764a29a978c023893e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544523Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarAnatoliy Potapchuk <apotapchuk@chromium.org>
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828806}
parent a299e63c
......@@ -171,12 +171,6 @@ enum NotificationType {
// NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE
NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
// Send when consumer kiosk has been enabled.
NOTIFICATION_KIOSK_ENABLED,
// Sent when kiosk app list is loaded in UI.
NOTIFICATION_KIOSK_APPS_LOADED,
// Sent when the screen lock state has changed. The source is
// ScreenLocker and the details is a bool specifing that the
// screen is locked. When details is a false, the source object
......
......@@ -96,9 +96,6 @@
#include "components/signin/public/identity_manager/identity_manager.h"
#include "content/public/browser/audio_service.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_ui.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
......@@ -560,7 +557,7 @@ class KioskTest : public OobeBaseTest {
void ReloadKioskApps() {
SetupTestAppUpdateCheck();
// Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires.
// Remove then add to ensure UI update.
KioskAppManager::Get()->RemoveApp(test_app_id_,
owner_settings_service_.get());
KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get());
......@@ -604,11 +601,9 @@ class KioskTest : public OobeBaseTest {
StartUIForAppLaunch();
// Wait for the Kiosk App configuration to reload.
content::WindowedNotificationObserver apps_loaded_signal(
chrome::NOTIFICATION_KIOSK_APPS_LOADED,
content::NotificationService::AllSources());
int ui_update_count = ash::LoginScreenTestApi::GetUiUpdateCount();
ReloadKioskApps();
apps_loaded_signal.Wait();
ash::LoginScreenTestApi::WaitForUiUpdate(ui_update_count);
}
void StartAppLaunchFromLoginScreen(
......@@ -1243,12 +1238,12 @@ IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableConfirmed) {
// Wait for the kiosk_enable screen to show and enable kiosk.
OobeScreenWaiter(KioskEnableScreenView::kScreenId).Wait();
// Wait for the signal that indicates Kiosk Mode is enabled.
content::WindowedNotificationObserver notification_observer(
chrome::NOTIFICATION_KIOSK_ENABLED,
content::NotificationService::AllSources());
test::OobeJS().TapOnPath({"kiosk-enable", "enable"});
notification_observer.Wait();
// Wait for the signal that indicates Kiosk Mode is enabled.
test::OobeJS()
.CreateWaiter(test::GetOobeElementPath({"kiosk-enable"}) +
".state_ == 'success'")
->Wait();
EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED,
GetConsumerKioskModeStatus());
......
......@@ -7,7 +7,6 @@
#include "ash/public/cpp/shelf_config.h"
#include "ash/public/cpp/shelf_test_api.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_manager.h"
#include "chrome/browser/chromeos/login/app_mode/kiosk_launch_controller.h"
#include "chrome/browser/chromeos/login/test/device_state_mixin.h"
......@@ -27,7 +26,6 @@
#include "components/account_id/account_id.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/test/event_generator.h"
......@@ -75,19 +73,17 @@ class WebKioskTest : public OobeBaseTest {
const AccountId& account_id() { return account_id_; }
void PrepareAppLaunch() {
// Wait for the Kiosk App configuration to reload.
content::WindowedNotificationObserver apps_loaded_signal(
chrome::NOTIFICATION_KIOSK_APPS_LOADED,
content::NotificationService::AllSources());
std::vector<policy::DeviceLocalAccount> device_local_accounts = {
policy::DeviceLocalAccount(
policy::WebKioskAppBasicInfo(kAppInstallUrl, "", ""),
kAppInstallUrl)};
settings_ = std::make_unique<ScopedDeviceSettings>();
int ui_update_count = ash::LoginScreenTestApi::GetUiUpdateCount();
policy::SetDeviceLocalAccounts(settings_->owner_settings_service(),
device_local_accounts);
apps_loaded_signal.Wait();
// Wait for the Kiosk App configuration to reload.
ash::LoginScreenTestApi::WaitForUiUpdate(ui_update_count);
}
void MakeAppAlreadyInstalled() {
......
......@@ -6,7 +6,6 @@
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/fake_cws.h"
#include "chrome/browser/chromeos/login/app_mode/kiosk_launch_controller.h"
#include "chrome/browser/chromeos/login/login_wizard.h"
......@@ -32,7 +31,6 @@
#include "components/policy/proto/chrome_device_policy.pb.h"
#include "components/user_manager/user_manager.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "net/dns/mock_host_resolver.h"
#include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -278,25 +276,14 @@ class KioskErrorScreenTest : public MixinBasedInProcessBrowserTest {
kWifiServiceName, "wifi_guid", kWifiNetworkName, shill::kTypeWifi,
shill::kStateOffline, /*visible=*/true);
apps_loaded_waiter_ =
std::make_unique<content::WindowedNotificationObserver>(
chrome::NOTIFICATION_KIOSK_APPS_LOADED,
content::NotificationService::AllSources());
MixinBasedInProcessBrowserTest::SetUpOnMainThread();
}
void TearDownOnMainThread() override {
network_helper_.reset();
apps_loaded_waiter_.reset();
MixinBasedInProcessBrowserTest::TearDownOnMainThread();
}
protected:
content::WindowedNotificationObserver* apps_loaded_waiter() {
return apps_loaded_waiter_.get();
}
private:
void AddKioskAppToDevicePolicy() {
std::unique_ptr<ScopedDevicePolicyUpdate> device_policy_update =
......@@ -320,8 +307,6 @@ class KioskErrorScreenTest : public MixinBasedInProcessBrowserTest {
std::unique_ptr<NetworkStateTestHelper> network_helper_;
std::unique_ptr<content::WindowedNotificationObserver> apps_loaded_waiter_;
std::unique_ptr<base::AutoReset<bool>> skip_splash_wait_override_;
std::unique_ptr<base::AutoReset<base::TimeDelta>> network_wait_override_;
......@@ -341,7 +326,6 @@ class KioskErrorScreenTest : public MixinBasedInProcessBrowserTest {
// Verify that certificate manager dialog opens.
// Disabled for being flaky. See crbug.com/1116058.
IN_PROC_BROWSER_TEST_F(KioskErrorScreenTest, DISABLED_OpenCertificateConfig) {
apps_loaded_waiter()->Wait();
EXPECT_TRUE(ash::LoginScreenTestApi::LaunchApp(kTestKioskAppId));
OobeScreenWaiter(ErrorScreenView::kScreenId).Wait();
......
......@@ -5,12 +5,9 @@
#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen.h"
#include "base/logging.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/customization/customization_document.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
namespace chromeos {
namespace {
......@@ -90,11 +87,6 @@ void KioskEnableScreen::OnEnableConsumerKioskAutoLaunch(bool success) {
view_->ShowKioskEnabled(success);
if (!success) {
LOG(WARNING) << "Consumer kiosk mode can't be enabled!";
} else {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_KIOSK_ENABLED,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
}
}
......
......@@ -9,7 +9,6 @@
#include "ash/public/cpp/kiosk_app_menu.h"
#include "ash/public/cpp/login_screen.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_data.h"
#include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
......@@ -19,7 +18,6 @@
#include "chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_manager.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/ui/ash/login_screen_client.h"
#include "content/public/browser/notification_service.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image_skia.h"
......@@ -79,11 +77,6 @@ void KioskAppMenuController::SendKioskApps() {
weak_factory_.GetWeakPtr()),
base::BindRepeating(&KioskAppMenuController::OnMenuWillShow,
weak_factory_.GetWeakPtr()));
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_KIOSK_APPS_LOADED,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
KioskAppLaunchError::Error error = KioskAppLaunchError::Get();
if (error == KioskAppLaunchError::NONE)
return;
......
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