Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: chrome/browser/chromeos/login/kiosk_browsertest.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::Value(diagnostic_mode)); 554 base::Value(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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 // Start app launch and wait for network connectivity timeout. 948 // Start app launch and wait for network connectivity timeout.
949 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); 949 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure());
950 OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); 950 OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH);
951 splash_waiter.Wait(); 951 splash_waiter.Wait();
952 952
953 // A network error screen should be shown after authenticating. 953 // A network error screen should be shown after authenticating.
954 OobeScreenWaiter error_screen_waiter(OobeScreen::SCREEN_ERROR_MESSAGE); 954 OobeScreenWaiter error_screen_waiter(OobeScreen::SCREEN_ERROR_MESSAGE);
955 // Simulate Ctrl+Alt+N accelerator. 955 // Simulate Ctrl+Alt+N accelerator.
956 GetLoginUI()->CallJavascriptFunctionUnsafe( 956 GetLoginUI()->CallJavascriptFunctionUnsafe(
957 "cr.ui.Oobe.handleAccelerator", 957 "cr.ui.Oobe.handleAccelerator", base::Value("app_launch_network_config"));
958 base::StringValue("app_launch_network_config"));
959 error_screen_waiter.Wait(); 958 error_screen_waiter.Wait();
960 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog()); 959 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog());
961 960
962 // Continue button should be visible since we are online. 961 // Continue button should be visible since we are online.
963 JsExpect("$('continue-network-config-btn').hidden == false"); 962 JsExpect("$('continue-network-config-btn').hidden == false");
964 963
965 // Click on [Continue] button. 964 // Click on [Continue] button.
966 ASSERT_TRUE(content::ExecuteScript( 965 ASSERT_TRUE(content::ExecuteScript(
967 GetLoginUI()->GetWebContents(), 966 GetLoginUI()->GetWebContents(),
968 "(function() {" 967 "(function() {"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 set_test_app_version(""); 1018 set_test_app_version("");
1020 OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); 1019 OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH);
1021 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); 1020 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure());
1022 splash_waiter.Wait(); 1021 splash_waiter.Wait();
1023 1022
1024 settings_helper_.SetBoolean( 1023 settings_helper_.SetBoolean(
1025 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, true); 1024 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, true);
1026 content::WindowedNotificationObserver signal( 1025 content::WindowedNotificationObserver signal(
1027 chrome::NOTIFICATION_APP_TERMINATING, 1026 chrome::NOTIFICATION_APP_TERMINATING,
1028 content::NotificationService::AllSources()); 1027 content::NotificationService::AllSources());
1029 GetLoginUI()->CallJavascriptFunctionUnsafe( 1028 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator",
1030 "cr.ui.Oobe.handleAccelerator", base::StringValue("app_launch_bailout")); 1029 base::Value("app_launch_bailout"));
1031 signal.Wait(); 1030 signal.Wait();
1032 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, 1031 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL,
1033 chromeos::KioskAppLaunchError::Get()); 1032 chromeos::KioskAppLaunchError::Get());
1034 } 1033 }
1035 1034
1036 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { 1035 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) {
1037 PrepareAppLaunch(); 1036 PrepareAppLaunch();
1038 SimulateNetworkOnline(); 1037 SimulateNetworkOnline();
1039 1038
1040 LaunchApp(kTestKioskApp, true); 1039 LaunchApp(kTestKioskApp, true);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 CHECK(wizard_controller); 1135 CHECK(wizard_controller);
1137 1136
1138 // Check Kiosk mode status. 1137 // Check Kiosk mode status.
1139 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, 1138 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE,
1140 GetConsumerKioskModeStatus()); 1139 GetConsumerKioskModeStatus());
1141 1140
1142 // Wait for the login UI to come up and switch to the kiosk_enable screen. 1141 // Wait for the login UI to come up and switch to the kiosk_enable screen.
1143 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); 1142 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
1144 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); 1143 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait();
1145 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", 1144 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator",
1146 base::StringValue("kiosk_enable")); 1145 base::Value("kiosk_enable"));
1147 1146
1148 // Wait for the kiosk_enable screen to show and cancel the screen. 1147 // Wait for the kiosk_enable screen to show and cancel the screen.
1149 content::WindowedNotificationObserver( 1148 content::WindowedNotificationObserver(
1150 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 1149 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
1151 content::NotificationService::AllSources()).Wait(); 1150 content::NotificationService::AllSources()).Wait();
1152 GetLoginUI()->CallJavascriptFunctionUnsafe( 1151 GetLoginUI()->CallJavascriptFunctionUnsafe(
1153 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false)); 1152 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false));
1154 1153
1155 // Wait for the kiosk_enable screen to disappear. 1154 // Wait for the kiosk_enable screen to disappear.
1156 content::WindowedNotificationObserver( 1155 content::WindowedNotificationObserver(
(...skipping 13 matching lines...) Expand all
1170 CHECK(wizard_controller); 1169 CHECK(wizard_controller);
1171 1170
1172 // Check Kiosk mode status. 1171 // Check Kiosk mode status.
1173 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, 1172 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE,
1174 GetConsumerKioskModeStatus()); 1173 GetConsumerKioskModeStatus());
1175 1174
1176 // Wait for the login UI to come up and switch to the kiosk_enable screen. 1175 // Wait for the login UI to come up and switch to the kiosk_enable screen.
1177 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); 1176 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
1178 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); 1177 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait();
1179 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", 1178 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator",
1180 base::StringValue("kiosk_enable")); 1179 base::Value("kiosk_enable"));
1181 1180
1182 // Wait for the kiosk_enable screen to show and cancel the screen. 1181 // Wait for the kiosk_enable screen to show and cancel the screen.
1183 content::WindowedNotificationObserver( 1182 content::WindowedNotificationObserver(
1184 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 1183 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
1185 content::NotificationService::AllSources()).Wait(); 1184 content::NotificationService::AllSources()).Wait();
1186 GetLoginUI()->CallJavascriptFunctionUnsafe( 1185 GetLoginUI()->CallJavascriptFunctionUnsafe(
1187 "login.KioskEnableScreen.enableKioskForTesting", base::Value(true)); 1186 "login.KioskEnableScreen.enableKioskForTesting", base::Value(true));
1188 1187
1189 // Wait for the signal that indicates Kiosk Mode is enabled. 1188 // Wait for the signal that indicates Kiosk Mode is enabled.
1190 content::WindowedNotificationObserver( 1189 content::WindowedNotificationObserver(
(...skipping 10 matching lines...) Expand all
1201 CHECK(wizard_controller); 1200 CHECK(wizard_controller);
1202 1201
1203 // Check Kiosk mode status. 1202 // Check Kiosk mode status.
1204 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, 1203 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE,
1205 GetConsumerKioskModeStatus()); 1204 GetConsumerKioskModeStatus());
1206 1205
1207 // Wait for the login UI to come up and switch to the kiosk_enable screen. 1206 // Wait for the login UI to come up and switch to the kiosk_enable screen.
1208 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); 1207 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
1209 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); 1208 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait();
1210 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", 1209 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator",
1211 base::StringValue("kiosk_enable")); 1210 base::Value("kiosk_enable"));
1212 1211
1213 // Wait for the kiosk_enable screen to show and cancel the screen. 1212 // Wait for the kiosk_enable screen to show and cancel the screen.
1214 content::WindowedNotificationObserver( 1213 content::WindowedNotificationObserver(
1215 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 1214 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
1216 content::NotificationService::AllSources()).Wait(); 1215 content::NotificationService::AllSources()).Wait();
1217 GetLoginUI()->CallJavascriptFunctionUnsafe( 1216 GetLoginUI()->CallJavascriptFunctionUnsafe(
1218 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false)); 1217 "login.KioskEnableScreen.enableKioskForTesting", base::Value(false));
1219 1218
1220 // Wait for the kiosk_enable screen to disappear. 1219 // Wait for the kiosk_enable screen to disappear.
1221 content::WindowedNotificationObserver( 1220 content::WindowedNotificationObserver(
1222 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, 1221 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED,
1223 content::NotificationService::AllSources()).Wait(); 1222 content::NotificationService::AllSources()).Wait();
1224 1223
1225 // Show signin screen again. 1224 // Show signin screen again.
1226 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext()); 1225 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext());
1227 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait(); 1226 OobeScreenWaiter(OobeScreen::SCREEN_GAIA_SIGNIN).Wait();
1228 1227
1229 // Show kiosk enable screen again. 1228 // Show kiosk enable screen again.
1230 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator", 1229 GetLoginUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.handleAccelerator",
1231 base::StringValue("kiosk_enable")); 1230 base::Value("kiosk_enable"));
1232 1231
1233 // And it should show up. 1232 // And it should show up.
1234 content::WindowedNotificationObserver( 1233 content::WindowedNotificationObserver(
1235 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 1234 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
1236 content::NotificationService::AllSources()).Wait(); 1235 content::NotificationService::AllSources()).Wait();
1237 } 1236 }
1238 1237
1239 IN_PROC_BROWSER_TEST_F(KioskTest, DoNotLaunchWhenUntrusted) { 1238 IN_PROC_BROWSER_TEST_F(KioskTest, DoNotLaunchWhenUntrusted) {
1240 PrepareAppLaunch(); 1239 PrepareAppLaunch();
1241 SimulateNetworkOnline(); 1240 SimulateNetworkOnline();
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 content::WindowedNotificationObserver( 2385 content::WindowedNotificationObserver(
2387 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 2386 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
2388 content::NotificationService::AllSources()).Wait(); 2387 content::NotificationService::AllSources()).Wait();
2389 2388
2390 // Wait for the wallpaper to load. 2389 // Wait for the wallpaper to load.
2391 WaitForWallpaper(); 2390 WaitForWallpaper();
2392 EXPECT_TRUE(wallpaper_loaded()); 2391 EXPECT_TRUE(wallpaper_loaded());
2393 } 2392 }
2394 2393
2395 } // namespace chromeos 2394 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | chrome/browser/chromeos/login/login_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698