| 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" |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 login_contents, | 658 login_contents, |
| 659 "(function() {" | 659 "(function() {" |
| 660 "var e = new Event('click');" + | 660 "var e = new Event('click');" + |
| 661 diagnosticMode + "." | 661 diagnosticMode + "." |
| 662 "okButton_.dispatchEvent(e);" | 662 "okButton_.dispatchEvent(e);" |
| 663 "})();")); | 663 "})();")); |
| 664 | 664 |
| 665 WaitForAppLaunchSuccess(); | 665 WaitForAppLaunchSuccess(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningCancel) { | 668 // http://crbug.com/396320 |
| 669 IN_PROC_BROWSER_TEST_F(KioskTest, DISABLED_AutolaunchWarningCancel) { |
| 669 EnableConsumerKioskMode(); | 670 EnableConsumerKioskMode(); |
| 670 // Start UI, find menu entry for this app and launch it. | 671 // Start UI, find menu entry for this app and launch it. |
| 671 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 672 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 672 chromeos::WizardController* wizard_controller = | 673 chromeos::WizardController* wizard_controller = |
| 673 chromeos::WizardController::default_controller(); | 674 chromeos::WizardController::default_controller(); |
| 674 CHECK(wizard_controller); | 675 CHECK(wizard_controller); |
| 675 ReloadAutolaunchKioskApps(); | 676 ReloadAutolaunchKioskApps(); |
| 676 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 677 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 677 | 678 |
| 678 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 679 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 679 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 680 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 680 | 681 |
| 681 // Wait for the auto launch warning come up. | 682 // Wait for the auto launch warning come up. |
| 682 content::WindowedNotificationObserver( | 683 content::WindowedNotificationObserver( |
| 683 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 684 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 684 content::NotificationService::AllSources()).Wait(); | 685 content::NotificationService::AllSources()).Wait(); |
| 685 GetLoginUI()->CallJavascriptFunction( | 686 GetLoginUI()->CallJavascriptFunction( |
| 686 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 687 "login.AutolaunchScreen.confirmAutoLaunchForTesting", |
| 687 base::FundamentalValue(false)); | 688 base::FundamentalValue(false)); |
| 688 | 689 |
| 689 // Wait for the auto launch warning to go away. | 690 // Wait for the auto launch warning to go away. |
| 690 content::WindowedNotificationObserver( | 691 content::WindowedNotificationObserver( |
| 691 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, | 692 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, |
| 692 content::NotificationService::AllSources()).Wait(); | 693 content::NotificationService::AllSources()).Wait(); |
| 693 | 694 |
| 694 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 695 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 695 } | 696 } |
| 696 | 697 |
| 697 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { | 698 // http://crbug.com/396320 |
| 699 IN_PROC_BROWSER_TEST_F(KioskTest, DISABLED_AutolaunchWarningConfirm) { |
| 698 EnableConsumerKioskMode(); | 700 EnableConsumerKioskMode(); |
| 699 // Start UI, find menu entry for this app and launch it. | 701 // Start UI, find menu entry for this app and launch it. |
| 700 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 702 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 701 chromeos::WizardController* wizard_controller = | 703 chromeos::WizardController* wizard_controller = |
| 702 chromeos::WizardController::default_controller(); | 704 chromeos::WizardController::default_controller(); |
| 703 CHECK(wizard_controller); | 705 CHECK(wizard_controller); |
| 704 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 706 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 705 | 707 |
| 706 ReloadAutolaunchKioskApps(); | 708 ReloadAutolaunchKioskApps(); |
| 707 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 709 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1021 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, | 1024 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, |
| 1023 PRE_LaunchCachedOfflineEnabledAppNoNetwork) { | 1025 PRE_LaunchCachedOfflineEnabledAppNoNetwork) { |
| 1024 PreCacheApp(kTestOfflineEnabledKioskApp, | 1026 PreCacheApp(kTestOfflineEnabledKioskApp, |
| 1025 "1.0.0", | 1027 "1.0.0", |
| 1026 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1028 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1027 } | 1029 } |
| 1028 | 1030 |
| 1031 // http://crbug.com/396334 |
| 1029 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, | 1032 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, |
| 1030 LaunchCachedOfflineEnabledAppNoNetwork) { | 1033 DISABLED_LaunchCachedOfflineEnabledAppNoNetwork) { |
| 1031 set_test_app_id(kTestOfflineEnabledKioskApp); | 1034 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1032 EXPECT_TRUE( | 1035 EXPECT_TRUE( |
| 1033 KioskAppManager::Get()->HasCachedCrx(kTestOfflineEnabledKioskApp)); | 1036 KioskAppManager::Get()->HasCachedCrx(kTestOfflineEnabledKioskApp)); |
| 1034 StartUIForAppLaunch(); | 1037 StartUIForAppLaunch(); |
| 1035 SimulateNetworkOffline(); | 1038 SimulateNetworkOffline(); |
| 1036 LaunchApp(test_app_id(), false); | 1039 LaunchApp(test_app_id(), false); |
| 1037 WaitForAppLaunchSuccess(); | 1040 WaitForAppLaunchSuccess(); |
| 1038 | 1041 |
| 1039 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1042 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1040 } | 1043 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 callback.Run(); | 1235 callback.Run(); |
| 1233 } | 1236 } |
| 1234 | 1237 |
| 1235 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; | 1238 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; |
| 1236 | 1239 |
| 1237 private: | 1240 private: |
| 1238 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); | 1241 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); |
| 1239 }; | 1242 }; |
| 1240 | 1243 |
| 1241 // Flaky: crbug.com/394032 | 1244 // Flaky: crbug.com/394032 |
| 1242 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, DISALBED_EnterpriseKioskApp) { | 1245 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, DISABLED_EnterpriseKioskApp) { |
| 1243 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1246 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1244 chromeos::WizardController* wizard_controller = | 1247 chromeos::WizardController* wizard_controller = |
| 1245 chromeos::WizardController::default_controller(); | 1248 chromeos::WizardController::default_controller(); |
| 1246 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1249 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1247 | 1250 |
| 1248 // Wait for the Kiosk App configuration to reload, then launch the app. | 1251 // Wait for the Kiosk App configuration to reload, then launch the app. |
| 1249 KioskAppManager::App app; | 1252 KioskAppManager::App app; |
| 1250 content::WindowedNotificationObserver( | 1253 content::WindowedNotificationObserver( |
| 1251 chrome::NOTIFICATION_KIOSK_APPS_LOADED, | 1254 chrome::NOTIFICATION_KIOSK_APPS_LOADED, |
| 1252 base::Bind(&KioskAppManager::GetApp, | 1255 base::Bind(&KioskAppManager::GetApp, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 if (runner_.get()) | 1338 if (runner_.get()) |
| 1336 runner_->Quit(); | 1339 runner_->Quit(); |
| 1337 } | 1340 } |
| 1338 | 1341 |
| 1339 bool wallpaper_loaded_; | 1342 bool wallpaper_loaded_; |
| 1340 scoped_refptr<content::MessageLoopRunner> runner_; | 1343 scoped_refptr<content::MessageLoopRunner> runner_; |
| 1341 | 1344 |
| 1342 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); | 1345 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); |
| 1343 }; | 1346 }; |
| 1344 | 1347 |
| 1345 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) { | 1348 // http://crbug.com/396336 |
| 1349 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, DISABLED_AutolaunchWarning) { |
| 1346 // Add a device owner. | 1350 // Add a device owner. |
| 1347 FakeUserManager* user_manager = new FakeUserManager(); | 1351 FakeUserManager* user_manager = new FakeUserManager(); |
| 1348 user_manager->AddUser(kTestOwnerEmail); | 1352 user_manager->AddUser(kTestOwnerEmail); |
| 1349 ScopedUserManagerEnabler enabler(user_manager); | 1353 ScopedUserManagerEnabler enabler(user_manager); |
| 1350 | 1354 |
| 1351 // Set kiosk app to autolaunch. | 1355 // Set kiosk app to autolaunch. |
| 1352 EnableConsumerKioskMode(); | 1356 EnableConsumerKioskMode(); |
| 1353 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1357 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1354 chromeos::WizardController* wizard_controller = | 1358 chromeos::WizardController* wizard_controller = |
| 1355 chromeos::WizardController::default_controller(); | 1359 chromeos::WizardController::default_controller(); |
| 1356 CHECK(wizard_controller); | 1360 CHECK(wizard_controller); |
| 1357 ReloadAutolaunchKioskApps(); | 1361 ReloadAutolaunchKioskApps(); |
| 1358 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1362 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1359 | 1363 |
| 1360 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1364 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 1361 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1365 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1362 | 1366 |
| 1363 // Wait for the auto launch warning come up. | 1367 // Wait for the auto launch warning come up. |
| 1364 content::WindowedNotificationObserver( | 1368 content::WindowedNotificationObserver( |
| 1365 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1369 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1366 content::NotificationService::AllSources()).Wait(); | 1370 content::NotificationService::AllSources()).Wait(); |
| 1367 | 1371 |
| 1368 // Wait for the wallpaper to load. | 1372 // Wait for the wallpaper to load. |
| 1369 WaitForWallpaper(); | 1373 WaitForWallpaper(); |
| 1370 EXPECT_TRUE(wallpaper_loaded()); | 1374 EXPECT_TRUE(wallpaper_loaded()); |
| 1371 } | 1375 } |
| 1372 | 1376 |
| 1373 } // namespace chromeos | 1377 } // namespace chromeos |
| OLD | NEW |