OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <cstdlib> | 5 #include <cstdlib> |
6 #include <cstring> | 6 #include <cstring> |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 TEST_F(UserManagerTest, ScreenLockAvailability) { | 222 TEST_F(UserManagerTest, ScreenLockAvailability) { |
223 // Log in the user and create the profile. | 223 // Log in the user and create the profile. |
224 user_manager::UserManager::Get()->UserLoggedIn( | 224 user_manager::UserManager::Get()->UserLoggedIn( |
225 owner_account_id_at_invalid_domain_, | 225 owner_account_id_at_invalid_domain_, |
226 owner_account_id_at_invalid_domain_.GetUserEmail(), false); | 226 owner_account_id_at_invalid_domain_.GetUserEmail(), false); |
227 user_manager::User* const user = | 227 user_manager::User* const user = |
228 user_manager::UserManager::Get()->GetActiveUser(); | 228 user_manager::UserManager::Get()->GetActiveUser(); |
229 Profile* const profile = | 229 Profile* const profile = |
230 ProfileHelper::GetProfileByUserIdHash(user->username_hash()); | 230 ProfileHelper::GetProfileByUserIdHashForTest(user->username_hash()); |
231 | 231 |
232 // Verify that the user is allowed to lock the screen. | 232 // Verify that the user is allowed to lock the screen. |
233 EXPECT_TRUE(user_manager::UserManager::Get()->CanCurrentUserLock()); | 233 EXPECT_TRUE(user_manager::UserManager::Get()->CanCurrentUserLock()); |
234 EXPECT_EQ(1U, user_manager::UserManager::Get()->GetUnlockUsers().size()); | 234 EXPECT_EQ(1U, user_manager::UserManager::Get()->GetUnlockUsers().size()); |
235 | 235 |
236 // The user is not allowed to lock the screen. | 236 // The user is not allowed to lock the screen. |
237 profile->GetPrefs()->SetBoolean(prefs::kAllowScreenLock, false); | 237 profile->GetPrefs()->SetBoolean(prefs::kAllowScreenLock, false); |
238 EXPECT_FALSE(user_manager::UserManager::Get()->CanCurrentUserLock()); | 238 EXPECT_FALSE(user_manager::UserManager::Get()->CanCurrentUserLock()); |
239 EXPECT_EQ(0U, user_manager::UserManager::Get()->GetUnlockUsers().size()); | 239 EXPECT_EQ(0U, user_manager::UserManager::Get()->GetUnlockUsers().size()); |
240 | 240 |
(...skipping 26 matching lines...) Expand all Loading... |
267 // Clear the stored user data - when UserManager loads again, it should | 267 // Clear the stored user data - when UserManager loads again, it should |
268 // migrate existing users by setting session_initialized to true for them. | 268 // migrate existing users by setting session_initialized to true for them. |
269 user_manager::known_user::RemovePrefsForTesting((*users)[0]->GetAccountId()); | 269 user_manager::known_user::RemovePrefsForTesting((*users)[0]->GetAccountId()); |
270 ResetUserManager(); | 270 ResetUserManager(); |
271 users = &user_manager::UserManager::Get()->GetUsers(); | 271 users = &user_manager::UserManager::Get()->GetUsers(); |
272 ASSERT_EQ(1U, users->size()); | 272 ASSERT_EQ(1U, users->size()); |
273 EXPECT_TRUE((*users)[0]->profile_ever_initialized()); | 273 EXPECT_TRUE((*users)[0]->profile_ever_initialized()); |
274 } | 274 } |
275 | 275 |
276 } // namespace chromeos | 276 } // namespace chromeos |
OLD | NEW |