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 <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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 EXPECT_TRUE(app); | 671 EXPECT_TRUE(app); |
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 LoginDisplayHost* login_display_host = LoginDisplayHost::default_host(); |
682 chromeos::LoginDisplayHostImpl::default_host(); | |
683 EXPECT_TRUE( | 682 EXPECT_TRUE( |
684 login_display_host == NULL || | 683 login_display_host == NULL || |
685 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == | 684 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == |
686 0.0f); | 685 0.0f); |
687 | 686 |
688 // Terminate the app. | 687 // Terminate the app. |
689 if (terminate_app) | 688 if (terminate_app) |
690 window->GetBaseWindow()->Close(); | 689 window->GetBaseWindow()->Close(); |
691 | 690 |
692 // Wait until the app terminates if it is still running. | 691 // Wait until the app terminates if it is still running. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 // Start app launch and wait for network connectivity timeout. | 758 // Start app launch and wait for network connectivity timeout. |
760 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 759 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
761 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 760 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
762 splash_waiter.Wait(); | 761 splash_waiter.Wait(); |
763 WaitForAppLaunchNetworkTimeout(); | 762 WaitForAppLaunchNetworkTimeout(); |
764 | 763 |
765 // Configure network link should be visible. | 764 // Configure network link should be visible. |
766 JsExpect("$('splash-config-network').hidden == false"); | 765 JsExpect("$('splash-config-network').hidden == false"); |
767 | 766 |
768 // Set up fake user manager with an owner for the test. | 767 // Set up fake user manager with an owner for the test. |
769 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()) | 768 LoginDisplayHost::default_host()->GetOobeUI()->ShowOobeUI(false); |
770 ->GetOobeUI()->ShowOobeUI(false); | |
771 | 769 |
772 // Configure network should bring up lock screen for owner. | 770 // Configure network should bring up lock screen for owner. |
773 OobeScreenWaiter lock_screen_waiter(OobeDisplay::SCREEN_ACCOUNT_PICKER); | 771 OobeScreenWaiter lock_screen_waiter(OobeDisplay::SCREEN_ACCOUNT_PICKER); |
774 static_cast<AppLaunchSplashScreenActor::Delegate*>(GetAppLaunchController()) | 772 static_cast<AppLaunchSplashScreenActor::Delegate*>(GetAppLaunchController()) |
775 ->OnConfigureNetwork(); | 773 ->OnConfigureNetwork(); |
776 lock_screen_waiter.Wait(); | 774 lock_screen_waiter.Wait(); |
777 | 775 |
778 // There should be only one owner pod on this screen. | 776 // There should be only one owner pod on this screen. |
779 JsExpect("$('pod-row').alwaysFocusSinglePod"); | 777 JsExpect("$('pod-row').alwaysFocusSinglePod"); |
780 | 778 |
781 // A network error screen should be shown after authenticating. | 779 // A network error screen should be shown after authenticating. |
782 OobeScreenWaiter error_screen_waiter(OobeDisplay::SCREEN_ERROR_MESSAGE); | 780 OobeScreenWaiter error_screen_waiter(OobeDisplay::SCREEN_ERROR_MESSAGE); |
783 static_cast<AppLaunchSigninScreen::Delegate*>(GetAppLaunchController()) | 781 static_cast<AppLaunchSigninScreen::Delegate*>(GetAppLaunchController()) |
784 ->OnOwnerSigninSuccess(); | 782 ->OnOwnerSigninSuccess(); |
785 error_screen_waiter.Wait(); | 783 error_screen_waiter.Wait(); |
786 | 784 |
787 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog()); | 785 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog()); |
788 | 786 |
789 SimulateNetworkOnline(); | 787 SimulateNetworkOnline(); |
790 WaitForAppLaunchSuccess(); | 788 WaitForAppLaunchSuccess(); |
791 } | 789 } |
792 | 790 |
793 AppLaunchController* GetAppLaunchController() { | 791 AppLaunchController* GetAppLaunchController() { |
794 return chromeos::LoginDisplayHostImpl::default_host() | 792 return LoginDisplayHost::default_host()->GetAppLaunchController(); |
795 ->GetAppLaunchController(); | |
796 } | 793 } |
797 | 794 |
798 // Returns a lock that is holding a task on the FILE thread. Any tasks posted | 795 // 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 | 796 // to the FILE thread after this call will be blocked until the returned |
800 // lock is released. | 797 // lock is released. |
801 // This can be used to prevent app installation from completing until some | 798 // 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 | 799 // 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 | 800 // to trigger the network screen during app launch without racing with the |
804 // app launching process itself. | 801 // app launching process itself. |
805 scoped_ptr<base::AutoLock> LockFileThread() { | 802 scoped_ptr<base::AutoLock> LockFileThread() { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 GetLoginUI()->CallJavascriptFunction( | 1227 GetLoginUI()->CallJavascriptFunction( |
1231 "login.KioskEnableScreen.enableKioskForTesting", | 1228 "login.KioskEnableScreen.enableKioskForTesting", |
1232 base::FundamentalValue(false)); | 1229 base::FundamentalValue(false)); |
1233 | 1230 |
1234 // Wait for the kiosk_enable screen to disappear. | 1231 // Wait for the kiosk_enable screen to disappear. |
1235 content::WindowedNotificationObserver( | 1232 content::WindowedNotificationObserver( |
1236 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 1233 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
1237 content::NotificationService::AllSources()).Wait(); | 1234 content::NotificationService::AllSources()).Wait(); |
1238 | 1235 |
1239 // Show signin screen again. | 1236 // Show signin screen again. |
1240 chromeos::LoginDisplayHostImpl::default_host()->StartSignInScreen( | 1237 LoginDisplayHost::default_host()->StartSignInScreen(LoginScreenContext()); |
1241 LoginScreenContext()); | |
1242 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait(); | 1238 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait(); |
1243 | 1239 |
1244 // Show kiosk enable screen again. | 1240 // Show kiosk enable screen again. |
1245 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", | 1241 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", |
1246 base::StringValue("kiosk_enable")); | 1242 base::StringValue("kiosk_enable")); |
1247 | 1243 |
1248 // And it should show up. | 1244 // And it should show up. |
1249 content::WindowedNotificationObserver( | 1245 content::WindowedNotificationObserver( |
1250 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1246 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
1251 content::NotificationService::AllSources()).Wait(); | 1247 content::NotificationService::AllSources()).Wait(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 PrepareAppLaunch(); | 1316 PrepareAppLaunch(); |
1321 SimulateNetworkOnline(); | 1317 SimulateNetworkOnline(); |
1322 | 1318 |
1323 // Make cros settings untrusted. | 1319 // Make cros settings untrusted. |
1324 settings_helper_.SetTrustedStatus( | 1320 settings_helper_.SetTrustedStatus( |
1325 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); | 1321 CrosSettingsProvider::PERMANENTLY_UNTRUSTED); |
1326 | 1322 |
1327 // Trigger the code that handles auto-launch on enterprise devices. This would | 1323 // 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 | 1324 // normally be called from ShowLoginWizard(), which runs so early that it is |
1329 // not possible to inject an auto-launch policy before it runs. | 1325 // not possible to inject an auto-launch policy before it runs. |
1330 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); | 1326 LoginDisplayHost* login_display_host = LoginDisplayHost::default_host(); |
1331 ASSERT_TRUE(login_display_host); | 1327 ASSERT_TRUE(login_display_host); |
1332 login_display_host->StartAppLaunch(test_app_id(), false, true); | 1328 login_display_host->StartAppLaunch(test_app_id(), false, true); |
1333 | 1329 |
1334 // Check that no launch has started. | 1330 // Check that no launch has started. |
1335 EXPECT_FALSE(login_display_host->GetAppLaunchController()); | 1331 EXPECT_FALSE(login_display_host->GetAppLaunchController()); |
1336 } | 1332 } |
1337 | 1333 |
1338 class KioskUpdateTest : public KioskTest { | 1334 class KioskUpdateTest : public KioskTest { |
1339 public: | 1335 public: |
1340 KioskUpdateTest() {} | 1336 KioskUpdateTest() {} |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 content::WindowedNotificationObserver( | 2311 content::WindowedNotificationObserver( |
2316 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2312 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
2317 content::NotificationService::AllSources()).Wait(); | 2313 content::NotificationService::AllSources()).Wait(); |
2318 | 2314 |
2319 // Wait for the wallpaper to load. | 2315 // Wait for the wallpaper to load. |
2320 WaitForWallpaper(); | 2316 WaitForWallpaper(); |
2321 EXPECT_TRUE(wallpaper_loaded()); | 2317 EXPECT_TRUE(wallpaper_loaded()); |
2322 } | 2318 } |
2323 | 2319 |
2324 } // namespace chromeos | 2320 } // namespace chromeos |
OLD | NEW |