Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: chrome/browser/chromeos/login/kiosk_browsertest.cc

Issue 258743005: Enable Enterprise enrollment on desktop builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added arg to PathService::OverrideAndCreateIfNeeded, added test for FakeCryptohomeClient::InstallAt… Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
861 chromeos::WizardController::SkipPostLoginScreensForTesting(); 852 chromeos::WizardController::SkipPostLoginScreensForTesting();
862 chromeos::WizardController* wizard_controller = 853 chromeos::WizardController* wizard_controller =
863 chromeos::WizardController::default_controller(); 854 chromeos::WizardController::default_controller();
864 CHECK(wizard_controller); 855 CHECK(wizard_controller);
865 856
866 // Check Kiosk mode status. 857 // Check Kiosk mode status.
867 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, 858 EXPECT_EQ(KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE,
868 GetConsumerKioskModeStatus()); 859 GetConsumerKioskModeStatus());
869 860
870 // Wait for the login UI to come up and switch to the kiosk_enable screen. 861 // 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
1116 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); 1107 em::DeviceLocalAccountInfoProto* account = accounts->add_account();
1117 account->set_account_id(kTestEnterpriseAccountId); 1108 account->set_account_id(kTestEnterpriseAccountId);
1118 account->set_type( 1109 account->set_type(
1119 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); 1110 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP);
1120 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); 1111 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp);
1121 accounts->set_auto_login_id(kTestEnterpriseAccountId); 1112 accounts->set_auto_login_id(kTestEnterpriseAccountId);
1122 em::PolicyData& policy_data = 1113 em::PolicyData& policy_data =
1123 device_policy_test_helper_.device_policy()->policy_data(); 1114 device_policy_test_helper_.device_policy()->policy_data();
1124 policy_data.set_service_account_identity(kTestEnterpriseServiceAccountId); 1115 policy_data.set_service_account_identity(kTestEnterpriseServiceAccountId);
1125 device_policy_test_helper_.device_policy()->Build(); 1116 device_policy_test_helper_.device_policy()->Build();
1117
1118 base::RunLoop run_loop;
1126 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy( 1119 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy(
1127 device_policy_test_helper_.device_policy()->GetBlob(), 1120 device_policy_test_helper_.device_policy()->GetBlob(),
1128 base::Bind(&KioskEnterpriseTest::StorePolicyCallback)); 1121 base::Bind(&KioskEnterpriseTest::StorePolicyCallback,
1122 run_loop.QuitClosure()));
1123 run_loop.Run();
1129 1124
1130 DeviceSettingsService::Get()->Load(); 1125 DeviceSettingsService::Get()->Load();
1131 1126
1132 // Configure OAuth authentication. 1127 // Configure OAuth authentication.
1133 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); 1128 GaiaUrls* gaia_urls = GaiaUrls::GetInstance();
1134 1129
1135 // This token satisfies the userinfo.email request from 1130 // This token satisfies the userinfo.email request from
1136 // DeviceOAuth2TokenService used in token validation. 1131 // DeviceOAuth2TokenService used in token validation.
1137 FakeGaia::AccessTokenInfo userinfo_token_info; 1132 FakeGaia::AccessTokenInfo userinfo_token_info;
1138 userinfo_token_info.token = kTestUserinfoToken; 1133 userinfo_token_info.token = kTestUserinfoToken;
(...skipping 18 matching lines...) Expand all
1157 access_token_info.email = kTestEnterpriseServiceAccountId; 1152 access_token_info.email = kTestEnterpriseServiceAccountId;
1158 fake_gaia_->IssueOAuthToken(kTestLoginToken, access_token_info); 1153 fake_gaia_->IssueOAuthToken(kTestLoginToken, access_token_info);
1159 1154
1160 DeviceOAuth2TokenService* token_service = 1155 DeviceOAuth2TokenService* token_service =
1161 DeviceOAuth2TokenServiceFactory::Get(); 1156 DeviceOAuth2TokenServiceFactory::Get();
1162 token_service->SetAndSaveRefreshToken( 1157 token_service->SetAndSaveRefreshToken(
1163 kTestRefreshToken, DeviceOAuth2TokenService::StatusCallback()); 1158 kTestRefreshToken, DeviceOAuth2TokenService::StatusCallback());
1164 base::RunLoop().RunUntilIdle(); 1159 base::RunLoop().RunUntilIdle();
1165 } 1160 }
1166 1161
1167 static void StorePolicyCallback(bool result) { 1162 static void StorePolicyCallback(const base::Closure& callback, bool result) {
1168 ASSERT_TRUE(result); 1163 ASSERT_TRUE(result);
1164 callback.Run();
1169 } 1165 }
1170 1166
1171 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; 1167 policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
1172 1168
1173 private: 1169 private:
1174 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); 1170 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest);
1175 }; 1171 };
1176 1172
1177 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { 1173 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) {
1178 chromeos::WizardController::SkipPostLoginScreensForTesting(); 1174 chromeos::WizardController::SkipPostLoginScreensForTesting();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 content::WindowedNotificationObserver( 1295 content::WindowedNotificationObserver(
1300 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 1296 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
1301 content::NotificationService::AllSources()).Wait(); 1297 content::NotificationService::AllSources()).Wait();
1302 1298
1303 // Wait for the wallpaper to load. 1299 // Wait for the wallpaper to load.
1304 WaitForWallpaper(); 1300 WaitForWallpaper();
1305 EXPECT_TRUE(wallpaper_loaded()); 1301 EXPECT_TRUE(wallpaper_loaded());
1306 } 1302 }
1307 1303
1308 } // namespace chromeos 1304 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698