| 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 "apps/test/app_window_waiter.h" | 8 #include "apps/test/app_window_waiter.h" |
| 9 #include "ash/common/wallpaper/wallpaper_controller.h" | 9 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 10 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | 10 #include "ash/common/wallpaper/wallpaper_controller_observer.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 fake_cws_->Init(embedded_test_server()); | 544 fake_cws_->Init(embedded_test_server()); |
| 545 | 545 |
| 546 if (use_consumer_kiosk_mode_) | 546 if (use_consumer_kiosk_mode_) |
| 547 command_line->AppendSwitch(switches::kEnableConsumerKiosk); | 547 command_line->AppendSwitch(switches::kEnableConsumerKiosk); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { | 550 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { |
| 551 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 551 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
| 552 GetLoginUI()->CallJavascriptFunctionUnsafe( | 552 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 553 new_kiosk_ui ? kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, | 553 new_kiosk_ui ? kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, |
| 554 base::StringValue(app_id), base::FundamentalValue(diagnostic_mode)); | 554 base::StringValue(app_id), base::Value(diagnostic_mode)); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void ReloadKioskApps() { | 557 void ReloadKioskApps() { |
| 558 SetupTestAppUpdateCheck(); | 558 SetupTestAppUpdateCheck(); |
| 559 | 559 |
| 560 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. | 560 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. |
| 561 KioskAppManager::Get()->RemoveApp(test_app_id_, | 561 KioskAppManager::Get()->RemoveApp(test_app_id_, |
| 562 owner_settings_service_.get()); | 562 owner_settings_service_.get()); |
| 563 KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get()); | 563 KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get()); |
| 564 } | 564 } |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 ReloadAutolaunchKioskApps(); | 1073 ReloadAutolaunchKioskApps(); |
| 1074 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1074 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 1075 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1075 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1076 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1076 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1077 | 1077 |
| 1078 // Wait for the auto launch warning come up. | 1078 // Wait for the auto launch warning come up. |
| 1079 content::WindowedNotificationObserver( | 1079 content::WindowedNotificationObserver( |
| 1080 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1080 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1081 content::NotificationService::AllSources()).Wait(); | 1081 content::NotificationService::AllSources()).Wait(); |
| 1082 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1082 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 1083 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1083 "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(false)); |
| 1084 base::FundamentalValue(false)); | |
| 1085 | 1084 |
| 1086 // Wait for the auto launch warning to go away. | 1085 // Wait for the auto launch warning to go away. |
| 1087 content::WindowedNotificationObserver( | 1086 content::WindowedNotificationObserver( |
| 1088 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, | 1087 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, |
| 1089 content::NotificationService::AllSources()).Wait(); | 1088 content::NotificationService::AllSources()).Wait(); |
| 1090 | 1089 |
| 1091 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1090 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1092 } | 1091 } |
| 1093 | 1092 |
| 1094 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { | 1093 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1105 ReloadAutolaunchKioskApps(); | 1104 ReloadAutolaunchKioskApps(); |
| 1106 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1105 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 1107 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1106 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1108 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1107 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1109 | 1108 |
| 1110 // Wait for the auto launch warning come up. | 1109 // Wait for the auto launch warning come up. |
| 1111 content::WindowedNotificationObserver( | 1110 content::WindowedNotificationObserver( |
| 1112 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1111 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1113 content::NotificationService::AllSources()).Wait(); | 1112 content::NotificationService::AllSources()).Wait(); |
| 1114 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1113 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 1115 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1114 "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); |
| 1116 base::FundamentalValue(true)); | |
| 1117 | 1115 |
| 1118 // Wait for the auto launch warning to go away. | 1116 // Wait for the auto launch warning to go away. |
| 1119 content::WindowedNotificationObserver( | 1117 content::WindowedNotificationObserver( |
| 1120 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, | 1118 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, |
| 1121 content::NotificationService::AllSources()).Wait(); | 1119 content::NotificationService::AllSources()).Wait(); |
| 1122 | 1120 |
| 1123 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1121 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 1124 EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1122 EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1125 | 1123 |
| 1126 WaitForAppLaunchSuccess(); | 1124 WaitForAppLaunchSuccess(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1145 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1143 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1146 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1144 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
| 1147 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", | 1145 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", |
| 1148 base::StringValue("kiosk_enable")); | 1146 base::StringValue("kiosk_enable")); |
| 1149 | 1147 |
| 1150 // Wait for the kiosk_enable screen to show and cancel the screen. | 1148 // Wait for the kiosk_enable screen to show and cancel the screen. |
| 1151 content::WindowedNotificationObserver( | 1149 content::WindowedNotificationObserver( |
| 1152 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1150 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
| 1153 content::NotificationService::AllSources()).Wait(); | 1151 content::NotificationService::AllSources()).Wait(); |
| 1154 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1152 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 1155 "login.KioskEnableScreen.enableKioskForTesting", | 1153 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false)); |
| 1156 base::FundamentalValue(false)); | |
| 1157 | 1154 |
| 1158 // Wait for the kiosk_enable screen to disappear. | 1155 // Wait for the kiosk_enable screen to disappear. |
| 1159 content::WindowedNotificationObserver( | 1156 content::WindowedNotificationObserver( |
| 1160 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 1157 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
| 1161 content::NotificationService::AllSources()).Wait(); | 1158 content::NotificationService::AllSources()).Wait(); |
| 1162 | 1159 |
| 1163 // Check that the status still says configurable. | 1160 // Check that the status still says configurable. |
| 1164 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 1161 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
| 1165 GetConsumerKioskModeStatus()); | 1162 GetConsumerKioskModeStatus()); |
| 1166 } | 1163 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1180 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1177 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1181 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1178 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
| 1182 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", | 1179 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", |
| 1183 base::StringValue("kiosk_enable")); | 1180 base::StringValue("kiosk_enable")); |
| 1184 | 1181 |
| 1185 // Wait for the kiosk_enable screen to show and cancel the screen. | 1182 // Wait for the kiosk_enable screen to show and cancel the screen. |
| 1186 content::WindowedNotificationObserver( | 1183 content::WindowedNotificationObserver( |
| 1187 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1184 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
| 1188 content::NotificationService::AllSources()).Wait(); | 1185 content::NotificationService::AllSources()).Wait(); |
| 1189 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1186 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 1190 "login.KioskEnableScreen.enableKioskForTesting", | 1187 "login.KioskEnableScreen.enableKioskForTesting", base::Value(true)); |
| 1191 base::FundamentalValue(true)); | |
| 1192 | 1188 |
| 1193 // Wait for the signal that indicates Kiosk Mode is enabled. | 1189 // Wait for the signal that indicates Kiosk Mode is enabled. |
| 1194 content::WindowedNotificationObserver( | 1190 content::WindowedNotificationObserver( |
| 1195 chrome::NOTIFICATION_KIOSK_ENABLED, | 1191 chrome::NOTIFICATION_KIOSK_ENABLED, |
| 1196 content::NotificationService::AllSources()).Wait(); | 1192 content::NotificationService::AllSources()).Wait(); |
| 1197 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, | 1193 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, |
| 1198 GetConsumerKioskModeStatus()); | 1194 GetConsumerKioskModeStatus()); |
| 1199 } | 1195 } |
| 1200 | 1196 |
| 1201 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { | 1197 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1212 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1208 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1213 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1209 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
| 1214 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", | 1210 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", |
| 1215 base::StringValue("kiosk_enable")); | 1211 base::StringValue("kiosk_enable")); |
| 1216 | 1212 |
| 1217 // Wait for the kiosk_enable screen to show and cancel the screen. | 1213 // Wait for the kiosk_enable screen to show and cancel the screen. |
| 1218 content::WindowedNotificationObserver( | 1214 content::WindowedNotificationObserver( |
| 1219 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1215 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
| 1220 content::NotificationService::AllSources()).Wait(); | 1216 content::NotificationService::AllSources()).Wait(); |
| 1221 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1217 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 1222 "login.KioskEnableScreen.enableKioskForTesting", | 1218 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false)); |
| 1223 base::FundamentalValue(false)); | |
| 1224 | 1219 |
| 1225 // Wait for the kiosk_enable screen to disappear. | 1220 // Wait for the kiosk_enable screen to disappear. |
| 1226 content::WindowedNotificationObserver( | 1221 content::WindowedNotificationObserver( |
| 1227 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 1222 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
| 1228 content::NotificationService::AllSources()).Wait(); | 1223 content::NotificationService::AllSources()).Wait(); |
| 1229 | 1224 |
| 1230 // Show signin screen again. | 1225 // Show signin screen again. |
| 1231 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext()); | 1226 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext()); |
| 1232 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); | 1227 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); |
| 1233 | 1228 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 chromeos::WizardController* wizard_controller = | 1270 chromeos::WizardController* wizard_controller = |
| 1276 chromeos::WizardController::default_controller(); | 1271 chromeos::WizardController::default_controller(); |
| 1277 ASSERT_TRUE(wizard_controller); | 1272 ASSERT_TRUE(wizard_controller); |
| 1278 wizard_controller->AdvanceToScreen(OobeScreen::SCREEN_OOBE_NETWORK); | 1273 wizard_controller->AdvanceToScreen(OobeScreen::SCREEN_OOBE_NETWORK); |
| 1279 ReloadAutolaunchKioskApps(); | 1274 ReloadAutolaunchKioskApps(); |
| 1280 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1275 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1281 content::WindowedNotificationObserver( | 1276 content::WindowedNotificationObserver( |
| 1282 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1277 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1283 content::NotificationService::AllSources()).Wait(); | 1278 content::NotificationService::AllSources()).Wait(); |
| 1284 GetLoginUI()->CallJavascriptFunctionUnsafe( | 1279 GetLoginUI()->CallJavascriptFunctionUnsafe( |
| 1285 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1280 "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); |
| 1286 base::FundamentalValue(true)); | |
| 1287 | 1281 |
| 1288 // Make cros settings untrusted. | 1282 // Make cros settings untrusted. |
| 1289 settings_helper_.SetTrustedStatus( | 1283 settings_helper_.SetTrustedStatus( |
| 1290 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); | 1284 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); |
| 1291 | 1285 |
| 1292 // Check that the attempt to auto-launch a kiosk app fails with an error. | 1286 // Check that the attempt to auto-launch a kiosk app fails with an error. |
| 1293 OobeScreenWaiter(OobeScreen::SCREEN_ERROR_MESSAGE).Wait(); | 1287 OobeScreenWaiter(OobeScreen::SCREEN_ERROR_MESSAGE).Wait(); |
| 1294 } | 1288 } |
| 1295 | 1289 |
| 1296 // Verifies available volumes for kiosk apps in kiosk session. | 1290 // Verifies available volumes for kiosk apps in kiosk session. |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 content::WindowedNotificationObserver( | 2386 content::WindowedNotificationObserver( |
| 2393 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2387 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 2394 content::NotificationService::AllSources()).Wait(); | 2388 content::NotificationService::AllSources()).Wait(); |
| 2395 | 2389 |
| 2396 // Wait for the wallpaper to load. | 2390 // Wait for the wallpaper to load. |
| 2397 WaitForWallpaper(); | 2391 WaitForWallpaper(); |
| 2398 EXPECT_TRUE(wallpaper_loaded()); | 2392 EXPECT_TRUE(wallpaper_loaded()); |
| 2399 } | 2393 } |
| 2400 | 2394 |
| 2401 } // namespace chromeos | 2395 } // namespace chromeos |
| OLD | NEW |