| 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 "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 5 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 MultiProfileUserController::ALLOWED) | 315 MultiProfileUserController::ALLOWED) |
| 316 << "Case " << i; | 316 << "Case " << i; |
| 317 } else { | 317 } else { |
| 318 EXPECT_NE(kBehaviorTestCases[i].expected_secondary_allowed, | 318 EXPECT_NE(kBehaviorTestCases[i].expected_secondary_allowed, |
| 319 MultiProfileUserController::ALLOWED) | 319 MultiProfileUserController::ALLOWED) |
| 320 << "Case " << i; | 320 << "Case " << i; |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 // Tests that owner could not be a secondary user. | |
| 326 // | |
| 327 // TODO (ygorshenin@, crbug.com/230018): remove or change the test when the | |
| 328 // issue will be fixed. | |
| 329 TEST_F(MultiProfileUserControllerTest, DISABLED_NoSecondaryOwner) { | |
| 330 LoginUser(0); | |
| 331 SetOwner(1); | |
| 332 | |
| 333 MultiProfileUserController::UserAllowedInSessionReason reason; | |
| 334 EXPECT_FALSE(controller()->IsUserAllowedInSession(kUsers[1], &reason)); | |
| 335 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY, reason); | |
| 336 | |
| 337 EXPECT_EQ(0, user_not_allowed_count()); | |
| 338 LoginUser(1); | |
| 339 EXPECT_EQ(1, user_not_allowed_count()); | |
| 340 } | |
| 341 | |
| 342 TEST_F(MultiProfileUserControllerTest, | 325 TEST_F(MultiProfileUserControllerTest, |
| 343 UsedPolicyCertificatesAllowedForPrimary) { | 326 UsedPolicyCertificatesAllowedForPrimary) { |
| 344 // Verifies that any user can sign-in as the primary user, regardless of the | 327 // Verifies that any user can sign-in as the primary user, regardless of the |
| 345 // tainted state. | 328 // tainted state. |
| 346 policy::PolicyCertServiceFactory::SetUsedPolicyCertificates(kUsers[0]); | 329 policy::PolicyCertServiceFactory::SetUsedPolicyCertificates(kUsers[0]); |
| 347 MultiProfileUserController::UserAllowedInSessionReason reason; | 330 MultiProfileUserController::UserAllowedInSessionReason reason; |
| 348 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[0], &reason)); | 331 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[0], &reason)); |
| 349 EXPECT_EQ(MultiProfileUserController::ALLOWED, reason); | 332 EXPECT_EQ(MultiProfileUserController::ALLOWED, reason); |
| 350 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[1], &reason)); | 333 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[1], &reason)); |
| 351 EXPECT_EQ(MultiProfileUserController::ALLOWED, reason); | 334 EXPECT_EQ(MultiProfileUserController::ALLOWED, reason); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, | 421 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, |
| 439 reason); | 422 reason); |
| 440 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, | 423 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, |
| 441 MultiProfileUserController::GetPrimaryUserPolicy()); | 424 MultiProfileUserController::GetPrimaryUserPolicy()); |
| 442 | 425 |
| 443 // Flush tasks posted to IO. | 426 // Flush tasks posted to IO. |
| 444 base::RunLoop().RunUntilIdle(); | 427 base::RunLoop().RunUntilIdle(); |
| 445 } | 428 } |
| 446 | 429 |
| 447 } // namespace chromeos | 430 } // namespace chromeos |
| OLD | NEW |