| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 std::string device_policy_; | 520 std::string device_policy_; |
| 521 std::string user_policy_; | 521 std::string user_policy_; |
| 522 | 522 |
| 523 DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest); | 523 DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest); |
| 524 }; | 524 }; |
| 525 | 525 |
| 526 class LoginUtilsBlockingLoginTest | 526 class LoginUtilsBlockingLoginTest |
| 527 : public LoginUtilsTest, | 527 : public LoginUtilsTest, |
| 528 public testing::WithParamInterface<int> {}; | 528 public testing::WithParamInterface<int> {}; |
| 529 | 529 |
| 530 TEST_F(LoginUtilsTest, NormalLoginDoesntBlock) { | 530 // Test leaks a profile with LSAN enabled. See http://crbug.com/374078. |
| 531 #if defined(LEAK_SANITIZER) |
| 532 #define MAYBE_NormalLoginDoesntBlock DISABLED_NormalLoginDoesntBlock |
| 533 #else |
| 534 #define MAYBE_NormalLoginDoesntBlock NormalLoginDoesntBlock |
| 535 #endif |
| 536 TEST_F(LoginUtilsTest, MAYBE_NormalLoginDoesntBlock) { |
| 531 UserManager* user_manager = UserManager::Get(); | 537 UserManager* user_manager = UserManager::Get(); |
| 532 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 538 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
| 533 EXPECT_FALSE(connector_->IsEnterpriseManaged()); | 539 EXPECT_FALSE(connector_->IsEnterpriseManaged()); |
| 534 EXPECT_FALSE(prepared_profile_); | 540 EXPECT_FALSE(prepared_profile_); |
| 535 EXPECT_EQ(policy::USER_AFFILIATION_NONE, | 541 EXPECT_EQ(policy::USER_AFFILIATION_NONE, |
| 536 connector_->GetUserAffiliation(kUsername)); | 542 connector_->GetUserAffiliation(kUsername)); |
| 537 | 543 |
| 538 // The profile will be created without waiting for a policy response. | 544 // The profile will be created without waiting for a policy response. |
| 539 PrepareProfile(kUsername); | 545 PrepareProfile(kUsername); |
| 540 | 546 |
| 541 EXPECT_TRUE(prepared_profile_); | 547 EXPECT_TRUE(prepared_profile_); |
| 542 ASSERT_TRUE(user_manager->IsUserLoggedIn()); | 548 ASSERT_TRUE(user_manager->IsUserLoggedIn()); |
| 543 EXPECT_EQ(kUsername, user_manager->GetLoggedInUser()->email()); | 549 EXPECT_EQ(kUsername, user_manager->GetLoggedInUser()->email()); |
| 544 } | 550 } |
| 545 | 551 |
| 546 TEST_F(LoginUtilsTest, EnterpriseLoginDoesntBlockForNormalUser) { | 552 // Test leaks a profile with LSAN enabled. See http://crbug.com/374078. |
| 553 #if defined(LEAK_SANITIZER) |
| 554 #define MAYBE_EnterpriseLoginDoesntBlockForNormalUser\ |
| 555 DISABLED_EnterpriseLoginDoesntBlockForNormalUser |
| 556 #else |
| 557 #define MAYBE_EnterpriseLoginDoesntBlockForNormalUser\ |
| 558 EnterpriseLoginDoesntBlockForNormalUser |
| 559 #endif |
| 560 TEST_F(LoginUtilsTest, MAYBE_EnterpriseLoginDoesntBlockForNormalUser) { |
| 547 UserManager* user_manager = UserManager::Get(); | 561 UserManager* user_manager = UserManager::Get(); |
| 548 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 562 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
| 549 EXPECT_FALSE(connector_->IsEnterpriseManaged()); | 563 EXPECT_FALSE(connector_->IsEnterpriseManaged()); |
| 550 EXPECT_FALSE(prepared_profile_); | 564 EXPECT_FALSE(prepared_profile_); |
| 551 | 565 |
| 552 // Enroll the device. | 566 // Enroll the device. |
| 553 EnrollDevice(kUsername); | 567 EnrollDevice(kUsername); |
| 554 | 568 |
| 555 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 569 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
| 556 EXPECT_TRUE(connector_->IsEnterpriseManaged()); | 570 EXPECT_TRUE(connector_->IsEnterpriseManaged()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } | 713 } |
| 700 | 714 |
| 701 INSTANTIATE_TEST_CASE_P( | 715 INSTANTIATE_TEST_CASE_P( |
| 702 LoginUtilsBlockingLoginTestInstance, | 716 LoginUtilsBlockingLoginTestInstance, |
| 703 LoginUtilsBlockingLoginTest, | 717 LoginUtilsBlockingLoginTest, |
| 704 testing::Values(0, 1, 2, 3, 4, 5)); | 718 testing::Values(0, 1, 2, 3, 4, 5)); |
| 705 | 719 |
| 706 } // namespace | 720 } // namespace |
| 707 | 721 |
| 708 } // namespace chromeos | 722 } // namespace chromeos |
| OLD | NEW |