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

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

Issue 246253009: Multiprofile: switch to newly added user to the session (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | no next file » | 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 LoginUser(kTestUsers[0]); 146 LoginUser(kTestUsers[0]);
147 const User* user1 = user_manager->FindUser(kTestUsers[0]); 147 const User* user1 = user_manager->FindUser(kTestUsers[0]);
148 PrefService* prefs1 = user_manager->GetProfileByUser(user1)->GetPrefs(); 148 PrefService* prefs1 = user_manager->GetProfileByUser(user1)->GetPrefs();
149 SetPrefs(prefs1, false); 149 SetPrefs(prefs1, false);
150 content::RunAllPendingInMessageLoop(); 150 content::RunAllPendingInMessageLoop();
151 CheckSettingsCorrespondToPrefs(prefs1); 151 CheckSettingsCorrespondToPrefs(prefs1);
152 152
153 // Add second user and init its prefs with different values. 153 // Add second user and init its prefs with different values.
154 UserAddingScreen::Get()->Start(); 154 UserAddingScreen::Get()->Start();
155 content::RunAllPendingInMessageLoop(); 155 content::RunAllPendingInMessageLoop();
156 DisableAnimations();
156 AddUser(kTestUsers[1]); 157 AddUser(kTestUsers[1]);
157 EXPECT_TRUE(user1->is_active()); 158 content::RunAllPendingInMessageLoop();
158 const User* user2 = user_manager->FindUser(kTestUsers[1]); 159 const User* user2 = user_manager->FindUser(kTestUsers[1]);
160 EXPECT_TRUE(user2->is_active());
159 PrefService* prefs2 = user_manager->GetProfileByUser(user2)->GetPrefs(); 161 PrefService* prefs2 = user_manager->GetProfileByUser(user2)->GetPrefs();
160 SetPrefs(prefs2, true); 162 SetPrefs(prefs2, true);
161 163
162 // First user is still active, so settings was not changed. 164 // Check that settings were changed accordingly.
163 EXPECT_TRUE(user1->is_active());
164 CheckSettingsCorrespondToPrefs(prefs1);
165
166 // Switch user and check that settings was changed accordingly.
167 DisableAnimations();
168 user_manager->SwitchActiveUser(kTestUsers[1]);
169 EXPECT_TRUE(user2->is_active()); 165 EXPECT_TRUE(user2->is_active());
170 CheckSettingsCorrespondToPrefs(prefs2); 166 CheckSettingsCorrespondToPrefs(prefs2);
171 167
172 // Check that changing prefs of the active user doesn't affect prefs of the 168 // Check that changing prefs of the active user doesn't affect prefs of the
173 // inactive user. 169 // inactive user.
174 scoped_ptr<base::DictionaryValue> prefs_backup = 170 scoped_ptr<base::DictionaryValue> prefs_backup =
175 prefs1->GetPreferenceValues(); 171 prefs1->GetPreferenceValues();
176 SetPrefs(prefs2, false); 172 SetPrefs(prefs2, false);
177 CheckSettingsCorrespondToPrefs(prefs2); 173 CheckSettingsCorrespondToPrefs(prefs2);
178 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues().get())); 174 EXPECT_TRUE(prefs_backup->Equals(prefs1->GetPreferenceValues().get()));
(...skipping 22 matching lines...) Expand all
201 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); 197 !prefs1->GetBoolean(prefs::kTapToClickEnabled));
202 CheckLocalStateCorrespondsToPrefs(prefs1); 198 CheckLocalStateCorrespondsToPrefs(prefs1);
203 199
204 // Switch user back. 200 // Switch user back.
205 user_manager->SwitchActiveUser(kTestUsers[0]); 201 user_manager->SwitchActiveUser(kTestUsers[0]);
206 CheckSettingsCorrespondToPrefs(prefs1); 202 CheckSettingsCorrespondToPrefs(prefs1);
207 CheckLocalStateCorrespondsToPrefs(prefs1); 203 CheckLocalStateCorrespondsToPrefs(prefs1);
208 } 204 }
209 205
210 } // namespace chromeos 206 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698