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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 std::string device_policy_; | 517 std::string device_policy_; |
518 std::string user_policy_; | 518 std::string user_policy_; |
519 | 519 |
520 DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest); | 520 DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest); |
521 }; | 521 }; |
522 | 522 |
523 class LoginUtilsBlockingLoginTest | 523 class LoginUtilsBlockingLoginTest |
524 : public LoginUtilsTest, | 524 : public LoginUtilsTest, |
525 public testing::WithParamInterface<int> {}; | 525 public testing::WithParamInterface<int> {}; |
526 | 526 |
527 // Test leaks a profile with LSAN enabled. See http://crbug.com/374078. | 527 TEST_F(LoginUtilsTest, NormalLoginDoesntBlock) { |
528 #if defined(LEAK_SANITIZER) | |
529 #define MAYBE_NormalLoginDoesntBlock DISABLED_NormalLoginDoesntBlock | |
530 #else | |
531 #define MAYBE_NormalLoginDoesntBlock NormalLoginDoesntBlock | |
532 #endif | |
533 TEST_F(LoginUtilsTest, MAYBE_NormalLoginDoesntBlock) { | |
534 UserManager* user_manager = UserManager::Get(); | 528 UserManager* user_manager = UserManager::Get(); |
535 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 529 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
536 EXPECT_FALSE(connector_->IsEnterpriseManaged()); | 530 EXPECT_FALSE(connector_->IsEnterpriseManaged()); |
537 EXPECT_FALSE(prepared_profile_); | 531 EXPECT_FALSE(prepared_profile_); |
538 EXPECT_EQ(policy::USER_AFFILIATION_NONE, | 532 EXPECT_EQ(policy::USER_AFFILIATION_NONE, |
539 connector_->GetUserAffiliation(kUsername)); | 533 connector_->GetUserAffiliation(kUsername)); |
540 | 534 |
541 // The profile will be created without waiting for a policy response. | 535 // The profile will be created without waiting for a policy response. |
542 PrepareProfile(kUsername); | 536 PrepareProfile(kUsername); |
543 | 537 |
544 EXPECT_TRUE(prepared_profile_); | 538 EXPECT_TRUE(prepared_profile_); |
545 ASSERT_TRUE(user_manager->IsUserLoggedIn()); | 539 ASSERT_TRUE(user_manager->IsUserLoggedIn()); |
546 EXPECT_EQ(kUsername, user_manager->GetLoggedInUser()->email()); | 540 EXPECT_EQ(kUsername, user_manager->GetLoggedInUser()->email()); |
547 } | 541 } |
548 | 542 |
549 // Test leaks a profile with LSAN enabled. See http://crbug.com/374078. | 543 TEST_F(LoginUtilsTest, EnterpriseLoginDoesntBlockForNormalUser) { |
550 #if defined(LEAK_SANITIZER) | |
551 #define MAYBE_EnterpriseLoginDoesntBlockForNormalUser\ | |
552 DISABLED_EnterpriseLoginDoesntBlockForNormalUser | |
553 #else | |
554 #define MAYBE_EnterpriseLoginDoesntBlockForNormalUser\ | |
555 EnterpriseLoginDoesntBlockForNormalUser | |
556 #endif | |
557 TEST_F(LoginUtilsTest, MAYBE_EnterpriseLoginDoesntBlockForNormalUser) { | |
558 UserManager* user_manager = UserManager::Get(); | 544 UserManager* user_manager = UserManager::Get(); |
559 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 545 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
560 EXPECT_FALSE(connector_->IsEnterpriseManaged()); | 546 EXPECT_FALSE(connector_->IsEnterpriseManaged()); |
561 EXPECT_FALSE(prepared_profile_); | 547 EXPECT_FALSE(prepared_profile_); |
562 | 548 |
563 // Enroll the device. | 549 // Enroll the device. |
564 EnrollDevice(kUsername); | 550 EnrollDevice(kUsername); |
565 | 551 |
566 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 552 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
567 EXPECT_TRUE(connector_->IsEnterpriseManaged()); | 553 EXPECT_TRUE(connector_->IsEnterpriseManaged()); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 } | 696 } |
711 | 697 |
712 INSTANTIATE_TEST_CASE_P( | 698 INSTANTIATE_TEST_CASE_P( |
713 LoginUtilsBlockingLoginTestInstance, | 699 LoginUtilsBlockingLoginTestInstance, |
714 LoginUtilsBlockingLoginTest, | 700 LoginUtilsBlockingLoginTest, |
715 testing::Values(0, 1, 2, 3, 4, 5)); | 701 testing::Values(0, 1, 2, 3, 4, 5)); |
716 | 702 |
717 } // namespace | 703 } // namespace |
718 | 704 |
719 } // namespace chromeos | 705 } // namespace chromeos |
OLD | NEW |