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

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

Issue 1610823003: Migrate call sites LoginDisplayHostImpl::default_host to LoginDisplayHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-add-supervised-user
Patch Set: Created 4 years, 11 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 <vector> 5 #include <vector>
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/desktop_background/desktop_background_controller_observer.h" 8 #include "ash/desktop_background/desktop_background_controller_observer.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 672
673 // App should appear with its window. 673 // App should appear with its window.
674 extensions::AppWindowRegistry* app_window_registry = 674 extensions::AppWindowRegistry* app_window_registry =
675 extensions::AppWindowRegistry::Get(app_profile); 675 extensions::AppWindowRegistry::Get(app_profile);
676 extensions::AppWindow* window = 676 extensions::AppWindow* window =
677 AppWindowWaiter(app_window_registry, test_app_id_).Wait(); 677 AppWindowWaiter(app_window_registry, test_app_id_).Wait();
678 EXPECT_TRUE(window); 678 EXPECT_TRUE(window);
679 679
680 // Login screen should be gone or fading out. 680 // Login screen should be gone or fading out.
681 chromeos::LoginDisplayHost* login_display_host = 681 chromeos::LoginDisplayHost* login_display_host =
682 chromeos::LoginDisplayHostImpl::default_host(); 682 chromeos::LoginDisplayHost::default_host();
683 EXPECT_TRUE( 683 EXPECT_TRUE(
684 login_display_host == NULL || 684 login_display_host == NULL ||
685 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == 685 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() ==
686 0.0f); 686 0.0f);
687 687
688 // Terminate the app. 688 // Terminate the app.
689 if (terminate_app) 689 if (terminate_app)
690 window->GetBaseWindow()->Close(); 690 window->GetBaseWindow()->Close();
691 691
692 // Wait until the app terminates if it is still running. 692 // Wait until the app terminates if it is still running.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 // Start app launch and wait for network connectivity timeout. 759 // Start app launch and wait for network connectivity timeout.
760 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); 760 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure());
761 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); 761 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH);
762 splash_waiter.Wait(); 762 splash_waiter.Wait();
763 WaitForAppLaunchNetworkTimeout(); 763 WaitForAppLaunchNetworkTimeout();
764 764
765 // Configure network link should be visible. 765 // Configure network link should be visible.
766 JsExpect("$('splash-config-network').hidden == false"); 766 JsExpect("$('splash-config-network').hidden == false");
767 767
768 // Set up fake user manager with an owner for the test. 768 // Set up fake user manager with an owner for the test.
769 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()) 769 LoginDisplayHost::default_host()->GetOobeUI()->ShowOobeUI(false);
770 ->GetOobeUI()->ShowOobeUI(false);
771 770
772 // Configure network should bring up lock screen for owner. 771 // Configure network should bring up lock screen for owner.
773 OobeScreenWaiter lock_screen_waiter(OobeDisplay::SCREEN_ACCOUNT_PICKER); 772 OobeScreenWaiter lock_screen_waiter(OobeDisplay::SCREEN_ACCOUNT_PICKER);
774 static_cast<AppLaunchSplashScreenActor::Delegate*>(GetAppLaunchController()) 773 static_cast<AppLaunchSplashScreenActor::Delegate*>(GetAppLaunchController())
775 ->OnConfigureNetwork(); 774 ->OnConfigureNetwork();
776 lock_screen_waiter.Wait(); 775 lock_screen_waiter.Wait();
777 776
778 // There should be only one owner pod on this screen. 777 // There should be only one owner pod on this screen.
779 JsExpect("$('pod-row').alwaysFocusSinglePod"); 778 JsExpect("$('pod-row').alwaysFocusSinglePod");
780 779
781 // A network error screen should be shown after authenticating. 780 // A network error screen should be shown after authenticating.
782 OobeScreenWaiter error_screen_waiter(OobeDisplay::SCREEN_ERROR_MESSAGE); 781 OobeScreenWaiter error_screen_waiter(OobeDisplay::SCREEN_ERROR_MESSAGE);
783 static_cast<AppLaunchSigninScreen::Delegate*>(GetAppLaunchController()) 782 static_cast<AppLaunchSigninScreen::Delegate*>(GetAppLaunchController())
784 ->OnOwnerSigninSuccess(); 783 ->OnOwnerSigninSuccess();
785 error_screen_waiter.Wait(); 784 error_screen_waiter.Wait();
786 785
787 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog()); 786 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog());
788 787
789 SimulateNetworkOnline(); 788 SimulateNetworkOnline();
790 WaitForAppLaunchSuccess(); 789 WaitForAppLaunchSuccess();
791 } 790 }
792 791
793 AppLaunchController* GetAppLaunchController() { 792 AppLaunchController* GetAppLaunchController() {
794 return chromeos::LoginDisplayHostImpl::default_host() 793 return chromeos::LoginDisplayHost::default_host()->GetAppLaunchController();
achuithb 2016/01/21 23:14:31 Drop chromeos:: here and below
jdufault 2016/01/22 21:14:11 Done.
795 ->GetAppLaunchController();
796 } 794 }
797 795
798 // Returns a lock that is holding a task on the FILE thread. Any tasks posted 796 // Returns a lock that is holding a task on the FILE thread. Any tasks posted
799 // to the FILE thread after this call will be blocked until the returned 797 // to the FILE thread after this call will be blocked until the returned
800 // lock is released. 798 // lock is released.
801 // This can be used to prevent app installation from completing until some 799 // This can be used to prevent app installation from completing until some
802 // other conditions are checked and triggered. For example, this can be used 800 // other conditions are checked and triggered. For example, this can be used
803 // to trigger the network screen during app launch without racing with the 801 // to trigger the network screen during app launch without racing with the
804 // app launching process itself. 802 // app launching process itself.
805 scoped_ptr<base::AutoLock> LockFileThread() { 803 scoped_ptr<base::AutoLock> LockFileThread() {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 GetLoginUI()->CallJavascriptFunction( 1228 GetLoginUI()->CallJavascriptFunction(
1231 "login.KioskEnableScreen.enableKioskForTesting", 1229 "login.KioskEnableScreen.enableKioskForTesting",
1232 base::FundamentalValue(false)); 1230 base::FundamentalValue(false));
1233 1231
1234 // Wait for the kiosk_enable screen to disappear. 1232 // Wait for the kiosk_enable screen to disappear.
1235 content::WindowedNotificationObserver( 1233 content::WindowedNotificationObserver(
1236 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, 1234 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED,
1237 content::NotificationService::AllSources()).Wait(); 1235 content::NotificationService::AllSources()).Wait();
1238 1236
1239 // Show signin screen again. 1237 // Show signin screen again.
1240 chromeos::LoginDisplayHostImpl::default_host()->StartSignInScreen( 1238 chromeos::LoginDisplayHost::default_host()->StartSignInScreen(
1241 LoginScreenContext()); 1239 LoginScreenContext());
1242 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait(); 1240 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait();
1243 1241
1244 // Show kiosk enable screen again. 1242 // Show kiosk enable screen again.
1245 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", 1243 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator",
1246 base::StringValue("kiosk_enable")); 1244 base::StringValue("kiosk_enable"));
1247 1245
1248 // And it should show up. 1246 // And it should show up.
1249 content::WindowedNotificationObserver( 1247 content::WindowedNotificationObserver(
1250 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 1248 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 PrepareAppLaunch(); 1318 PrepareAppLaunch();
1321 SimulateNetworkOnline(); 1319 SimulateNetworkOnline();
1322 1320
1323 // Make cros settings untrusted. 1321 // Make cros settings untrusted.
1324 settings_helper_.SetTrustedStatus( 1322 settings_helper_.SetTrustedStatus(
1325 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); 1323 CrosSettingsProvider::PERMANENTLY_UNTRUSTED);
1326 1324
1327 // Trigger the code that handles auto-launch on enterprise devices. This would 1325 // Trigger the code that handles auto-launch on enterprise devices. This would
1328 // normally be called from ShowLoginWizard(), which runs so early that it is 1326 // normally be called from ShowLoginWizard(), which runs so early that it is
1329 // not possible to inject an auto-launch policy before it runs. 1327 // not possible to inject an auto-launch policy before it runs.
1330 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); 1328 LoginDisplayHost* login_display_host = LoginDisplayHost::default_host();
1331 ASSERT_TRUE(login_display_host); 1329 ASSERT_TRUE(login_display_host);
1332 login_display_host->StartAppLaunch(test_app_id(), false, true); 1330 login_display_host->StartAppLaunch(test_app_id(), false, true);
1333 1331
1334 // Check that no launch has started. 1332 // Check that no launch has started.
1335 EXPECT_FALSE(login_display_host->GetAppLaunchController()); 1333 EXPECT_FALSE(login_display_host->GetAppLaunchController());
1336 } 1334 }
1337 1335
1338 class KioskUpdateTest : public KioskTest { 1336 class KioskUpdateTest : public KioskTest {
1339 public: 1337 public:
1340 KioskUpdateTest() {} 1338 KioskUpdateTest() {}
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 content::WindowedNotificationObserver( 2313 content::WindowedNotificationObserver(
2316 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 2314 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
2317 content::NotificationService::AllSources()).Wait(); 2315 content::NotificationService::AllSources()).Wait();
2318 2316
2319 // Wait for the wallpaper to load. 2317 // Wait for the wallpaper to load.
2320 WaitForWallpaper(); 2318 WaitForWallpaper();
2321 EXPECT_TRUE(wallpaper_loaded()); 2319 EXPECT_TRUE(wallpaper_loaded());
2322 } 2320 }
2323 2321
2324 } // namespace chromeos 2322 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698