| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <sys/types.h> | 6 #include <sys/types.h> |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 ProfileHelper::Get()->GetProfileByUserUnsafe(user2)->GetPrefs(); | 239 ProfileHelper::Get()->GetProfileByUserUnsafe(user2)->GetPrefs(); |
| 240 SetPrefs(prefs2, true); | 240 SetPrefs(prefs2, true); |
| 241 | 241 |
| 242 // Check that settings were changed accordingly. | 242 // Check that settings were changed accordingly. |
| 243 EXPECT_TRUE(user2->is_active()); | 243 EXPECT_TRUE(user2->is_active()); |
| 244 CheckSettingsCorrespondToPrefs(prefs2); | 244 CheckSettingsCorrespondToPrefs(prefs2); |
| 245 | 245 |
| 246 // Check that changing prefs of the active user doesn't affect prefs of the | 246 // Check that changing prefs of the active user doesn't affect prefs of the |
| 247 // inactive user. | 247 // inactive user. |
| 248 std::unique_ptr<base::DictionaryValue> prefs_backup = | 248 std::unique_ptr<base::DictionaryValue> prefs_backup = |
| 249 prefs1->GetPreferenceValues(); | 249 prefs1->GetPreferenceValues(true); |
| 250 SetPrefs(prefs2, false); | 250 SetPrefs(prefs2, false); |
| 251 CheckSettingsCorrespondToPrefs(prefs2); | 251 CheckSettingsCorrespondToPrefs(prefs2); |
| 252 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues().get())); | 252 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues(true).get())); |
| 253 SetPrefs(prefs2, true); | 253 SetPrefs(prefs2, true); |
| 254 CheckSettingsCorrespondToPrefs(prefs2); | 254 CheckSettingsCorrespondToPrefs(prefs2); |
| 255 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues().get())); | 255 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues(true).get())); |
| 256 | 256 |
| 257 // Check that changing prefs of the inactive user doesn't affect prefs of the | 257 // Check that changing prefs of the inactive user doesn't affect prefs of the |
| 258 // active user. | 258 // active user. |
| 259 prefs_backup = prefs2->GetPreferenceValues(); | 259 prefs_backup = prefs2->GetPreferenceValues(true); |
| 260 SetPrefs(prefs1, true); | 260 SetPrefs(prefs1, true); |
| 261 CheckSettingsCorrespondToPrefs(prefs2); | 261 CheckSettingsCorrespondToPrefs(prefs2); |
| 262 EXPECT_TRUE(prefs_backup->Equals(prefs2->GetPreferenceValues().get())); | 262 EXPECT_TRUE(prefs_backup->Equals(prefs2->GetPreferenceValues(true).get())); |
| 263 SetPrefs(prefs1, false); | 263 SetPrefs(prefs1, false); |
| 264 CheckSettingsCorrespondToPrefs(prefs2); | 264 CheckSettingsCorrespondToPrefs(prefs2); |
| 265 EXPECT_TRUE(prefs_backup->Equals(prefs2->GetPreferenceValues().get())); | 265 EXPECT_TRUE(prefs_backup->Equals(prefs2->GetPreferenceValues(true).get())); |
| 266 | 266 |
| 267 // Check that changing non-owner prefs doesn't change corresponding local | 267 // Check that changing non-owner prefs doesn't change corresponding local |
| 268 // state prefs and vice versa. | 268 // state prefs and vice versa. |
| 269 EXPECT_EQ(user_manager->GetOwnerAccountId(), test_users_[0]); | 269 EXPECT_EQ(user_manager->GetOwnerAccountId(), test_users_[0]); |
| 270 CheckLocalStateCorrespondsToPrefs(prefs1); | 270 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 271 prefs2->SetBoolean(prefs::kTapToClickEnabled, | 271 prefs2->SetBoolean(prefs::kTapToClickEnabled, |
| 272 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); | 272 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); |
| 273 CheckLocalStateCorrespondsToPrefs(prefs1); | 273 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 274 prefs1->SetBoolean(prefs::kTapToClickEnabled, | 274 prefs1->SetBoolean(prefs::kTapToClickEnabled, |
| 275 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); | 275 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); |
| 276 CheckLocalStateCorrespondsToPrefs(prefs1); | 276 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 277 | 277 |
| 278 // Switch user back. | 278 // Switch user back. |
| 279 user_manager->SwitchActiveUser(test_users_[0]); | 279 user_manager->SwitchActiveUser(test_users_[0]); |
| 280 CheckSettingsCorrespondToPrefs(prefs1); | 280 CheckSettingsCorrespondToPrefs(prefs1); |
| 281 CheckLocalStateCorrespondsToPrefs(prefs1); | 281 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace chromeos | 284 } // namespace chromeos |
| OLD | NEW |