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 "apps/app_window.h" | |
6 #include "apps/app_window_registry.h" | |
7 #include "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 6 #include "ash/desktop_background/desktop_background_controller_observer.h" |
9 #include "ash/shell.h" | 7 #include "ash/shell.h" |
10 #include "base/bind.h" | 8 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
12 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
13 #include "base/location.h" | 11 #include "base/location.h" |
14 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
15 #include "base/path_service.h" | 13 #include "base/path_service.h" |
16 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
(...skipping 29 matching lines...) Expand all Loading... |
46 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
47 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
48 #include "chromeos/chromeos_switches.h" | 46 #include "chromeos/chromeos_switches.h" |
49 #include "chromeos/dbus/cryptohome_client.h" | 47 #include "chromeos/dbus/cryptohome_client.h" |
50 #include "components/signin/core/common/signin_pref_names.h" | 48 #include "components/signin/core/common/signin_pref_names.h" |
51 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
52 #include "content/public/browser/notification_observer.h" | 50 #include "content/public/browser/notification_observer.h" |
53 #include "content/public/browser/notification_registrar.h" | 51 #include "content/public/browser/notification_registrar.h" |
54 #include "content/public/browser/notification_service.h" | 52 #include "content/public/browser/notification_service.h" |
55 #include "content/public/test/browser_test_utils.h" | 53 #include "content/public/test/browser_test_utils.h" |
| 54 #include "extensions/browser/app_window/app_window.h" |
| 55 #include "extensions/browser/app_window/app_window_registry.h" |
56 #include "extensions/browser/app_window/native_app_window.h" | 56 #include "extensions/browser/app_window/native_app_window.h" |
57 #include "extensions/browser/extension_system.h" | 57 #include "extensions/browser/extension_system.h" |
58 #include "google_apis/gaia/gaia_constants.h" | 58 #include "google_apis/gaia/gaia_constants.h" |
59 #include "google_apis/gaia/gaia_switches.h" | 59 #include "google_apis/gaia/gaia_switches.h" |
60 #include "google_apis/gaia/gaia_urls.h" | 60 #include "google_apis/gaia/gaia_urls.h" |
61 #include "net/test/embedded_test_server/embedded_test_server.h" | 61 #include "net/test/embedded_test_server/embedded_test_server.h" |
62 | 62 |
63 namespace em = enterprise_management; | 63 namespace em = enterprise_management; |
64 | 64 |
65 namespace chromeos { | 65 namespace chromeos { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, | 397 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, |
398 chromeos::KioskAppLaunchError::Get()); | 398 chromeos::KioskAppLaunchError::Get()); |
399 | 399 |
400 // Check if the kiosk webapp is really installed for the default profile. | 400 // Check if the kiosk webapp is really installed for the default profile. |
401 const extensions::Extension* app = | 401 const extensions::Extension* app = |
402 extensions::ExtensionSystem::Get(app_profile)-> | 402 extensions::ExtensionSystem::Get(app_profile)-> |
403 extension_service()->GetInstalledExtension(test_app_id_); | 403 extension_service()->GetInstalledExtension(test_app_id_); |
404 EXPECT_TRUE(app); | 404 EXPECT_TRUE(app); |
405 | 405 |
406 // App should appear with its window. | 406 // App should appear with its window. |
407 apps::AppWindowRegistry* app_window_registry = | 407 extensions::AppWindowRegistry* app_window_registry = |
408 apps::AppWindowRegistry::Get(app_profile); | 408 extensions::AppWindowRegistry::Get(app_profile); |
409 apps::AppWindow* window = | 409 extensions::AppWindow* window = |
410 AppWindowWaiter(app_window_registry, test_app_id_).Wait(); | 410 AppWindowWaiter(app_window_registry, test_app_id_).Wait(); |
411 EXPECT_TRUE(window); | 411 EXPECT_TRUE(window); |
412 | 412 |
413 // Login screen should be gone or fading out. | 413 // Login screen should be gone or fading out. |
414 chromeos::LoginDisplayHost* login_display_host = | 414 chromeos::LoginDisplayHost* login_display_host = |
415 chromeos::LoginDisplayHostImpl::default_host(); | 415 chromeos::LoginDisplayHostImpl::default_host(); |
416 EXPECT_TRUE( | 416 EXPECT_TRUE( |
417 login_display_host == NULL || | 417 login_display_host == NULL || |
418 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == | 418 login_display_host->GetNativeWindow()->layer()->GetTargetOpacity() == |
419 0.0f); | 419 0.0f); |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 // Wait for the Kiosk App to launch. | 1296 // Wait for the Kiosk App to launch. |
1297 content::WindowedNotificationObserver( | 1297 content::WindowedNotificationObserver( |
1298 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, | 1298 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, |
1299 content::NotificationService::AllSources()).Wait(); | 1299 content::NotificationService::AllSources()).Wait(); |
1300 | 1300 |
1301 // Check installer status. | 1301 // Check installer status. |
1302 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, | 1302 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, |
1303 chromeos::KioskAppLaunchError::Get()); | 1303 chromeos::KioskAppLaunchError::Get()); |
1304 | 1304 |
1305 // Wait for the window to appear. | 1305 // Wait for the window to appear. |
1306 apps::AppWindow* window = | 1306 extensions::AppWindow* window = |
1307 AppWindowWaiter( | 1307 AppWindowWaiter( |
1308 apps::AppWindowRegistry::Get(ProfileManager::GetPrimaryUserProfile()), | 1308 extensions::AppWindowRegistry::Get( |
| 1309 ProfileManager::GetPrimaryUserProfile()), |
1309 kTestEnterpriseKioskApp).Wait(); | 1310 kTestEnterpriseKioskApp).Wait(); |
1310 ASSERT_TRUE(window); | 1311 ASSERT_TRUE(window); |
1311 | 1312 |
1312 // Check whether the app can retrieve an OAuth2 access token. | 1313 // Check whether the app can retrieve an OAuth2 access token. |
1313 std::string result; | 1314 std::string result; |
1314 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 1315 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
1315 window->web_contents(), | 1316 window->web_contents(), |
1316 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" | 1317 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" |
1317 " window.domAutomationController.setAutomationId(0);" | 1318 " window.domAutomationController.setAutomationId(0);" |
1318 " window.domAutomationController.send(token);" | 1319 " window.domAutomationController.send(token);" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 content::WindowedNotificationObserver( | 1406 content::WindowedNotificationObserver( |
1406 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1407 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1407 content::NotificationService::AllSources()).Wait(); | 1408 content::NotificationService::AllSources()).Wait(); |
1408 | 1409 |
1409 // Wait for the wallpaper to load. | 1410 // Wait for the wallpaper to load. |
1410 WaitForWallpaper(); | 1411 WaitForWallpaper(); |
1411 EXPECT_TRUE(wallpaper_loaded()); | 1412 EXPECT_TRUE(wallpaper_loaded()); |
1412 } | 1413 } |
1413 | 1414 |
1414 } // namespace chromeos | 1415 } // namespace chromeos |
OLD | NEW |