| 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 "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
| 6 #include "ash/desktop_background/desktop_background_controller_observer.h" | 6 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 if (trusted_status == CrosSettingsProvider::TRUSTED) | 468 if (trusted_status == CrosSettingsProvider::TRUSTED) |
| 469 return; | 469 return; |
| 470 | 470 |
| 471 DeviceSettingsService::Get()->RemoveObserver(this); | 471 DeviceSettingsService::Get()->RemoveObserver(this); |
| 472 run_loop_.Quit(); | 472 run_loop_.Quit(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 } // namespace | 475 } // namespace |
| 476 | 476 |
| 477 class KioskTest : public OobeBaseTest { | 477 // Boolean parameter is used to run this test for webview (true) and for |
| 478 // iframe (false) GAIA sign in. |
| 479 class KioskTest : public OobeBaseTest, |
| 480 public testing::WithParamInterface<bool> { |
| 478 public: | 481 public: |
| 479 KioskTest() : use_consumer_kiosk_mode_(true), | 482 KioskTest() : use_consumer_kiosk_mode_(true), |
| 480 fake_cws_(new FakeCWS) { | 483 fake_cws_(new FakeCWS) { |
| 484 set_use_webview(GetParam()); |
| 481 set_exit_when_last_browser_closes(false); | 485 set_exit_when_last_browser_closes(false); |
| 482 } | 486 } |
| 483 | 487 |
| 484 ~KioskTest() override {} | 488 ~KioskTest() override {} |
| 485 | 489 |
| 486 protected: | 490 protected: |
| 487 void SetUp() override { | 491 void SetUp() override { |
| 488 test_app_id_ = kTestKioskApp; | 492 test_app_id_ = kTestKioskApp; |
| 489 set_test_app_version("1.0.0"); | 493 set_test_app_version("1.0.0"); |
| 490 set_test_crx_file(test_app_id() + ".crx"); | 494 set_test_crx_file(test_app_id() + ".crx"); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 bool use_consumer_kiosk_mode_; | 808 bool use_consumer_kiosk_mode_; |
| 805 std::string test_app_id_; | 809 std::string test_app_id_; |
| 806 std::string test_app_version_; | 810 std::string test_app_version_; |
| 807 std::string test_crx_file_; | 811 std::string test_crx_file_; |
| 808 scoped_ptr<FakeCWS> fake_cws_; | 812 scoped_ptr<FakeCWS> fake_cws_; |
| 809 scoped_ptr<MockUserManager> mock_user_manager_; | 813 scoped_ptr<MockUserManager> mock_user_manager_; |
| 810 | 814 |
| 811 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 815 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
| 812 }; | 816 }; |
| 813 | 817 |
| 814 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { | 818 IN_PROC_BROWSER_TEST_P(KioskTest, InstallAndLaunchApp) { |
| 815 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 819 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 816 WaitForAppLaunchSuccess(); | 820 WaitForAppLaunchSuccess(); |
| 817 KioskAppManager::App app; | 821 KioskAppManager::App app; |
| 818 ASSERT_TRUE(KioskAppManager::Get()->GetApp(test_app_id(), &app)); | 822 ASSERT_TRUE(KioskAppManager::Get()->GetApp(test_app_id(), &app)); |
| 819 EXPECT_FALSE(app.was_auto_launched_with_zero_delay); | 823 EXPECT_FALSE(app.was_auto_launched_with_zero_delay); |
| 820 } | 824 } |
| 821 | 825 |
| 822 IN_PROC_BROWSER_TEST_F(KioskTest, ZoomSupport) { | 826 IN_PROC_BROWSER_TEST_P(KioskTest, ZoomSupport) { |
| 823 ExtensionTestMessageListener | 827 ExtensionTestMessageListener |
| 824 app_window_loaded_listener("appWindowLoaded", false); | 828 app_window_loaded_listener("appWindowLoaded", false); |
| 825 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 829 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 826 app_window_loaded_listener.WaitUntilSatisfied(); | 830 app_window_loaded_listener.WaitUntilSatisfied(); |
| 827 | 831 |
| 828 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 832 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 829 ASSERT_TRUE(app_profile); | 833 ASSERT_TRUE(app_profile); |
| 830 | 834 |
| 831 extensions::AppWindowRegistry* app_window_registry = | 835 extensions::AppWindowRegistry* app_window_registry = |
| 832 extensions::AppWindowRegistry::Get(app_profile); | 836 extensions::AppWindowRegistry::Get(app_profile); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 "window.domAutomationController.setAutomationId(0);" | 883 "window.domAutomationController.setAutomationId(0);" |
| 880 "window.domAutomationController.send(window.innerWidth);", | 884 "window.domAutomationController.send(window.innerWidth);", |
| 881 &width_zoomed_out)); | 885 &width_zoomed_out)); |
| 882 DCHECK_GT(width_zoomed_out, original_width); | 886 DCHECK_GT(width_zoomed_out, original_width); |
| 883 | 887 |
| 884 // Terminate the app. | 888 // Terminate the app. |
| 885 window->GetBaseWindow()->Close(); | 889 window->GetBaseWindow()->Close(); |
| 886 content::RunAllPendingInMessageLoop(); | 890 content::RunAllPendingInMessageLoop(); |
| 887 } | 891 } |
| 888 | 892 |
| 889 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { | 893 IN_PROC_BROWSER_TEST_P(KioskTest, NotSignedInWithGAIAAccount) { |
| 890 // Tests that the kiosk session is not considered to be logged in with a GAIA | 894 // Tests that the kiosk session is not considered to be logged in with a GAIA |
| 891 // account. | 895 // account. |
| 892 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 896 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 893 WaitForAppLaunchSuccess(); | 897 WaitForAppLaunchSuccess(); |
| 894 | 898 |
| 895 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 899 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 896 ASSERT_TRUE(app_profile); | 900 ASSERT_TRUE(app_profile); |
| 897 EXPECT_FALSE( | 901 EXPECT_FALSE( |
| 898 SigninManagerFactory::GetForProfile(app_profile)->IsAuthenticated()); | 902 SigninManagerFactory::GetForProfile(app_profile)->IsAuthenticated()); |
| 899 } | 903 } |
| 900 | 904 |
| 901 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { | 905 IN_PROC_BROWSER_TEST_P(KioskTest, PRE_LaunchAppNetworkDown) { |
| 902 // Tests the network down case for the initial app download and launch. | 906 // Tests the network down case for the initial app download and launch. |
| 903 RunAppLaunchNetworkDownTest(); | 907 RunAppLaunchNetworkDownTest(); |
| 904 } | 908 } |
| 905 | 909 |
| 906 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDown) { | 910 IN_PROC_BROWSER_TEST_P(KioskTest, LaunchAppNetworkDown) { |
| 907 // Tests the network down case for launching an existing app that is | 911 // Tests the network down case for launching an existing app that is |
| 908 // installed in PRE_LaunchAppNetworkDown. | 912 // installed in PRE_LaunchAppNetworkDown. |
| 909 RunAppLaunchNetworkDownTest(); | 913 RunAppLaunchNetworkDownTest(); |
| 910 } | 914 } |
| 911 | 915 |
| 912 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppWithNetworkConfigAccelerator) { | 916 IN_PROC_BROWSER_TEST_P(KioskTest, LaunchAppWithNetworkConfigAccelerator) { |
| 913 ScopedCanConfigureNetwork can_configure_network(true, false); | 917 ScopedCanConfigureNetwork can_configure_network(true, false); |
| 914 | 918 |
| 915 // Block app loading until the network screen is shown. | 919 // Block app loading until the network screen is shown. |
| 916 scoped_ptr<base::AutoLock> lock = LockFileThread(); | 920 scoped_ptr<base::AutoLock> lock = LockFileThread(); |
| 917 | 921 |
| 918 // Start app launch and wait for network connectivity timeout. | 922 // Start app launch and wait for network connectivity timeout. |
| 919 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 923 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 920 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 924 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| 921 splash_waiter.Wait(); | 925 splash_waiter.Wait(); |
| 922 | 926 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 939 "var e = new Event('click');" | 943 "var e = new Event('click');" |
| 940 "$('continue-network-config-btn').dispatchEvent(e);" | 944 "$('continue-network-config-btn').dispatchEvent(e);" |
| 941 "})();")); | 945 "})();")); |
| 942 | 946 |
| 943 // Let app launching resume. | 947 // Let app launching resume. |
| 944 lock.reset(); | 948 lock.reset(); |
| 945 | 949 |
| 946 WaitForAppLaunchSuccess(); | 950 WaitForAppLaunchSuccess(); |
| 947 } | 951 } |
| 948 | 952 |
| 949 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { | 953 IN_PROC_BROWSER_TEST_P(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { |
| 950 // Mock network could not be configured. | 954 // Mock network could not be configured. |
| 951 ScopedCanConfigureNetwork can_configure_network(false, true); | 955 ScopedCanConfigureNetwork can_configure_network(false, true); |
| 952 | 956 |
| 953 // Start app launch and wait for network connectivity timeout. | 957 // Start app launch and wait for network connectivity timeout. |
| 954 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 958 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| 955 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 959 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| 956 splash_waiter.Wait(); | 960 splash_waiter.Wait(); |
| 957 WaitForAppLaunchNetworkTimeout(); | 961 WaitForAppLaunchNetworkTimeout(); |
| 958 | 962 |
| 959 // Configure network link should not be visible. | 963 // Configure network link should not be visible. |
| 960 JsExpect("$('splash-config-network').hidden == true"); | 964 JsExpect("$('splash-config-network').hidden == true"); |
| 961 | 965 |
| 962 // Network becomes online and app launch is resumed. | 966 // Network becomes online and app launch is resumed. |
| 963 SimulateNetworkOnline(); | 967 SimulateNetworkOnline(); |
| 964 WaitForAppLaunchSuccess(); | 968 WaitForAppLaunchSuccess(); |
| 965 } | 969 } |
| 966 | 970 |
| 967 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkPortal) { | 971 IN_PROC_BROWSER_TEST_P(KioskTest, LaunchAppNetworkPortal) { |
| 968 // Mock network could be configured without the owner password. | 972 // Mock network could be configured without the owner password. |
| 969 ScopedCanConfigureNetwork can_configure_network(true, false); | 973 ScopedCanConfigureNetwork can_configure_network(true, false); |
| 970 | 974 |
| 971 // Start app launch with network portal state. | 975 // Start app launch with network portal state. |
| 972 StartAppLaunchFromLoginScreen(SimulateNetworkPortalClosure()); | 976 StartAppLaunchFromLoginScreen(SimulateNetworkPortalClosure()); |
| 973 OobeScreenWaiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH) | 977 OobeScreenWaiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH) |
| 974 .WaitNoAssertCurrentScreen(); | 978 .WaitNoAssertCurrentScreen(); |
| 975 WaitForAppLaunchNetworkTimeout(); | 979 WaitForAppLaunchNetworkTimeout(); |
| 976 | 980 |
| 977 // Network error should show up automatically since this test does not | 981 // Network error should show up automatically since this test does not |
| 978 // require owner auth to configure network. | 982 // require owner auth to configure network. |
| 979 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | 983 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
| 980 | 984 |
| 981 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog()); | 985 ASSERT_TRUE(GetAppLaunchController()->showing_network_dialog()); |
| 982 SimulateNetworkOnline(); | 986 SimulateNetworkOnline(); |
| 983 WaitForAppLaunchSuccess(); | 987 WaitForAppLaunchSuccess(); |
| 984 } | 988 } |
| 985 | 989 |
| 986 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppUserCancel) { | 990 IN_PROC_BROWSER_TEST_P(KioskTest, LaunchAppUserCancel) { |
| 987 // Make fake_cws_ return empty update response. | 991 // Make fake_cws_ return empty update response. |
| 988 set_test_app_version(""); | 992 set_test_app_version(""); |
| 989 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 993 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| 990 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 994 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| 991 splash_waiter.Wait(); | 995 splash_waiter.Wait(); |
| 992 | 996 |
| 993 CrosSettings::Get()->SetBoolean( | 997 CrosSettings::Get()->SetBoolean( |
| 994 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, true); | 998 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, true); |
| 995 content::WindowedNotificationObserver signal( | 999 content::WindowedNotificationObserver signal( |
| 996 chrome::NOTIFICATION_APP_TERMINATING, | 1000 chrome::NOTIFICATION_APP_TERMINATING, |
| 997 content::NotificationService::AllSources()); | 1001 content::NotificationService::AllSources()); |
| 998 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", | 1002 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", |
| 999 base::StringValue("app_launch_bailout")); | 1003 base::StringValue("app_launch_bailout")); |
| 1000 signal.Wait(); | 1004 signal.Wait(); |
| 1001 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, | 1005 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, |
| 1002 chromeos::KioskAppLaunchError::Get()); | 1006 chromeos::KioskAppLaunchError::Get()); |
| 1003 } | 1007 } |
| 1004 | 1008 |
| 1005 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { | 1009 IN_PROC_BROWSER_TEST_P(KioskTest, LaunchInDiagnosticMode) { |
| 1006 PrepareAppLaunch(); | 1010 PrepareAppLaunch(); |
| 1007 SimulateNetworkOnline(); | 1011 SimulateNetworkOnline(); |
| 1008 | 1012 |
| 1009 LaunchApp(kTestKioskApp, true); | 1013 LaunchApp(kTestKioskApp, true); |
| 1010 | 1014 |
| 1011 content::WebContents* login_contents = GetLoginUI()->GetWebContents(); | 1015 content::WebContents* login_contents = GetLoginUI()->GetWebContents(); |
| 1012 | 1016 |
| 1013 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 1017 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
| 1014 JsConditionWaiter(login_contents, new_kiosk_ui ? | 1018 JsConditionWaiter(login_contents, new_kiosk_ui ? |
| 1015 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait(); | 1019 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait(); |
| 1016 | 1020 |
| 1017 std::string diagnosticMode(new_kiosk_ui ? | 1021 std::string diagnosticMode(new_kiosk_ui ? |
| 1018 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI); | 1022 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI); |
| 1019 ASSERT_TRUE(content::ExecuteScript( | 1023 ASSERT_TRUE(content::ExecuteScript( |
| 1020 login_contents, | 1024 login_contents, |
| 1021 "(function() {" | 1025 "(function() {" |
| 1022 "var e = new Event('click');" + | 1026 "var e = new Event('click');" + |
| 1023 diagnosticMode + "." | 1027 diagnosticMode + "." |
| 1024 "okButton_.dispatchEvent(e);" | 1028 "okButton_.dispatchEvent(e);" |
| 1025 "})();")); | 1029 "})();")); |
| 1026 | 1030 |
| 1027 WaitForAppLaunchSuccess(); | 1031 WaitForAppLaunchSuccess(); |
| 1028 } | 1032 } |
| 1029 | 1033 |
| 1030 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningCancel) { | 1034 IN_PROC_BROWSER_TEST_P(KioskTest, AutolaunchWarningCancel) { |
| 1031 EnableConsumerKioskMode(); | 1035 EnableConsumerKioskMode(); |
| 1032 | 1036 |
| 1033 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1037 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1034 chromeos::WizardController* wizard_controller = | 1038 chromeos::WizardController* wizard_controller = |
| 1035 chromeos::WizardController::default_controller(); | 1039 chromeos::WizardController::default_controller(); |
| 1036 CHECK(wizard_controller); | 1040 CHECK(wizard_controller); |
| 1037 | 1041 |
| 1038 // Start login screen after configuring auto launch app since the warning | 1042 // Start login screen after configuring auto launch app since the warning |
| 1039 // is triggered when switching to login screen. | 1043 // is triggered when switching to login screen. |
| 1040 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); | 1044 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1052 base::FundamentalValue(false)); | 1056 base::FundamentalValue(false)); |
| 1053 | 1057 |
| 1054 // Wait for the auto launch warning to go away. | 1058 // Wait for the auto launch warning to go away. |
| 1055 content::WindowedNotificationObserver( | 1059 content::WindowedNotificationObserver( |
| 1056 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, | 1060 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, |
| 1057 content::NotificationService::AllSources()).Wait(); | 1061 content::NotificationService::AllSources()).Wait(); |
| 1058 | 1062 |
| 1059 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1063 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1060 } | 1064 } |
| 1061 | 1065 |
| 1062 IN_PROC_BROWSER_TEST_F(KioskTest, AutolaunchWarningConfirm) { | 1066 IN_PROC_BROWSER_TEST_P(KioskTest, AutolaunchWarningConfirm) { |
| 1063 EnableConsumerKioskMode(); | 1067 EnableConsumerKioskMode(); |
| 1064 | 1068 |
| 1065 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1069 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1066 chromeos::WizardController* wizard_controller = | 1070 chromeos::WizardController* wizard_controller = |
| 1067 chromeos::WizardController::default_controller(); | 1071 chromeos::WizardController::default_controller(); |
| 1068 CHECK(wizard_controller); | 1072 CHECK(wizard_controller); |
| 1069 | 1073 |
| 1070 // Start login screen after configuring auto launch app since the warning | 1074 // Start login screen after configuring auto launch app since the warning |
| 1071 // is triggered when switching to login screen. | 1075 // is triggered when switching to login screen. |
| 1072 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); | 1076 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1091 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 1095 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 1092 EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 1096 EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 1093 | 1097 |
| 1094 WaitForAppLaunchSuccess(); | 1098 WaitForAppLaunchSuccess(); |
| 1095 | 1099 |
| 1096 KioskAppManager::App app; | 1100 KioskAppManager::App app; |
| 1097 ASSERT_TRUE(KioskAppManager::Get()->GetApp(test_app_id(), &app)); | 1101 ASSERT_TRUE(KioskAppManager::Get()->GetApp(test_app_id(), &app)); |
| 1098 EXPECT_TRUE(app.was_auto_launched_with_zero_delay); | 1102 EXPECT_TRUE(app.was_auto_launched_with_zero_delay); |
| 1099 } | 1103 } |
| 1100 | 1104 |
| 1101 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableCancel) { | 1105 IN_PROC_BROWSER_TEST_P(KioskTest, KioskEnableCancel) { |
| 1102 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1106 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1103 chromeos::WizardController* wizard_controller = | 1107 chromeos::WizardController* wizard_controller = |
| 1104 chromeos::WizardController::default_controller(); | 1108 chromeos::WizardController::default_controller(); |
| 1105 CHECK(wizard_controller); | 1109 CHECK(wizard_controller); |
| 1106 | 1110 |
| 1107 // Check Kiosk mode status. | 1111 // Check Kiosk mode status. |
| 1108 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 1112 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
| 1109 GetConsumerKioskModeStatus()); | 1113 GetConsumerKioskModeStatus()); |
| 1110 | 1114 |
| 1111 // Wait for the login UI to come up and switch to the kiosk_enable screen. | 1115 // Wait for the login UI to come up and switch to the kiosk_enable screen. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1125 // Wait for the kiosk_enable screen to disappear. | 1129 // Wait for the kiosk_enable screen to disappear. |
| 1126 content::WindowedNotificationObserver( | 1130 content::WindowedNotificationObserver( |
| 1127 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 1131 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
| 1128 content::NotificationService::AllSources()).Wait(); | 1132 content::NotificationService::AllSources()).Wait(); |
| 1129 | 1133 |
| 1130 // Check that the status still says configurable. | 1134 // Check that the status still says configurable. |
| 1131 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 1135 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
| 1132 GetConsumerKioskModeStatus()); | 1136 GetConsumerKioskModeStatus()); |
| 1133 } | 1137 } |
| 1134 | 1138 |
| 1135 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableConfirmed) { | 1139 IN_PROC_BROWSER_TEST_P(KioskTest, KioskEnableConfirmed) { |
| 1136 // Start UI, find menu entry for this app and launch it. | 1140 // Start UI, find menu entry for this app and launch it. |
| 1137 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1141 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1138 chromeos::WizardController* wizard_controller = | 1142 chromeos::WizardController* wizard_controller = |
| 1139 chromeos::WizardController::default_controller(); | 1143 chromeos::WizardController::default_controller(); |
| 1140 CHECK(wizard_controller); | 1144 CHECK(wizard_controller); |
| 1141 | 1145 |
| 1142 // Check Kiosk mode status. | 1146 // Check Kiosk mode status. |
| 1143 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 1147 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
| 1144 GetConsumerKioskModeStatus()); | 1148 GetConsumerKioskModeStatus()); |
| 1145 | 1149 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1158 base::FundamentalValue(true)); | 1162 base::FundamentalValue(true)); |
| 1159 | 1163 |
| 1160 // Wait for the signal that indicates Kiosk Mode is enabled. | 1164 // Wait for the signal that indicates Kiosk Mode is enabled. |
| 1161 content::WindowedNotificationObserver( | 1165 content::WindowedNotificationObserver( |
| 1162 chrome::NOTIFICATION_KIOSK_ENABLED, | 1166 chrome::NOTIFICATION_KIOSK_ENABLED, |
| 1163 content::NotificationService::AllSources()).Wait(); | 1167 content::NotificationService::AllSources()).Wait(); |
| 1164 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, | 1168 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, |
| 1165 GetConsumerKioskModeStatus()); | 1169 GetConsumerKioskModeStatus()); |
| 1166 } | 1170 } |
| 1167 | 1171 |
| 1168 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { | 1172 IN_PROC_BROWSER_TEST_P(KioskTest, KioskEnableAfter2ndSigninScreen) { |
| 1169 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1173 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1170 chromeos::WizardController* wizard_controller = | 1174 chromeos::WizardController* wizard_controller = |
| 1171 chromeos::WizardController::default_controller(); | 1175 chromeos::WizardController::default_controller(); |
| 1172 CHECK(wizard_controller); | 1176 CHECK(wizard_controller); |
| 1173 | 1177 |
| 1174 // Check Kiosk mode status. | 1178 // Check Kiosk mode status. |
| 1175 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 1179 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
| 1176 GetConsumerKioskModeStatus()); | 1180 GetConsumerKioskModeStatus()); |
| 1177 | 1181 |
| 1178 // Wait for the login UI to come up and switch to the kiosk_enable screen. | 1182 // Wait for the login UI to come up and switch to the kiosk_enable screen. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1202 // Show kiosk enable screen again. | 1206 // Show kiosk enable screen again. |
| 1203 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", | 1207 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", |
| 1204 base::StringValue("kiosk_enable")); | 1208 base::StringValue("kiosk_enable")); |
| 1205 | 1209 |
| 1206 // And it should show up. | 1210 // And it should show up. |
| 1207 content::WindowedNotificationObserver( | 1211 content::WindowedNotificationObserver( |
| 1208 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 1212 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
| 1209 content::NotificationService::AllSources()).Wait(); | 1213 content::NotificationService::AllSources()).Wait(); |
| 1210 } | 1214 } |
| 1211 | 1215 |
| 1212 IN_PROC_BROWSER_TEST_F(KioskTest, DoNotLaunchWhenUntrusted) { | 1216 IN_PROC_BROWSER_TEST_P(KioskTest, DoNotLaunchWhenUntrusted) { |
| 1213 PrepareAppLaunch(); | 1217 PrepareAppLaunch(); |
| 1214 SimulateNetworkOnline(); | 1218 SimulateNetworkOnline(); |
| 1215 | 1219 |
| 1216 // Make cros settings untrusted. | 1220 // Make cros settings untrusted. |
| 1217 CrosSettingsPermanentlyUntrustedMaker(); | 1221 CrosSettingsPermanentlyUntrustedMaker(); |
| 1218 | 1222 |
| 1219 // Check that the attempt to start a kiosk app fails with an error. | 1223 // Check that the attempt to start a kiosk app fails with an error. |
| 1220 LaunchApp(test_app_id(), false); | 1224 LaunchApp(test_app_id(), false); |
| 1221 bool ignored = false; | 1225 bool ignored = false; |
| 1222 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 1226 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1223 GetLoginUI()->GetWebContents(), | 1227 GetLoginUI()->GetWebContents(), |
| 1224 "if (cr.ui.Oobe.getInstance().errorMessageWasShownForTesting_) {" | 1228 "if (cr.ui.Oobe.getInstance().errorMessageWasShownForTesting_) {" |
| 1225 " window.domAutomationController.send(true);" | 1229 " window.domAutomationController.send(true);" |
| 1226 "} else {" | 1230 "} else {" |
| 1227 " cr.ui.Oobe.showSignInError = function(" | 1231 " cr.ui.Oobe.showSignInError = function(" |
| 1228 " loginAttempts, message, link, helpId) {" | 1232 " loginAttempts, message, link, helpId) {" |
| 1229 " window.domAutomationController.send(true);" | 1233 " window.domAutomationController.send(true);" |
| 1230 " };" | 1234 " };" |
| 1231 "}", | 1235 "}", |
| 1232 &ignored)); | 1236 &ignored)); |
| 1233 } | 1237 } |
| 1234 | 1238 |
| 1235 // Verifies that a consumer device does not auto-launch kiosk mode when cros | 1239 // Verifies that a consumer device does not auto-launch kiosk mode when cros |
| 1236 // settings are untrusted. | 1240 // settings are untrusted. |
| 1237 IN_PROC_BROWSER_TEST_F(KioskTest, NoConsumerAutoLaunchWhenUntrusted) { | 1241 IN_PROC_BROWSER_TEST_P(KioskTest, NoConsumerAutoLaunchWhenUntrusted) { |
| 1238 EnableConsumerKioskMode(); | 1242 EnableConsumerKioskMode(); |
| 1239 | 1243 |
| 1240 // Wait for and confirm the auto-launch warning. | 1244 // Wait for and confirm the auto-launch warning. |
| 1241 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1245 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 1242 chromeos::WizardController* wizard_controller = | 1246 chromeos::WizardController* wizard_controller = |
| 1243 chromeos::WizardController::default_controller(); | 1247 chromeos::WizardController::default_controller(); |
| 1244 ASSERT_TRUE(wizard_controller); | 1248 ASSERT_TRUE(wizard_controller); |
| 1245 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); | 1249 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); |
| 1246 ReloadAutolaunchKioskApps(); | 1250 ReloadAutolaunchKioskApps(); |
| 1247 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1251 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 1248 content::WindowedNotificationObserver( | 1252 content::WindowedNotificationObserver( |
| 1249 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1253 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1250 content::NotificationService::AllSources()).Wait(); | 1254 content::NotificationService::AllSources()).Wait(); |
| 1251 GetLoginUI()->CallJavascriptFunction( | 1255 GetLoginUI()->CallJavascriptFunction( |
| 1252 "login.AutolaunchScreen.confirmAutoLaunchForTesting", | 1256 "login.AutolaunchScreen.confirmAutoLaunchForTesting", |
| 1253 base::FundamentalValue(true)); | 1257 base::FundamentalValue(true)); |
| 1254 | 1258 |
| 1255 // Make cros settings untrusted. | 1259 // Make cros settings untrusted. |
| 1256 CrosSettingsPermanentlyUntrustedMaker(); | 1260 CrosSettingsPermanentlyUntrustedMaker(); |
| 1257 | 1261 |
| 1258 // Check that the attempt to auto-launch a kiosk app fails with an error. | 1262 // Check that the attempt to auto-launch a kiosk app fails with an error. |
| 1259 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | 1263 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
| 1260 } | 1264 } |
| 1261 | 1265 |
| 1262 // Verifies available volumes for kiosk apps in kiosk session. | 1266 // Verifies available volumes for kiosk apps in kiosk session. |
| 1263 IN_PROC_BROWSER_TEST_F(KioskTest, GetVolumeList) { | 1267 IN_PROC_BROWSER_TEST_P(KioskTest, GetVolumeList) { |
| 1264 set_test_app_id(kTestGetVolumeListKioskApp); | 1268 set_test_app_id(kTestGetVolumeListKioskApp); |
| 1265 set_test_app_version("0.1"); | 1269 set_test_app_version("0.1"); |
| 1266 set_test_crx_file(test_app_id() + ".crx"); | 1270 set_test_crx_file(test_app_id() + ".crx"); |
| 1267 | 1271 |
| 1268 extensions::ResultCatcher catcher; | 1272 extensions::ResultCatcher catcher; |
| 1269 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1273 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 1270 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1274 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1271 } | 1275 } |
| 1272 | 1276 |
| 1273 // Verifies that an enterprise device does not auto-launch kiosk mode when cros | 1277 // Verifies that an enterprise device does not auto-launch kiosk mode when cros |
| 1274 // settings are untrusted. | 1278 // settings are untrusted. |
| 1275 IN_PROC_BROWSER_TEST_F(KioskTest, NoEnterpriseAutoLaunchWhenUntrusted) { | 1279 IN_PROC_BROWSER_TEST_P(KioskTest, NoEnterpriseAutoLaunchWhenUntrusted) { |
| 1276 PrepareAppLaunch(); | 1280 PrepareAppLaunch(); |
| 1277 SimulateNetworkOnline(); | 1281 SimulateNetworkOnline(); |
| 1278 | 1282 |
| 1279 // Make cros settings untrusted. | 1283 // Make cros settings untrusted. |
| 1280 CrosSettingsPermanentlyUntrustedMaker(); | 1284 CrosSettingsPermanentlyUntrustedMaker(); |
| 1281 | 1285 |
| 1282 // Trigger the code that handles auto-launch on enterprise devices. This would | 1286 // Trigger the code that handles auto-launch on enterprise devices. This would |
| 1283 // normally be called from ShowLoginWizard(), which runs so early that it is | 1287 // normally be called from ShowLoginWizard(), which runs so early that it is |
| 1284 // not possible to inject an auto-launch policy before it runs. | 1288 // not possible to inject an auto-launch policy before it runs. |
| 1285 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); | 1289 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 | 1434 |
| 1431 DISALLOW_COPY_AND_ASSIGN(KioskAppExternalUpdateWaiter); | 1435 DISALLOW_COPY_AND_ASSIGN(KioskAppExternalUpdateWaiter); |
| 1432 }; | 1436 }; |
| 1433 | 1437 |
| 1434 // Owned by DiskMountManager. | 1438 // Owned by DiskMountManager. |
| 1435 KioskFakeDiskMountManager* fake_disk_mount_manager_; | 1439 KioskFakeDiskMountManager* fake_disk_mount_manager_; |
| 1436 | 1440 |
| 1437 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); | 1441 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); |
| 1438 }; | 1442 }; |
| 1439 | 1443 |
| 1440 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_LaunchOfflineEnabledAppNoNetwork) { | 1444 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_LaunchOfflineEnabledAppNoNetwork) { |
| 1441 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1445 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1442 "1.0.0", | 1446 "1.0.0", |
| 1443 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1447 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1444 } | 1448 } |
| 1445 | 1449 |
| 1446 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { | 1450 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { |
| 1447 set_test_app_id(kTestOfflineEnabledKioskApp); | 1451 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1448 StartUIForAppLaunch(); | 1452 StartUIForAppLaunch(); |
| 1449 SimulateNetworkOffline(); | 1453 SimulateNetworkOffline(); |
| 1450 LaunchApp(test_app_id(), false); | 1454 LaunchApp(test_app_id(), false); |
| 1451 WaitForAppLaunchSuccess(); | 1455 WaitForAppLaunchSuccess(); |
| 1452 | 1456 |
| 1453 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1457 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1454 } | 1458 } |
| 1455 | 1459 |
| 1456 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, | 1460 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, |
| 1457 PRE_LaunchCachedOfflineEnabledAppNoNetwork) { | 1461 PRE_LaunchCachedOfflineEnabledAppNoNetwork) { |
| 1458 PreCacheApp(kTestOfflineEnabledKioskApp, | 1462 PreCacheApp(kTestOfflineEnabledKioskApp, |
| 1459 "1.0.0", | 1463 "1.0.0", |
| 1460 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1464 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1461 } | 1465 } |
| 1462 | 1466 |
| 1463 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, | 1467 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, |
| 1464 LaunchCachedOfflineEnabledAppNoNetwork) { | 1468 LaunchCachedOfflineEnabledAppNoNetwork) { |
| 1465 set_test_app_id(kTestOfflineEnabledKioskApp); | 1469 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1466 EXPECT_TRUE( | 1470 EXPECT_TRUE( |
| 1467 KioskAppManager::Get()->HasCachedCrx(kTestOfflineEnabledKioskApp)); | 1471 KioskAppManager::Get()->HasCachedCrx(kTestOfflineEnabledKioskApp)); |
| 1468 StartUIForAppLaunch(); | 1472 StartUIForAppLaunch(); |
| 1469 SimulateNetworkOffline(); | 1473 SimulateNetworkOffline(); |
| 1470 LaunchApp(test_app_id(), false); | 1474 LaunchApp(test_app_id(), false); |
| 1471 WaitForAppLaunchSuccess(); | 1475 WaitForAppLaunchSuccess(); |
| 1472 | 1476 |
| 1473 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1477 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1474 } | 1478 } |
| 1475 | 1479 |
| 1476 // Network offline, app v1.0 has run before, has cached v2.0 crx and v2.0 should | 1480 // Network offline, app v1.0 has run before, has cached v2.0 crx and v2.0 should |
| 1477 // be installed and launched during next launch. | 1481 // be installed and launched during next launch. |
| 1478 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, | 1482 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, |
| 1479 PRE_LaunchCachedNewVersionOfflineEnabledAppNoNetwork) { | 1483 PRE_LaunchCachedNewVersionOfflineEnabledAppNoNetwork) { |
| 1480 // Install and launch v1 app. | 1484 // Install and launch v1 app. |
| 1481 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1485 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1482 "1.0.0", | 1486 "1.0.0", |
| 1483 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1487 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1484 // Update cache for v2 app. | 1488 // Update cache for v2 app. |
| 1485 UpdateExternalCache("2.0.0", | 1489 UpdateExternalCache("2.0.0", |
| 1486 std::string(kTestOfflineEnabledKioskApp) + ".crx"); | 1490 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
| 1487 // The installed app is still in v1. | 1491 // The installed app is still in v1. |
| 1488 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1492 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1489 } | 1493 } |
| 1490 | 1494 |
| 1491 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, | 1495 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, |
| 1492 LaunchCachedNewVersionOfflineEnabledAppNoNetwork) { | 1496 LaunchCachedNewVersionOfflineEnabledAppNoNetwork) { |
| 1493 set_test_app_id(kTestOfflineEnabledKioskApp); | 1497 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1494 EXPECT_TRUE(KioskAppManager::Get()->HasCachedCrx(test_app_id())); | 1498 EXPECT_TRUE(KioskAppManager::Get()->HasCachedCrx(test_app_id())); |
| 1495 | 1499 |
| 1496 StartUIForAppLaunch(); | 1500 StartUIForAppLaunch(); |
| 1497 SimulateNetworkOffline(); | 1501 SimulateNetworkOffline(); |
| 1498 LaunchApp(test_app_id(), false); | 1502 LaunchApp(test_app_id(), false); |
| 1499 WaitForAppLaunchSuccess(); | 1503 WaitForAppLaunchSuccess(); |
| 1500 | 1504 |
| 1501 // v2 app should have been installed. | 1505 // v2 app should have been installed. |
| 1502 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1506 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1503 } | 1507 } |
| 1504 | 1508 |
| 1505 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_LaunchOfflineEnabledAppNoUpdate) { | 1509 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_LaunchOfflineEnabledAppNoUpdate) { |
| 1506 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1510 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1507 "1.0.0", | 1511 "1.0.0", |
| 1508 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1512 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1509 } | 1513 } |
| 1510 | 1514 |
| 1511 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { | 1515 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { |
| 1512 set_test_app_id(kTestOfflineEnabledKioskApp); | 1516 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1513 fake_cws()->SetNoUpdate(test_app_id()); | 1517 fake_cws()->SetNoUpdate(test_app_id()); |
| 1514 | 1518 |
| 1515 StartUIForAppLaunch(); | 1519 StartUIForAppLaunch(); |
| 1516 SimulateNetworkOnline(); | 1520 SimulateNetworkOnline(); |
| 1517 LaunchApp(test_app_id(), false); | 1521 LaunchApp(test_app_id(), false); |
| 1518 WaitForAppLaunchSuccess(); | 1522 WaitForAppLaunchSuccess(); |
| 1519 | 1523 |
| 1520 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1524 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1521 } | 1525 } |
| 1522 | 1526 |
| 1523 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_LaunchOfflineEnabledAppHasUpdate) { | 1527 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_LaunchOfflineEnabledAppHasUpdate) { |
| 1524 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1528 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1525 "1.0.0", | 1529 "1.0.0", |
| 1526 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1530 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1527 } | 1531 } |
| 1528 | 1532 |
| 1529 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { | 1533 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
| 1530 set_test_app_id(kTestOfflineEnabledKioskApp); | 1534 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1531 fake_cws()->SetUpdateCrx( | 1535 fake_cws()->SetUpdateCrx( |
| 1532 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); | 1536 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); |
| 1533 | 1537 |
| 1534 StartUIForAppLaunch(); | 1538 StartUIForAppLaunch(); |
| 1535 SimulateNetworkOnline(); | 1539 SimulateNetworkOnline(); |
| 1536 LaunchApp(test_app_id(), false); | 1540 LaunchApp(test_app_id(), false); |
| 1537 WaitForAppLaunchSuccess(); | 1541 WaitForAppLaunchSuccess(); |
| 1538 | 1542 |
| 1539 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1543 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1540 } | 1544 } |
| 1541 | 1545 |
| 1542 // Pre-cache v1 kiosk app, then launch the app without network, | 1546 // Pre-cache v1 kiosk app, then launch the app without network, |
| 1543 // plug in usb stick with a v2 app for offline updating. | 1547 // plug in usb stick with a v2 app for offline updating. |
| 1544 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_UsbStickUpdateAppNoNetwork) { | 1548 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_UsbStickUpdateAppNoNetwork) { |
| 1545 PreCacheApp(kTestOfflineEnabledKioskApp, | 1549 PreCacheApp(kTestOfflineEnabledKioskApp, |
| 1546 "1.0.0", | 1550 "1.0.0", |
| 1547 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1551 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1548 | 1552 |
| 1549 set_test_app_id(kTestOfflineEnabledKioskApp); | 1553 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1550 StartUIForAppLaunch(); | 1554 StartUIForAppLaunch(); |
| 1551 SimulateNetworkOffline(); | 1555 SimulateNetworkOffline(); |
| 1552 LaunchApp(test_app_id(), false); | 1556 LaunchApp(test_app_id(), false); |
| 1553 WaitForAppLaunchSuccess(); | 1557 WaitForAppLaunchSuccess(); |
| 1554 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1558 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1565 // until next time the device is started. | 1569 // until next time the device is started. |
| 1566 base::FilePath crx_path; | 1570 base::FilePath crx_path; |
| 1567 std::string cached_version; | 1571 std::string cached_version; |
| 1568 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( | 1572 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1569 test_app_id(), &crx_path, &cached_version)); | 1573 test_app_id(), &crx_path, &cached_version)); |
| 1570 EXPECT_EQ("2.0.0", cached_version); | 1574 EXPECT_EQ("2.0.0", cached_version); |
| 1571 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1575 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1572 } | 1576 } |
| 1573 | 1577 |
| 1574 // Restart the device, verify the app has been updated to v2. | 1578 // Restart the device, verify the app has been updated to v2. |
| 1575 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppNoNetwork) { | 1579 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, UsbStickUpdateAppNoNetwork) { |
| 1576 // Verify the kiosk app has been updated to v2. | 1580 // Verify the kiosk app has been updated to v2. |
| 1577 set_test_app_id(kTestOfflineEnabledKioskApp); | 1581 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1578 StartUIForAppLaunch(); | 1582 StartUIForAppLaunch(); |
| 1579 SimulateNetworkOffline(); | 1583 SimulateNetworkOffline(); |
| 1580 LaunchApp(test_app_id(), false); | 1584 LaunchApp(test_app_id(), false); |
| 1581 WaitForAppLaunchSuccess(); | 1585 WaitForAppLaunchSuccess(); |
| 1582 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1586 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1583 } | 1587 } |
| 1584 | 1588 |
| 1585 // Usb stick is plugged in without a manifest file on it. | 1589 // Usb stick is plugged in without a manifest file on it. |
| 1586 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppNoManifest) { | 1590 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, UsbStickUpdateAppNoManifest) { |
| 1587 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1591 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1588 "1.0.0", | 1592 "1.0.0", |
| 1589 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1593 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1590 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1594 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1591 | 1595 |
| 1592 // Simulate mounting of usb stick with v2 app on the stick. | 1596 // Simulate mounting of usb stick with v2 app on the stick. |
| 1593 bool update_success; | 1597 bool update_success; |
| 1594 bool app_update_notified; | 1598 bool app_update_notified; |
| 1595 SimulateUpdateAppFromUsbStick( | 1599 SimulateUpdateAppFromUsbStick( |
| 1596 kFakeUsbMountPathNoManifest, &app_update_notified, &update_success); | 1600 kFakeUsbMountPathNoManifest, &app_update_notified, &update_success); |
| 1597 EXPECT_FALSE(update_success); | 1601 EXPECT_FALSE(update_success); |
| 1598 | 1602 |
| 1599 // Kiosk app is not updated. | 1603 // Kiosk app is not updated. |
| 1600 base::FilePath crx_path; | 1604 base::FilePath crx_path; |
| 1601 std::string cached_version; | 1605 std::string cached_version; |
| 1602 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( | 1606 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1603 test_app_id(), &crx_path, &cached_version)); | 1607 test_app_id(), &crx_path, &cached_version)); |
| 1604 EXPECT_EQ("1.0.0", cached_version); | 1608 EXPECT_EQ("1.0.0", cached_version); |
| 1605 } | 1609 } |
| 1606 | 1610 |
| 1607 // Usb stick is plugged in with a bad manifest file on it. | 1611 // Usb stick is plugged in with a bad manifest file on it. |
| 1608 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppBadManifest) { | 1612 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, UsbStickUpdateAppBadManifest) { |
| 1609 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1613 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1610 "1.0.0", | 1614 "1.0.0", |
| 1611 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1615 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1612 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1616 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1613 | 1617 |
| 1614 // Simulate mounting of usb stick with v2 app on the stick. | 1618 // Simulate mounting of usb stick with v2 app on the stick. |
| 1615 bool update_success; | 1619 bool update_success; |
| 1616 bool app_update_notified; | 1620 bool app_update_notified; |
| 1617 SimulateUpdateAppFromUsbStick( | 1621 SimulateUpdateAppFromUsbStick( |
| 1618 kFakeUsbMountPathBadManifest, &app_update_notified, &update_success); | 1622 kFakeUsbMountPathBadManifest, &app_update_notified, &update_success); |
| 1619 EXPECT_FALSE(update_success); | 1623 EXPECT_FALSE(update_success); |
| 1620 | 1624 |
| 1621 // Kiosk app is not updated. | 1625 // Kiosk app is not updated. |
| 1622 base::FilePath crx_path; | 1626 base::FilePath crx_path; |
| 1623 std::string cached_version; | 1627 std::string cached_version; |
| 1624 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( | 1628 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1625 test_app_id(), &crx_path, &cached_version)); | 1629 test_app_id(), &crx_path, &cached_version)); |
| 1626 EXPECT_EQ("1.0.0", cached_version); | 1630 EXPECT_EQ("1.0.0", cached_version); |
| 1627 } | 1631 } |
| 1628 | 1632 |
| 1629 // Usb stick is plugged in with a lower version of crx file specified in | 1633 // Usb stick is plugged in with a lower version of crx file specified in |
| 1630 // manifest. | 1634 // manifest. |
| 1631 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppLowerAppVersion) { | 1635 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, UsbStickUpdateAppLowerAppVersion) { |
| 1632 // Precache v2 version of app. | 1636 // Precache v2 version of app. |
| 1633 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1637 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1634 "2.0.0", | 1638 "2.0.0", |
| 1635 std::string(kTestOfflineEnabledKioskApp) + ".crx"); | 1639 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
| 1636 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1640 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1637 | 1641 |
| 1638 // Simulate mounting of usb stick with v1 app on the stick. | 1642 // Simulate mounting of usb stick with v1 app on the stick. |
| 1639 bool update_success; | 1643 bool update_success; |
| 1640 bool app_update_notified; | 1644 bool app_update_notified; |
| 1641 SimulateUpdateAppFromUsbStick( | 1645 SimulateUpdateAppFromUsbStick( |
| 1642 kFakeUsbMountPathLowerAppVersion, &app_update_notified, &update_success); | 1646 kFakeUsbMountPathLowerAppVersion, &app_update_notified, &update_success); |
| 1643 EXPECT_FALSE(update_success); | 1647 EXPECT_FALSE(update_success); |
| 1644 | 1648 |
| 1645 // Kiosk app is NOT updated to the lower version. | 1649 // Kiosk app is NOT updated to the lower version. |
| 1646 base::FilePath crx_path; | 1650 base::FilePath crx_path; |
| 1647 std::string cached_version; | 1651 std::string cached_version; |
| 1648 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( | 1652 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1649 test_app_id(), &crx_path, &cached_version)); | 1653 test_app_id(), &crx_path, &cached_version)); |
| 1650 EXPECT_EQ("2.0.0", cached_version); | 1654 EXPECT_EQ("2.0.0", cached_version); |
| 1651 } | 1655 } |
| 1652 | 1656 |
| 1653 // Usb stick is plugged in with a v1 crx file, although the manifest says | 1657 // Usb stick is plugged in with a v1 crx file, although the manifest says |
| 1654 // this is a v3 version. | 1658 // this is a v3 version. |
| 1655 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppLowerCrxVersion) { | 1659 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, UsbStickUpdateAppLowerCrxVersion) { |
| 1656 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1660 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1657 "2.0.0", | 1661 "2.0.0", |
| 1658 std::string(kTestOfflineEnabledKioskApp) + ".crx"); | 1662 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
| 1659 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1663 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1660 | 1664 |
| 1661 // Simulate mounting of usb stick with v1 crx file on the stick, although | 1665 // Simulate mounting of usb stick with v1 crx file on the stick, although |
| 1662 // the manifest says it is v3 app. | 1666 // the manifest says it is v3 app. |
| 1663 bool update_success; | 1667 bool update_success; |
| 1664 bool app_update_notified; | 1668 bool app_update_notified; |
| 1665 SimulateUpdateAppFromUsbStick( | 1669 SimulateUpdateAppFromUsbStick( |
| 1666 kFakeUsbMountPathLowerCrxVersion, &app_update_notified, &update_success); | 1670 kFakeUsbMountPathLowerCrxVersion, &app_update_notified, &update_success); |
| 1667 EXPECT_FALSE(update_success); | 1671 EXPECT_FALSE(update_success); |
| 1668 | 1672 |
| 1669 // Kiosk app is NOT updated to the lower version. | 1673 // Kiosk app is NOT updated to the lower version. |
| 1670 base::FilePath crx_path; | 1674 base::FilePath crx_path; |
| 1671 std::string cached_version; | 1675 std::string cached_version; |
| 1672 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( | 1676 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1673 test_app_id(), &crx_path, &cached_version)); | 1677 test_app_id(), &crx_path, &cached_version)); |
| 1674 EXPECT_EQ("2.0.0", cached_version); | 1678 EXPECT_EQ("2.0.0", cached_version); |
| 1675 } | 1679 } |
| 1676 | 1680 |
| 1677 // Usb stick is plugged in with a bad crx file. | 1681 // Usb stick is plugged in with a bad crx file. |
| 1678 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppBadCrx) { | 1682 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, UsbStickUpdateAppBadCrx) { |
| 1679 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1683 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1680 "1.0.0", | 1684 "1.0.0", |
| 1681 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1685 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1682 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1686 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1683 | 1687 |
| 1684 // Simulate mounting of usb stick with v1 crx file on the stick, although | 1688 // Simulate mounting of usb stick with v1 crx file on the stick, although |
| 1685 // the manifest says it is v3 app. | 1689 // the manifest says it is v3 app. |
| 1686 bool update_success; | 1690 bool update_success; |
| 1687 bool app_update_notified; | 1691 bool app_update_notified; |
| 1688 SimulateUpdateAppFromUsbStick( | 1692 SimulateUpdateAppFromUsbStick( |
| 1689 kFakeUsbMountPathBadCrx, &app_update_notified, &update_success); | 1693 kFakeUsbMountPathBadCrx, &app_update_notified, &update_success); |
| 1690 EXPECT_FALSE(update_success); | 1694 EXPECT_FALSE(update_success); |
| 1691 | 1695 |
| 1692 // Kiosk app is NOT updated. | 1696 // Kiosk app is NOT updated. |
| 1693 base::FilePath crx_path; | 1697 base::FilePath crx_path; |
| 1694 std::string cached_version; | 1698 std::string cached_version; |
| 1695 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( | 1699 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1696 test_app_id(), &crx_path, &cached_version)); | 1700 test_app_id(), &crx_path, &cached_version)); |
| 1697 EXPECT_EQ("1.0.0", cached_version); | 1701 EXPECT_EQ("1.0.0", cached_version); |
| 1698 } | 1702 } |
| 1699 | 1703 |
| 1700 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PermissionChange) { | 1704 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PermissionChange) { |
| 1701 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1705 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1702 "2.0.0", | 1706 "2.0.0", |
| 1703 std::string(kTestOfflineEnabledKioskApp) + ".crx"); | 1707 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
| 1704 } | 1708 } |
| 1705 | 1709 |
| 1706 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { | 1710 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { |
| 1707 set_test_app_id(kTestOfflineEnabledKioskApp); | 1711 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1708 set_test_app_version("2.0.0"); | 1712 set_test_app_version("2.0.0"); |
| 1709 set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); | 1713 set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); |
| 1710 | 1714 |
| 1711 StartUIForAppLaunch(); | 1715 StartUIForAppLaunch(); |
| 1712 SimulateNetworkOnline(); | 1716 SimulateNetworkOnline(); |
| 1713 LaunchApp(test_app_id(), false); | 1717 LaunchApp(test_app_id(), false); |
| 1714 WaitForAppLaunchSuccess(); | 1718 WaitForAppLaunchSuccess(); |
| 1715 | 1719 |
| 1716 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1720 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1717 } | 1721 } |
| 1718 | 1722 |
| 1719 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) { | 1723 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PreserveLocalData) { |
| 1720 // Installs v1 app and writes some local data. | 1724 // Installs v1 app and writes some local data. |
| 1721 set_test_app_id(kTestLocalFsKioskApp); | 1725 set_test_app_id(kTestLocalFsKioskApp); |
| 1722 set_test_app_version("1.0.0"); | 1726 set_test_app_version("1.0.0"); |
| 1723 set_test_crx_file(test_app_id() + ".crx"); | 1727 set_test_crx_file(test_app_id() + ".crx"); |
| 1724 | 1728 |
| 1725 extensions::ResultCatcher catcher; | 1729 extensions::ResultCatcher catcher; |
| 1726 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1730 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 1727 WaitForAppLaunchWithOptions(true /* check_launch_data */, | 1731 WaitForAppLaunchWithOptions(true /* check_launch_data */, |
| 1728 false /* terminate_app */); | 1732 false /* terminate_app */); |
| 1729 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1733 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1730 } | 1734 } |
| 1731 | 1735 |
| 1732 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) { | 1736 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PreserveLocalData) { |
| 1733 // Update existing v1 app installed in PRE_PreserveLocalData to v2 | 1737 // Update existing v1 app installed in PRE_PreserveLocalData to v2 |
| 1734 // that reads and verifies the local data. | 1738 // that reads and verifies the local data. |
| 1735 set_test_app_id(kTestLocalFsKioskApp); | 1739 set_test_app_id(kTestLocalFsKioskApp); |
| 1736 set_test_app_version("2.0.0"); | 1740 set_test_app_version("2.0.0"); |
| 1737 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); | 1741 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); |
| 1738 extensions::ResultCatcher catcher; | 1742 extensions::ResultCatcher catcher; |
| 1739 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1743 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 1740 WaitForAppLaunchWithOptions(true /* check_launch_data */, | 1744 WaitForAppLaunchWithOptions(true /* check_launch_data */, |
| 1741 false /* terminate_app */); | 1745 false /* terminate_app */); |
| 1742 | 1746 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 | 1832 |
| 1829 DeviceSettingsService::Get()->Load(); | 1833 DeviceSettingsService::Get()->Load(); |
| 1830 } | 1834 } |
| 1831 | 1835 |
| 1832 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; | 1836 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; |
| 1833 | 1837 |
| 1834 private: | 1838 private: |
| 1835 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); | 1839 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); |
| 1836 }; | 1840 }; |
| 1837 | 1841 |
| 1838 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { | 1842 IN_PROC_BROWSER_TEST_P(KioskEnterpriseTest, EnterpriseKioskApp) { |
| 1839 // Prepare Fake CWS to serve app crx. | 1843 // Prepare Fake CWS to serve app crx. |
| 1840 set_test_app_id(kTestEnterpriseKioskApp); | 1844 set_test_app_id(kTestEnterpriseKioskApp); |
| 1841 set_test_app_version("1.0.0"); | 1845 set_test_app_version("1.0.0"); |
| 1842 set_test_crx_file(test_app_id() + ".crx"); | 1846 set_test_crx_file(test_app_id() + ".crx"); |
| 1843 SetupTestAppUpdateCheck(); | 1847 SetupTestAppUpdateCheck(); |
| 1844 | 1848 |
| 1845 // Configure kTestEnterpriseKioskApp in device policy. | 1849 // Configure kTestEnterpriseKioskApp in device policy. |
| 1846 ConfigureKioskAppInPolicy(kTestEnterpriseAccountId, | 1850 ConfigureKioskAppInPolicy(kTestEnterpriseAccountId, |
| 1847 kTestEnterpriseKioskApp, | 1851 kTestEnterpriseKioskApp, |
| 1848 ""); | 1852 ""); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 1887 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 1884 ASSERT_TRUE(app_profile); | 1888 ASSERT_TRUE(app_profile); |
| 1885 EXPECT_FALSE( | 1889 EXPECT_FALSE( |
| 1886 SigninManagerFactory::GetForProfile(app_profile)->IsAuthenticated()); | 1890 SigninManagerFactory::GetForProfile(app_profile)->IsAuthenticated()); |
| 1887 | 1891 |
| 1888 // Terminate the app. | 1892 // Terminate the app. |
| 1889 window->GetBaseWindow()->Close(); | 1893 window->GetBaseWindow()->Close(); |
| 1890 content::RunAllPendingInMessageLoop(); | 1894 content::RunAllPendingInMessageLoop(); |
| 1891 } | 1895 } |
| 1892 | 1896 |
| 1893 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, PrivateStore) { | 1897 IN_PROC_BROWSER_TEST_P(KioskEnterpriseTest, PrivateStore) { |
| 1894 set_test_app_id(kTestEnterpriseKioskApp); | 1898 set_test_app_id(kTestEnterpriseKioskApp); |
| 1895 | 1899 |
| 1896 const char kPrivateStoreUpdate[] = "/private_store_update"; | 1900 const char kPrivateStoreUpdate[] = "/private_store_update"; |
| 1897 net::test_server::EmbeddedTestServer private_server; | 1901 net::test_server::EmbeddedTestServer private_server; |
| 1898 ASSERT_TRUE(private_server.InitializeAndWaitUntilReady()); | 1902 ASSERT_TRUE(private_server.InitializeAndWaitUntilReady()); |
| 1899 | 1903 |
| 1900 // |private_server| serves crx from test data dir. | 1904 // |private_server| serves crx from test data dir. |
| 1901 base::FilePath test_data_dir; | 1905 base::FilePath test_data_dir; |
| 1902 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 1906 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
| 1903 private_server.ServeFilesFromDirectory(test_data_dir); | 1907 private_server.ServeFilesFromDirectory(test_data_dir); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 if (runner_.get()) | 1972 if (runner_.get()) |
| 1969 runner_->Quit(); | 1973 runner_->Quit(); |
| 1970 } | 1974 } |
| 1971 | 1975 |
| 1972 bool wallpaper_loaded_; | 1976 bool wallpaper_loaded_; |
| 1973 scoped_refptr<content::MessageLoopRunner> runner_; | 1977 scoped_refptr<content::MessageLoopRunner> runner_; |
| 1974 | 1978 |
| 1975 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); | 1979 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); |
| 1976 }; | 1980 }; |
| 1977 | 1981 |
| 1978 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) { | 1982 IN_PROC_BROWSER_TEST_P(KioskHiddenWebUITest, AutolaunchWarning) { |
| 1979 // Add a device owner. | 1983 // Add a device owner. |
| 1980 FakeChromeUserManager* user_manager = new FakeChromeUserManager(); | 1984 FakeChromeUserManager* user_manager = new FakeChromeUserManager(); |
| 1981 user_manager->AddUser(kTestOwnerEmail); | 1985 user_manager->AddUser(kTestOwnerEmail); |
| 1982 ScopedUserManagerEnabler enabler(user_manager); | 1986 ScopedUserManagerEnabler enabler(user_manager); |
| 1983 | 1987 |
| 1984 // Set kiosk app to autolaunch. | 1988 // Set kiosk app to autolaunch. |
| 1985 EnableConsumerKioskMode(); | 1989 EnableConsumerKioskMode(); |
| 1986 WizardController::SkipPostLoginScreensForTesting(); | 1990 WizardController::SkipPostLoginScreensForTesting(); |
| 1987 WizardController* wizard_controller = WizardController::default_controller(); | 1991 WizardController* wizard_controller = WizardController::default_controller(); |
| 1988 CHECK(wizard_controller); | 1992 CHECK(wizard_controller); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1999 // Wait for the auto launch warning come up. | 2003 // Wait for the auto launch warning come up. |
| 2000 content::WindowedNotificationObserver( | 2004 content::WindowedNotificationObserver( |
| 2001 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2005 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 2002 content::NotificationService::AllSources()).Wait(); | 2006 content::NotificationService::AllSources()).Wait(); |
| 2003 | 2007 |
| 2004 // Wait for the wallpaper to load. | 2008 // Wait for the wallpaper to load. |
| 2005 WaitForWallpaper(); | 2009 WaitForWallpaper(); |
| 2006 EXPECT_TRUE(wallpaper_loaded()); | 2010 EXPECT_TRUE(wallpaper_loaded()); |
| 2007 } | 2011 } |
| 2008 | 2012 |
| 2013 INSTANTIATE_TEST_CASE_P(KioskSuite, KioskTest, testing::Bool()); |
| 2014 INSTANTIATE_TEST_CASE_P(KioskUpdateSuite, KioskUpdateTest, testing::Bool()); |
| 2015 INSTANTIATE_TEST_CASE_P(KioskEnterpriseSuite, |
| 2016 KioskEnterpriseTest, |
| 2017 testing::Bool()); |
| 2018 INSTANTIATE_TEST_CASE_P(KioskHiddenWebUISuite, |
| 2019 KioskHiddenWebUITest, |
| 2020 testing::Bool()); |
| 2021 |
| 2009 } // namespace chromeos | 2022 } // namespace chromeos |
| OLD | NEW |