| 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 <sys/types.h> | 5 #include <sys/types.h> |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 IN_PROC_BROWSER_TEST_F(PreferencesTest, MultiProfiles) { | 141 IN_PROC_BROWSER_TEST_F(PreferencesTest, MultiProfiles) { |
| 142 UserManager* user_manager = UserManager::Get(); | 142 UserManager* user_manager = UserManager::Get(); |
| 143 | 143 |
| 144 // Add first user and init its preferences. Check that corresponding | 144 // Add first user and init its preferences. Check that corresponding |
| 145 // settings has been changed. | 145 // settings has been changed. |
| 146 LoginUser(kTestUsers[0]); | 146 LoginUser(kTestUsers[0]); |
| 147 const user_manager::User* user1 = user_manager->FindUser(kTestUsers[0]); | 147 const user_manager::User* user1 = user_manager->FindUser(kTestUsers[0]); |
| 148 PrefService* prefs1 = | 148 PrefService* prefs1 = |
| 149 ProfileHelper::Get()->GetProfileByUser(user1)->GetPrefs(); | 149 ProfileHelper::Get()->GetProfileByUserUnsafe(user1)->GetPrefs(); |
| 150 SetPrefs(prefs1, false); | 150 SetPrefs(prefs1, false); |
| 151 content::RunAllPendingInMessageLoop(); | 151 content::RunAllPendingInMessageLoop(); |
| 152 CheckSettingsCorrespondToPrefs(prefs1); | 152 CheckSettingsCorrespondToPrefs(prefs1); |
| 153 | 153 |
| 154 // Add second user and init its prefs with different values. | 154 // Add second user and init its prefs with different values. |
| 155 UserAddingScreen::Get()->Start(); | 155 UserAddingScreen::Get()->Start(); |
| 156 content::RunAllPendingInMessageLoop(); | 156 content::RunAllPendingInMessageLoop(); |
| 157 DisableAnimations(); | 157 DisableAnimations(); |
| 158 AddUser(kTestUsers[1]); | 158 AddUser(kTestUsers[1]); |
| 159 content::RunAllPendingInMessageLoop(); | 159 content::RunAllPendingInMessageLoop(); |
| 160 const user_manager::User* user2 = user_manager->FindUser(kTestUsers[1]); | 160 const user_manager::User* user2 = user_manager->FindUser(kTestUsers[1]); |
| 161 EXPECT_TRUE(user2->is_active()); | 161 EXPECT_TRUE(user2->is_active()); |
| 162 PrefService* prefs2 = | 162 PrefService* prefs2 = |
| 163 ProfileHelper::Get()->GetProfileByUser(user2)->GetPrefs(); | 163 ProfileHelper::Get()->GetProfileByUserUnsafe(user2)->GetPrefs(); |
| 164 SetPrefs(prefs2, true); | 164 SetPrefs(prefs2, true); |
| 165 | 165 |
| 166 // Check that settings were changed accordingly. | 166 // Check that settings were changed accordingly. |
| 167 EXPECT_TRUE(user2->is_active()); | 167 EXPECT_TRUE(user2->is_active()); |
| 168 CheckSettingsCorrespondToPrefs(prefs2); | 168 CheckSettingsCorrespondToPrefs(prefs2); |
| 169 | 169 |
| 170 // Check that changing prefs of the active user doesn't affect prefs of the | 170 // Check that changing prefs of the active user doesn't affect prefs of the |
| 171 // inactive user. | 171 // inactive user. |
| 172 scoped_ptr<base::DictionaryValue> prefs_backup = | 172 scoped_ptr<base::DictionaryValue> prefs_backup = |
| 173 prefs1->GetPreferenceValues(); | 173 prefs1->GetPreferenceValues(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 199 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); | 199 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); |
| 200 CheckLocalStateCorrespondsToPrefs(prefs1); | 200 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 201 | 201 |
| 202 // Switch user back. | 202 // Switch user back. |
| 203 user_manager->SwitchActiveUser(kTestUsers[0]); | 203 user_manager->SwitchActiveUser(kTestUsers[0]); |
| 204 CheckSettingsCorrespondToPrefs(prefs1); | 204 CheckSettingsCorrespondToPrefs(prefs1); |
| 205 CheckLocalStateCorrespondsToPrefs(prefs1); | 205 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace chromeos | 208 } // namespace chromeos |
| OLD | NEW |