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 "ash/common/wallpaper/wallpaper_controller.h" | 9 #include "ash/common/wallpaper/wallpaper_controller.h" |
9 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | 10 #include "ash/common/wallpaper/wallpaper_controller_observer.h" |
10 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
13 #include "base/location.h" | 14 #include "base/location.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
20 #include "base/sys_info.h" | 21 #include "base/sys_info.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/chromeos/app_mode/fake_cws.h" | 23 #include "chrome/browser/chromeos/app_mode/fake_cws.h" |
23 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 24 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
24 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 25 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
25 #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" | 26 #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" |
26 #include "chrome/browser/chromeos/login/app_launch_controller.h" | 27 #include "chrome/browser/chromeos/login/app_launch_controller.h" |
27 #include "chrome/browser/chromeos/login/startup_utils.h" | 28 #include "chrome/browser/chromeos/login/startup_utils.h" |
28 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | |
29 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 29 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
30 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 30 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
31 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 31 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
32 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 32 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
33 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 33 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
34 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 34 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
35 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 35 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
36 #include "chrome/browser/chromeos/login/wizard_controller.h" | 36 #include "chrome/browser/chromeos/login/wizard_controller.h" |
37 #include "chrome/browser/chromeos/ownership/fake_owner_settings_service.h" | 37 #include "chrome/browser/chromeos/ownership/fake_owner_settings_service.h" |
38 #include "chrome/browser/chromeos/policy/device_local_account.h" | 38 #include "chrome/browser/chromeos/policy/device_local_account.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 // Check if the kiosk webapp is really installed for the default profile. | 663 // Check if the kiosk webapp is really installed for the default profile. |
664 const extensions::Extension* app = | 664 const extensions::Extension* app = |
665 extensions::ExtensionSystem::Get(app_profile)-> | 665 extensions::ExtensionSystem::Get(app_profile)-> |
666 extension_service()->GetInstalledExtension(test_app_id_); | 666 extension_service()->GetInstalledExtension(test_app_id_); |
667 EXPECT_TRUE(app); | 667 EXPECT_TRUE(app); |
668 | 668 |
669 // App should appear with its window. | 669 // App should appear with its window. |
670 extensions::AppWindowRegistry* app_window_registry = | 670 extensions::AppWindowRegistry* app_window_registry = |
671 extensions::AppWindowRegistry::Get(app_profile); | 671 extensions::AppWindowRegistry::Get(app_profile); |
672 extensions::AppWindow* window = | 672 extensions::AppWindow* window = |
673 AppWindowWaiter(app_window_registry, test_app_id_).Wait(); | 673 apps::AppWindowWaiter(app_window_registry, test_app_id_).Wait(); |
674 EXPECT_TRUE(window); | 674 EXPECT_TRUE(window); |
675 | 675 |
676 // Login screen should be gone or fading out. | 676 // Login screen should be gone or fading out. |
677 LoginDisplayHost* login_display_host = LoginDisplayHost::default_host(); | 677 LoginDisplayHost* login_display_host = LoginDisplayHost::default_host(); |
678 EXPECT_TRUE( | 678 EXPECT_TRUE( |
679 login_display_host == NULL || | 679 login_display_host == NULL || |
680 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == | 680 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == |
681 0.0f); | 681 0.0f); |
682 | 682 |
683 // Terminate the app. | 683 // Terminate the app. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 app_window_loaded_listener("appWindowLoaded", false); | 853 app_window_loaded_listener("appWindowLoaded", false); |
854 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 854 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
855 app_window_loaded_listener.WaitUntilSatisfied(); | 855 app_window_loaded_listener.WaitUntilSatisfied(); |
856 | 856 |
857 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 857 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
858 ASSERT_TRUE(app_profile); | 858 ASSERT_TRUE(app_profile); |
859 | 859 |
860 extensions::AppWindowRegistry* app_window_registry = | 860 extensions::AppWindowRegistry* app_window_registry = |
861 extensions::AppWindowRegistry::Get(app_profile); | 861 extensions::AppWindowRegistry::Get(app_profile); |
862 extensions::AppWindow* window = | 862 extensions::AppWindow* window = |
863 AppWindowWaiter(app_window_registry, test_app_id()).Wait(); | 863 apps::AppWindowWaiter(app_window_registry, test_app_id()).Wait(); |
864 ASSERT_TRUE(window); | 864 ASSERT_TRUE(window); |
865 | 865 |
866 // Gets the original width of the app window. | 866 // Gets the original width of the app window. |
867 int original_width; | 867 int original_width; |
868 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 868 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
869 window->web_contents(), | 869 window->web_contents(), |
870 "window.domAutomationController.setAutomationId(0);" | 870 "window.domAutomationController.setAutomationId(0);" |
871 "window.domAutomationController.send(window.innerWidth);", | 871 "window.domAutomationController.send(window.innerWidth);", |
872 &original_width)); | 872 &original_width)); |
873 | 873 |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, | 2241 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, |
2242 content::NotificationService::AllSources()).Wait(); | 2242 content::NotificationService::AllSources()).Wait(); |
2243 | 2243 |
2244 // Check installer status. | 2244 // Check installer status. |
2245 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, | 2245 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, |
2246 chromeos::KioskAppLaunchError::Get()); | 2246 chromeos::KioskAppLaunchError::Get()); |
2247 EXPECT_EQ(extensions::Manifest::EXTERNAL_POLICY, GetInstalledAppLocation()); | 2247 EXPECT_EQ(extensions::Manifest::EXTERNAL_POLICY, GetInstalledAppLocation()); |
2248 | 2248 |
2249 // Wait for the window to appear. | 2249 // Wait for the window to appear. |
2250 extensions::AppWindow* window = | 2250 extensions::AppWindow* window = |
2251 AppWindowWaiter( | 2251 apps::AppWindowWaiter(extensions::AppWindowRegistry::Get( |
2252 extensions::AppWindowRegistry::Get( | 2252 ProfileManager::GetPrimaryUserProfile()), |
2253 ProfileManager::GetPrimaryUserProfile()), | 2253 kTestEnterpriseKioskApp) |
2254 kTestEnterpriseKioskApp).Wait(); | 2254 .Wait(); |
2255 ASSERT_TRUE(window); | 2255 ASSERT_TRUE(window); |
2256 | 2256 |
2257 // Check whether the app can retrieve an OAuth2 access token. | 2257 // Check whether the app can retrieve an OAuth2 access token. |
2258 std::string result; | 2258 std::string result; |
2259 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 2259 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
2260 window->web_contents(), | 2260 window->web_contents(), |
2261 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" | 2261 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" |
2262 " window.domAutomationController.setAutomationId(0);" | 2262 " window.domAutomationController.setAutomationId(0);" |
2263 " window.domAutomationController.send(token);" | 2263 " window.domAutomationController.send(token);" |
2264 "});", | 2264 "});", |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 content::WindowedNotificationObserver( | 2391 content::WindowedNotificationObserver( |
2392 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2392 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
2393 content::NotificationService::AllSources()).Wait(); | 2393 content::NotificationService::AllSources()).Wait(); |
2394 | 2394 |
2395 // Wait for the wallpaper to load. | 2395 // Wait for the wallpaper to load. |
2396 WaitForWallpaper(); | 2396 WaitForWallpaper(); |
2397 EXPECT_TRUE(wallpaper_loaded()); | 2397 EXPECT_TRUE(wallpaper_loaded()); |
2398 } | 2398 } |
2399 | 2399 |
2400 } // namespace chromeos | 2400 } // namespace chromeos |
OLD | NEW |