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" | 5 #include "apps/app_window.h" |
6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/prefs/pref_service.h" |
13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
18 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 19 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
19 #include "chrome/browser/chromeos/login/app_launch_controller.h" | 20 #include "chrome/browser/chromeos/login/app_launch_controller.h" |
20 #include "chrome/browser/chromeos/login/fake_user_manager.h" | 21 #include "chrome/browser/chromeos/login/fake_user_manager.h" |
21 #include "chrome/browser/chromeos/login/mock_user_manager.h" | 22 #include "chrome/browser/chromeos/login/mock_user_manager.h" |
22 #include "chrome/browser/chromeos/login/oobe_base_test.h" | 23 #include "chrome/browser/chromeos/login/oobe_base_test.h" |
23 #include "chrome/browser/chromeos/login/startup_utils.h" | 24 #include "chrome/browser/chromeos/login/startup_utils.h" |
24 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | 25 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" |
25 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 26 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
26 #include "chrome/browser/chromeos/login/wizard_controller.h" | 27 #include "chrome/browser/chromeos/login/wizard_controller.h" |
27 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 28 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
28 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 29 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
29 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
30 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 31 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
31 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
32 #include "chrome/browser/extensions/extension_service.h" | 33 #include "chrome/browser/extensions/extension_service.h" |
33 #include "chrome/browser/extensions/extension_test_message_listener.h" | 34 #include "chrome/browser/extensions/extension_test_message_listener.h" |
34 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" | 35 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" |
35 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
36 #include "chrome/common/chrome_paths.h" | 37 #include "chrome/common/chrome_paths.h" |
37 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
39 #include "chromeos/chromeos_switches.h" | 40 #include "chromeos/chromeos_switches.h" |
40 #include "chromeos/dbus/cryptohome_client.h" | 41 #include "chromeos/dbus/cryptohome_client.h" |
| 42 #include "components/signin/core/common/signin_pref_names.h" |
41 #include "content/public/browser/notification_observer.h" | 43 #include "content/public/browser/notification_observer.h" |
42 #include "content/public/browser/notification_registrar.h" | 44 #include "content/public/browser/notification_registrar.h" |
43 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
44 #include "content/public/test/browser_test_utils.h" | 46 #include "content/public/test/browser_test_utils.h" |
45 #include "crypto/sha2.h" | 47 #include "crypto/sha2.h" |
46 #include "extensions/browser/extension_system.h" | 48 #include "extensions/browser/extension_system.h" |
47 #include "google_apis/gaia/gaia_constants.h" | 49 #include "google_apis/gaia/gaia_constants.h" |
48 #include "google_apis/gaia/gaia_switches.h" | 50 #include "google_apis/gaia/gaia_switches.h" |
49 #include "google_apis/gaia/gaia_urls.h" | 51 #include "google_apis/gaia/gaia_urls.h" |
50 #include "net/test/embedded_test_server/embedded_test_server.h" | 52 #include "net/test/embedded_test_server/embedded_test_server.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 scoped_ptr<MockUserManager> mock_user_manager_; | 535 scoped_ptr<MockUserManager> mock_user_manager_; |
534 | 536 |
535 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 537 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
536 }; | 538 }; |
537 | 539 |
538 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { | 540 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
539 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 541 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
540 WaitForAppLaunchSuccess(); | 542 WaitForAppLaunchSuccess(); |
541 } | 543 } |
542 | 544 |
| 545 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { |
| 546 // Tests that the kiosk session is not considered to be logged in with a GAIA |
| 547 // account. |
| 548 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 549 WaitForAppLaunchSuccess(); |
| 550 |
| 551 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 552 ASSERT_TRUE(app_profile); |
| 553 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( |
| 554 prefs::kGoogleServicesUsername)); |
| 555 } |
| 556 |
543 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { | 557 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { |
544 // Tests the network down case for the initial app download and launch. | 558 // Tests the network down case for the initial app download and launch. |
545 RunAppLaunchNetworkDownTest(); | 559 RunAppLaunchNetworkDownTest(); |
546 } | 560 } |
547 | 561 |
548 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDown) { | 562 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDown) { |
549 // Tests the network down case for launching an existing app that is | 563 // Tests the network down case for launching an existing app that is |
550 // installed in PRE_LaunchAppNetworkDown. | 564 // installed in PRE_LaunchAppNetworkDown. |
551 RunAppLaunchNetworkDownTest(); | 565 RunAppLaunchNetworkDownTest(); |
552 } | 566 } |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 std::string result; | 1210 std::string result; |
1197 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 1211 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
1198 window->web_contents(), | 1212 window->web_contents(), |
1199 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" | 1213 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" |
1200 " window.domAutomationController.setAutomationId(0);" | 1214 " window.domAutomationController.setAutomationId(0);" |
1201 " window.domAutomationController.send(token);" | 1215 " window.domAutomationController.send(token);" |
1202 "});", | 1216 "});", |
1203 &result)); | 1217 &result)); |
1204 EXPECT_EQ(kTestAccessToken, result); | 1218 EXPECT_EQ(kTestAccessToken, result); |
1205 | 1219 |
| 1220 // Verify that the session is not considered to be logged in with a GAIA |
| 1221 // account. |
| 1222 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 1223 ASSERT_TRUE(app_profile); |
| 1224 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( |
| 1225 prefs::kGoogleServicesUsername)); |
| 1226 |
1206 // Terminate the app. | 1227 // Terminate the app. |
1207 window->GetBaseWindow()->Close(); | 1228 window->GetBaseWindow()->Close(); |
1208 content::RunAllPendingInMessageLoop(); | 1229 content::RunAllPendingInMessageLoop(); |
1209 } | 1230 } |
1210 | 1231 |
1211 // Specialized test fixture for testing kiosk mode on the | 1232 // Specialized test fixture for testing kiosk mode on the |
1212 // hidden WebUI initialization flow for slow hardware. | 1233 // hidden WebUI initialization flow for slow hardware. |
1213 class KioskHiddenWebUITest : public KioskTest, | 1234 class KioskHiddenWebUITest : public KioskTest, |
1214 public ash::DesktopBackgroundControllerObserver { | 1235 public ash::DesktopBackgroundControllerObserver { |
1215 public: | 1236 public: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 content::WindowedNotificationObserver( | 1299 content::WindowedNotificationObserver( |
1279 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1300 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1280 content::NotificationService::AllSources()).Wait(); | 1301 content::NotificationService::AllSources()).Wait(); |
1281 | 1302 |
1282 // Wait for the wallpaper to load. | 1303 // Wait for the wallpaper to load. |
1283 WaitForWallpaper(); | 1304 WaitForWallpaper(); |
1284 EXPECT_TRUE(wallpaper_loaded()); | 1305 EXPECT_TRUE(wallpaper_loaded()); |
1285 } | 1306 } |
1286 | 1307 |
1287 } // namespace chromeos | 1308 } // namespace chromeos |
OLD | NEW |