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

Side by Side Diff: chrome/browser/chromeos/preferences_chromeos_browsertest.cc

Issue 2799143002: Improve profile stats performace. (Closed)
Patch Set: Use enum Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(PrefService::INCLUDE_DEFAULTS);
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(
253 prefs1->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS).get()));
253 SetPrefs(prefs2, true); 254 SetPrefs(prefs2, true);
254 CheckSettingsCorrespondToPrefs(prefs2); 255 CheckSettingsCorrespondToPrefs(prefs2);
255 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues().get())); 256 EXPECT_TRUE(prefs_backup->Equals(
257 prefs1->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS).get()));
256 258
257 // Check that changing prefs of the inactive user doesn't affect prefs of the 259 // Check that changing prefs of the inactive user doesn't affect prefs of the
258 // active user. 260 // active user.
259 prefs_backup = prefs2->GetPreferenceValues(); 261 prefs_backup = prefs2->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS);
260 SetPrefs(prefs1, true); 262 SetPrefs(prefs1, true);
261 CheckSettingsCorrespondToPrefs(prefs2); 263 CheckSettingsCorrespondToPrefs(prefs2);
262 EXPECT_TRUE(prefs_backup->Equals(prefs2->GetPreferenceValues().get())); 264 EXPECT_TRUE(prefs_backup->Equals(
265 prefs2->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS).get()));
263 SetPrefs(prefs1, false); 266 SetPrefs(prefs1, false);
264 CheckSettingsCorrespondToPrefs(prefs2); 267 CheckSettingsCorrespondToPrefs(prefs2);
265 EXPECT_TRUE(prefs_backup->Equals(prefs2->GetPreferenceValues().get())); 268 EXPECT_TRUE(prefs_backup->Equals(
269 prefs2->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS).get()));
266 270
267 // Check that changing non-owner prefs doesn't change corresponding local 271 // Check that changing non-owner prefs doesn't change corresponding local
268 // state prefs and vice versa. 272 // state prefs and vice versa.
269 EXPECT_EQ(user_manager->GetOwnerAccountId(), test_users_[0]); 273 EXPECT_EQ(user_manager->GetOwnerAccountId(), test_users_[0]);
270 CheckLocalStateCorrespondsToPrefs(prefs1); 274 CheckLocalStateCorrespondsToPrefs(prefs1);
271 prefs2->SetBoolean(prefs::kTapToClickEnabled, 275 prefs2->SetBoolean(prefs::kTapToClickEnabled,
272 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); 276 !prefs1->GetBoolean(prefs::kTapToClickEnabled));
273 CheckLocalStateCorrespondsToPrefs(prefs1); 277 CheckLocalStateCorrespondsToPrefs(prefs1);
274 prefs1->SetBoolean(prefs::kTapToClickEnabled, 278 prefs1->SetBoolean(prefs::kTapToClickEnabled,
275 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); 279 !prefs1->GetBoolean(prefs::kTapToClickEnabled));
276 CheckLocalStateCorrespondsToPrefs(prefs1); 280 CheckLocalStateCorrespondsToPrefs(prefs1);
277 281
278 // Switch user back. 282 // Switch user back.
279 user_manager->SwitchActiveUser(test_users_[0]); 283 user_manager->SwitchActiveUser(test_users_[0]);
280 CheckSettingsCorrespondToPrefs(prefs1); 284 CheckSettingsCorrespondToPrefs(prefs1);
281 CheckLocalStateCorrespondsToPrefs(prefs1); 285 CheckLocalStateCorrespondsToPrefs(prefs1);
282 } 286 }
283 287
284 } // namespace chromeos 288 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698