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

Side by Side Diff: chrome/browser/ui/ash/session_state_delegate_chromeos_unittest.cc

Issue 560033002: Fixed suggesting adding more users into multi-profile session when we don't have more (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed initialization Created 6 years, 3 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 | « chrome/browser/ui/ash/session_state_delegate_chromeos.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/ash/session_state_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 "subject", "issuer", base::Time(), base::Time())); 222 "subject", "issuer", base::Time(), base::Time()));
223 service->OnTrustAnchorsChanged(certificates); 223 service->OnTrustAnchorsChanged(certificates);
224 EXPECT_TRUE(service->has_policy_certificates()); 224 EXPECT_TRUE(service->has_policy_certificates());
225 EXPECT_FALSE( 225 EXPECT_FALSE(
226 session_state_delegate()->IsMultiProfileAllowedByPrimaryUserPolicy()); 226 session_state_delegate()->IsMultiProfileAllowedByPrimaryUserPolicy());
227 227
228 // Flush tasks posted to IO. 228 // Flush tasks posted to IO.
229 base::RunLoop().RunUntilIdle(); 229 base::RunLoop().RunUntilIdle();
230 } 230 }
231 231
232 // Make sure adding users to multiprofiles disabled by reaching maximum
233 // number of users in sessions.
234 TEST_F(SessionStateDelegateChromeOSTest,
235 AddUserToMultiprofileDisallowedByMaximumUsers) {
236 InitForMultiProfile();
237 ash::SessionStateDelegate::AddUserError add_user_error;
238
239 EXPECT_TRUE(
240 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error));
241 const std::string user_email(kUser);
242 user_manager()->LoginUser(user_email);
243 while (session_state_delegate()->NumberOfLoggedInUsers() <
244 session_state_delegate()->GetMaximumNumberOfLoggedInUsers()) {
245 UserAddedToSession("bb@b.b");
246 }
247 EXPECT_FALSE(
248 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error));
249 EXPECT_EQ(ash::SessionStateDelegate::ADD_USER_ERROR_MAXIMUM_USERS_REACHED,
250 add_user_error);
251 }
252
253 // Make sure adding users to multiprofiles disabled by logging in all possible
254 // users.
255 TEST_F(SessionStateDelegateChromeOSTest,
256 AddUserToMultiprofileDisallowedByAllUsersLogged) {
257 InitForMultiProfile();
258 ash::SessionStateDelegate::AddUserError add_user_error;
259
260 EXPECT_TRUE(
261 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error));
262 const std::string user_email(kUser);
263 user_manager()->LoginUser(user_email);
264 UserAddedToSession("bb@b.b");
265 EXPECT_FALSE(
266 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error));
267 EXPECT_EQ(ash::SessionStateDelegate::ADD_USER_ERROR_OUT_OF_USERS,
268 add_user_error);
269 }
270
271 // Make sure adding users to multiprofiles disabled by primary user policy.
272 TEST_F(SessionStateDelegateChromeOSTest,
273 AddUserToMultiprofileDisallowedByPrimaryUserPolicy) {
274 InitForMultiProfile();
275 ash::SessionStateDelegate::AddUserError add_user_error;
276
277 EXPECT_TRUE(
278 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error));
279 const std::string user_email(kUser);
280 user_manager()->LoginUser(user_email);
281 user_profile_->GetPrefs()->SetString(
282 prefs::kMultiProfileUserBehavior,
283 chromeos::MultiProfileUserController::kBehaviorNotAllowed);
284 user_manager()->AddUser("bb@b.b");
285 EXPECT_FALSE(
286 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error));
287 EXPECT_EQ(ash::SessionStateDelegate::ADD_USER_ERROR_NOT_ALLOWED_PRIMARY_USER,
288 add_user_error);
289 }
290
232 } // namespace chromeos 291 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/session_state_delegate_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698