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

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

Issue 398753004: [cros] Move User class to user_manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | chrome/browser/chromeos/preferences_unittest.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 <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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 RegisterUser(kTestUsers[1]); 137 RegisterUser(kTestUsers[1]);
138 chromeos::StartupUtils::MarkOobeCompleted(); 138 chromeos::StartupUtils::MarkOobeCompleted();
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* 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()->GetProfileByUser(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* 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()->GetProfileByUser(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
(...skipping 28 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | chrome/browser/chromeos/preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698