OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <memory> | 5 #include <memory> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "ash/common/wallpaper/wallpaper_controller.h" | 8 #include "ash/common/wallpaper/wallpaper_controller.h" |
9 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | 9 #include "ash/common/wallpaper/wallpaper_controller_observer.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 556 |
557 void SetUpCommandLine(base::CommandLine* command_line) override { | 557 void SetUpCommandLine(base::CommandLine* command_line) override { |
558 OobeBaseTest::SetUpCommandLine(command_line); | 558 OobeBaseTest::SetUpCommandLine(command_line); |
559 fake_cws_->Init(embedded_test_server()); | 559 fake_cws_->Init(embedded_test_server()); |
560 } | 560 } |
561 | 561 |
562 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { | 562 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { |
563 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 563 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
564 GetLoginUI()->CallJavascriptFunctionUnsafe( | 564 GetLoginUI()->CallJavascriptFunctionUnsafe( |
565 new_kiosk_ui ? kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, | 565 new_kiosk_ui ? kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, |
566 base::StringValue(app_id), base::FundamentalValue(diagnostic_mode)); | 566 base::StringValue(app_id), base::Value(diagnostic_mode)); |
567 } | 567 } |
568 | 568 |
569 void ReloadKioskApps() { | 569 void ReloadKioskApps() { |
570 SetupTestAppUpdateCheck(); | 570 SetupTestAppUpdateCheck(); |
571 | 571 |
572 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. | 572 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. |
573 KioskAppManager::Get()->RemoveApp(test_app_id_, | 573 KioskAppManager::Get()->RemoveApp(test_app_id_, |
574 owner_settings_service_.get()); | 574 owner_settings_service_.get()); |
575 KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get()); | 575 KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get()); |
576 } | 576 } |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 ReloadAutolaunchKioskApps(); | 1087 ReloadAutolaunchKioskApps(); |
1088 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1088 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
1089 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1089 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
1090 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1090 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
1091 | 1091 |
1092 // Wait for the auto launch warning come up. | 1092 // Wait for the auto launch warning come up. |
1093 content::WindowedNotificationObserver( | 1093 content::WindowedNotificationObserver( |
1094 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1094 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1095 content::NotificationService::AllSources()).Wait(); | 1095 content::NotificationService::AllSources()).Wait(); |
1096 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1096 GetLoginUI()->CallJavascriptFunctionUnsafe( |
1097 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1097 "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(false)); |
1098 base::FundamentalValue(false)); | |
1099 | 1098 |
1100 // Wait for the auto launch warning to go away. | 1099 // Wait for the auto launch warning to go away. |
1101 content::WindowedNotificationObserver( | 1100 content::WindowedNotificationObserver( |
1102 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, | 1101 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, |
1103 content::NotificationService::AllSources()).Wait(); | 1102 content::NotificationService::AllSources()).Wait(); |
1104 | 1103 |
1105 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1104 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
1106 } | 1105 } |
1107 | 1106 |
1108 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { | 1107 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { |
(...skipping 10 matching lines...) Expand all Loading... |
1119 ReloadAutolaunchKioskApps(); | 1118 ReloadAutolaunchKioskApps(); |
1120 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1119 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
1121 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1120 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
1122 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1121 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
1123 | 1122 |
1124 // Wait for the auto launch warning come up. | 1123 // Wait for the auto launch warning come up. |
1125 content::WindowedNotificationObserver( | 1124 content::WindowedNotificationObserver( |
1126 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1125 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1127 content::NotificationService::AllSources()).Wait(); | 1126 content::NotificationService::AllSources()).Wait(); |
1128 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1127 GetLoginUI()->CallJavascriptFunctionUnsafe( |
1129 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1128 "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); |
1130 base::FundamentalValue(true)); | |
1131 | 1129 |
1132 // Wait for the auto launch warning to go away. | 1130 // Wait for the auto launch warning to go away. |
1133 content::WindowedNotificationObserver( | 1131 content::WindowedNotificationObserver( |
1134 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, | 1132 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, |
1135 content::NotificationService::AllSources()).Wait(); | 1133 content::NotificationService::AllSources()).Wait(); |
1136 | 1134 |
1137 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1135 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
1138 EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1136 EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
1139 | 1137 |
1140 WaitForAppLaunchSuccess(); | 1138 WaitForAppLaunchSuccess(); |
(...skipping 18 matching lines...) Expand all Loading... |
1159 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1157 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
1160 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1158 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
1161 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", | 1159 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", |
1162 base::StringValue("kiosk_enable")); | 1160 base::StringValue("kiosk_enable")); |
1163 | 1161 |
1164 // Wait for the kiosk_enable screen to show and cancel the screen. | 1162 // Wait for the kiosk_enable screen to show and cancel the screen. |
1165 content::WindowedNotificationObserver( | 1163 content::WindowedNotificationObserver( |
1166 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1164 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
1167 content::NotificationService::AllSources()).Wait(); | 1165 content::NotificationService::AllSources()).Wait(); |
1168 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1166 GetLoginUI()->CallJavascriptFunctionUnsafe( |
1169 "login.KioskEnableScreen.enableKioskForTesting", | 1167 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false)); |
1170 base::FundamentalValue(false)); | |
1171 | 1168 |
1172 // Wait for the kiosk_enable screen to disappear. | 1169 // Wait for the kiosk_enable screen to disappear. |
1173 content::WindowedNotificationObserver( | 1170 content::WindowedNotificationObserver( |
1174 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 1171 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
1175 content::NotificationService::AllSources()).Wait(); | 1172 content::NotificationService::AllSources()).Wait(); |
1176 | 1173 |
1177 // Check that the status still says configurable. | 1174 // Check that the status still says configurable. |
1178 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 1175 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
1179 GetConsumerKioskModeStatus()); | 1176 GetConsumerKioskModeStatus()); |
1180 } | 1177 } |
(...skipping 13 matching lines...) Expand all Loading... |
1194 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1191 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
1195 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1192 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
1196 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", | 1193 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", |
1197 base::StringValue("kiosk_enable")); | 1194 base::StringValue("kiosk_enable")); |
1198 | 1195 |
1199 // Wait for the kiosk_enable screen to show and cancel the screen. | 1196 // Wait for the kiosk_enable screen to show and cancel the screen. |
1200 content::WindowedNotificationObserver( | 1197 content::WindowedNotificationObserver( |
1201 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1198 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
1202 content::NotificationService::AllSources()).Wait(); | 1199 content::NotificationService::AllSources()).Wait(); |
1203 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1200 GetLoginUI()->CallJavascriptFunctionUnsafe( |
1204 "login.KioskEnableScreen.enableKioskForTesting", | 1201 "login.KioskEnableScreen.enableKioskForTesting", base::Value(true)); |
1205 base::FundamentalValue(true)); | |
1206 | 1202 |
1207 // Wait for the signal that indicates Kiosk Mode is enabled. | 1203 // Wait for the signal that indicates Kiosk Mode is enabled. |
1208 content::WindowedNotificationObserver( | 1204 content::WindowedNotificationObserver( |
1209 chrome::NOTIFICATION_KIOSK_ENABLED, | 1205 chrome::NOTIFICATION_KIOSK_ENABLED, |
1210 content::NotificationService::AllSources()).Wait(); | 1206 content::NotificationService::AllSources()).Wait(); |
1211 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, | 1207 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, |
1212 GetConsumerKioskModeStatus()); | 1208 GetConsumerKioskModeStatus()); |
1213 } | 1209 } |
1214 | 1210 |
1215 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { | 1211 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { |
(...skipping 10 matching lines...) Expand all Loading... |
1226 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1222 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
1227 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1223 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
1228 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", | 1224 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", |
1229 base::StringValue("kiosk_enable")); | 1225 base::StringValue("kiosk_enable")); |
1230 | 1226 |
1231 // Wait for the kiosk_enable screen to show and cancel the screen. | 1227 // Wait for the kiosk_enable screen to show and cancel the screen. |
1232 content::WindowedNotificationObserver( | 1228 content::WindowedNotificationObserver( |
1233 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1229 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
1234 content::NotificationService::AllSources()).Wait(); | 1230 content::NotificationService::AllSources()).Wait(); |
1235 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1231 GetLoginUI()->CallJavascriptFunctionUnsafe( |
1236 "login.KioskEnableScreen.enableKioskForTesting", | 1232 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false)); |
1237 base::FundamentalValue(false)); | |
1238 | 1233 |
1239 // Wait for the kiosk_enable screen to disappear. | 1234 // Wait for the kiosk_enable screen to disappear. |
1240 content::WindowedNotificationObserver( | 1235 content::WindowedNotificationObserver( |
1241 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 1236 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
1242 content::NotificationService::AllSources()).Wait(); | 1237 content::NotificationService::AllSources()).Wait(); |
1243 | 1238 |
1244 // Show signin screen again. | 1239 // Show signin screen again. |
1245 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext()); | 1240 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext()); |
1246 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1241 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
1247 | 1242 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 chromeos::WizardController* wizard_controller = | 1284 chromeos::WizardController* wizard_controller = |
1290 chromeos::WizardController::default_controller(); | 1285 chromeos::WizardController::default_controller(); |
1291 ASSERT_TRUE(wizard_controller); | 1286 ASSERT_TRUE(wizard_controller); |
1292 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); | 1287 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); |
1293 ReloadAutolaunchKioskApps(); | 1288 ReloadAutolaunchKioskApps(); |
1294 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1289 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
1295 content::WindowedNotificationObserver( | 1290 content::WindowedNotificationObserver( |
1296 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1291 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1297 content::NotificationService::AllSources()).Wait(); | 1292 content::NotificationService::AllSources()).Wait(); |
1298 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1293 GetLoginUI()->CallJavascriptFunctionUnsafe( |
1299 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1294 "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); |
1300 base::FundamentalValue(true)); | |
1301 | 1295 |
1302 // Make cros settings untrusted. | 1296 // Make cros settings untrusted. |
1303 settings_helper_.SetTrustedStatus( | 1297 settings_helper_.SetTrustedStatus( |
1304 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); | 1298 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); |
1305 | 1299 |
1306 // Check that the attempt to auto-launch a kiosk app fails with an error. | 1300 // Check that the attempt to auto-launch a kiosk app fails with an error. |
1307 OobeScreenWaiter(OobeScreen::SCREEN_ERROR_MESSAGE).Wait(); | 1301 OobeScreenWaiter(OobeScreen::SCREEN_ERROR_MESSAGE).Wait(); |
1308 } | 1302 } |
1309 | 1303 |
1310 // Verifies available volumes for kiosk apps in kiosk session. | 1304 // Verifies available volumes for kiosk apps in kiosk session. |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2402 content::WindowedNotificationObserver( | 2396 content::WindowedNotificationObserver( |
2403 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2397 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
2404 content::NotificationService::AllSources()).Wait(); | 2398 content::NotificationService::AllSources()).Wait(); |
2405 | 2399 |
2406 // Wait for the wallpaper to load. | 2400 // Wait for the wallpaper to load. |
2407 WaitForWallpaper(); | 2401 WaitForWallpaper(); |
2408 EXPECT_TRUE(wallpaper_loaded()); | 2402 EXPECT_TRUE(wallpaper_loaded()); |
2409 } | 2403 } |
2410 | 2404 |
2411 } // namespace chromeos | 2405 } // namespace chromeos |
OLD | NEW |