| 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 | 842 |
| 843 // The flow should be aborted due to auto enrollment enforcement. | 843 // The flow should be aborted due to auto enrollment enforcement. |
| 844 scoped_refptr<content::MessageLoopRunner> runner = | 844 scoped_refptr<content::MessageLoopRunner> runner = |
| 845 new content::MessageLoopRunner; | 845 new content::MessageLoopRunner; |
| 846 GetSigninScreenHandler()->set_kiosk_enable_flow_aborted_callback_for_test( | 846 GetSigninScreenHandler()->set_kiosk_enable_flow_aborted_callback_for_test( |
| 847 runner->QuitClosure()); | 847 runner->QuitClosure()); |
| 848 runner->Run(); | 848 runner->Run(); |
| 849 } | 849 } |
| 850 | 850 |
| 851 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { | 851 IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAfter2ndSigninScreen) { |
| 852 // Fake an auto enrollment is not going to be enforced. |
| 853 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 854 switches::kEnterpriseEnrollmentInitialModulus, "1"); |
| 855 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 856 switches::kEnterpriseEnrollmentModulusLimit, "2"); |
| 857 g_browser_process->local_state()->SetBoolean(prefs::kShouldAutoEnroll, false); |
| 858 g_browser_process->local_state()->SetInteger( |
| 859 prefs::kAutoEnrollmentPowerLimit, -1); |
| 860 |
| 852 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 861 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 853 chromeos::WizardController* wizard_controller = | 862 chromeos::WizardController* wizard_controller = |
| 854 chromeos::WizardController::default_controller(); | 863 chromeos::WizardController::default_controller(); |
| 855 CHECK(wizard_controller); | 864 CHECK(wizard_controller); |
| 856 | 865 |
| 857 // Check Kiosk mode status. | 866 // Check Kiosk mode status. |
| 858 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 867 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
| 859 GetConsumerKioskModeStatus()); | 868 GetConsumerKioskModeStatus()); |
| 860 | 869 |
| 861 // Wait for the login UI to come up and switch to the kiosk_enable screen. | 870 // Wait for the login UI to come up and switch to the kiosk_enable screen. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); | 1116 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); |
| 1108 account->set_account_id(kTestEnterpriseAccountId); | 1117 account->set_account_id(kTestEnterpriseAccountId); |
| 1109 account->set_type( | 1118 account->set_type( |
| 1110 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); | 1119 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); |
| 1111 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); | 1120 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); |
| 1112 accounts->set_auto_login_id(kTestEnterpriseAccountId); | 1121 accounts->set_auto_login_id(kTestEnterpriseAccountId); |
| 1113 em::PolicyData& policy_data = | 1122 em::PolicyData& policy_data = |
| 1114 device_policy_test_helper_.device_policy()->policy_data(); | 1123 device_policy_test_helper_.device_policy()->policy_data(); |
| 1115 policy_data.set_service_account_identity(kTestEnterpriseServiceAccountId); | 1124 policy_data.set_service_account_identity(kTestEnterpriseServiceAccountId); |
| 1116 device_policy_test_helper_.device_policy()->Build(); | 1125 device_policy_test_helper_.device_policy()->Build(); |
| 1117 | |
| 1118 base::RunLoop run_loop; | |
| 1119 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy( | 1126 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy( |
| 1120 device_policy_test_helper_.device_policy()->GetBlob(), | 1127 device_policy_test_helper_.device_policy()->GetBlob(), |
| 1121 base::Bind(&KioskEnterpriseTest::StorePolicyCallback, | 1128 base::Bind(&KioskEnterpriseTest::StorePolicyCallback)); |
| 1122 run_loop.QuitClosure())); | |
| 1123 run_loop.Run(); | |
| 1124 | 1129 |
| 1125 DeviceSettingsService::Get()->Load(); | 1130 DeviceSettingsService::Get()->Load(); |
| 1126 | 1131 |
| 1127 // Configure OAuth authentication. | 1132 // Configure OAuth authentication. |
| 1128 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); | 1133 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); |
| 1129 | 1134 |
| 1130 // This token satisfies the userinfo.email request from | 1135 // This token satisfies the userinfo.email request from |
| 1131 // DeviceOAuth2TokenService used in token validation. | 1136 // DeviceOAuth2TokenService used in token validation. |
| 1132 FakeGaia::AccessTokenInfo userinfo_token_info; | 1137 FakeGaia::AccessTokenInfo userinfo_token_info; |
| 1133 userinfo_token_info.token = kTestUserinfoToken; | 1138 userinfo_token_info.token = kTestUserinfoToken; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1152 access_token_info.email = kTestEnterpriseServiceAccountId; | 1157 access_token_info.email = kTestEnterpriseServiceAccountId; |
| 1153 fake_gaia_->IssueOAuthToken(kTestLoginToken, access_token_info); | 1158 fake_gaia_->IssueOAuthToken(kTestLoginToken, access_token_info); |
| 1154 | 1159 |
| 1155 DeviceOAuth2TokenService* token_service = | 1160 DeviceOAuth2TokenService* token_service = |
| 1156 DeviceOAuth2TokenServiceFactory::Get(); | 1161 DeviceOAuth2TokenServiceFactory::Get(); |
| 1157 token_service->SetAndSaveRefreshToken( | 1162 token_service->SetAndSaveRefreshToken( |
| 1158 kTestRefreshToken, DeviceOAuth2TokenService::StatusCallback()); | 1163 kTestRefreshToken, DeviceOAuth2TokenService::StatusCallback()); |
| 1159 base::RunLoop().RunUntilIdle(); | 1164 base::RunLoop().RunUntilIdle(); |
| 1160 } | 1165 } |
| 1161 | 1166 |
| 1162 static void StorePolicyCallback(const base::Closure& callback, bool result) { | 1167 static void StorePolicyCallback(bool result) { |
| 1163 ASSERT_TRUE(result); | 1168 ASSERT_TRUE(result); |
| 1164 callback.Run(); | |
| 1165 } | 1169 } |
| 1166 | 1170 |
| 1167 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; | 1171 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; |
| 1168 | 1172 |
| 1169 private: | 1173 private: |
| 1170 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); | 1174 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); |
| 1171 }; | 1175 }; |
| 1172 | 1176 |
| 1173 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { | 1177 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { |
| 1174 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1178 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 content::WindowedNotificationObserver( | 1299 content::WindowedNotificationObserver( |
| 1296 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1300 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1297 content::NotificationService::AllSources()).Wait(); | 1301 content::NotificationService::AllSources()).Wait(); |
| 1298 | 1302 |
| 1299 // Wait for the wallpaper to load. | 1303 // Wait for the wallpaper to load. |
| 1300 WaitForWallpaper(); | 1304 WaitForWallpaper(); |
| 1301 EXPECT_TRUE(wallpaper_loaded()); | 1305 EXPECT_TRUE(wallpaper_loaded()); |
| 1302 } | 1306 } |
| 1303 | 1307 |
| 1304 } // namespace chromeos | 1308 } // namespace chromeos |
| OLD | NEW |