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

Side by Side Diff: chrome/browser/chromeos/login/parallel_authenticator_unittest.cc

Issue 10701075: Remove chromeos::CryptohomeLibrary::HashPassword (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarify comment in HashPassword() Created 8 years, 5 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/parallel_authenticator.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 (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/parallel_authenticator.h" 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 FailOnLoginFailure(); 483 FailOnLoginFailure();
484 484
485 // Set up mock cryptohome library to respond successfully to a key migration. 485 // Set up mock cryptohome library to respond successfully to a key migration.
486 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); 486 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
487 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, _, hash_ascii_, _)) 487 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, _, hash_ascii_, _))
488 .Times(1) 488 .Times(1)
489 .RetiresOnSaturation(); 489 .RetiresOnSaturation();
490 EXPECT_CALL(*mock_caller_, AsyncMount(username_, hash_ascii_, false, _)) 490 EXPECT_CALL(*mock_caller_, AsyncMount(username_, hash_ascii_, false, _))
491 .Times(1) 491 .Times(1)
492 .RetiresOnSaturation(); 492 .RetiresOnSaturation();
493 EXPECT_CALL(*mock_cryptohome_library_, HashPassword(_)) 493 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
494 .WillOnce(Return(std::string())) 494 .WillOnce(Return(std::string()))
495 .RetiresOnSaturation(); 495 .RetiresOnSaturation();
496 496
497 state_->PresetOnlineLoginStatus(LoginFailure::None()); 497 state_->PresetOnlineLoginStatus(LoginFailure::None());
498 SetAttemptState(auth_, state_.release()); 498 SetAttemptState(auth_, state_.release());
499 499
500 auth_->RecoverEncryptedData(std::string()); 500 auth_->RecoverEncryptedData(std::string());
501 message_loop_.Run(); 501 message_loop_.Run();
502 } 502 }
503 503
504 TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) { 504 TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) {
505 FailOnLoginSuccess(); 505 FailOnLoginSuccess();
506 ExpectPasswordChange(); 506 ExpectPasswordChange();
507 507
508 // Set up mock cryptohome library to fail a key migration attempt, 508 // Set up mock cryptohome library to fail a key migration attempt,
509 // asserting that the wrong password was used. 509 // asserting that the wrong password was used.
510 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); 510 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_KEY_FAILURE);
511 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, _, hash_ascii_, _)) 511 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, _, hash_ascii_, _))
512 .Times(1) 512 .Times(1)
513 .RetiresOnSaturation(); 513 .RetiresOnSaturation();
514 EXPECT_CALL(*mock_cryptohome_library_, HashPassword(_)) 514 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
515 .WillOnce(Return(std::string())) 515 .WillOnce(Return(std::string()))
516 .RetiresOnSaturation(); 516 .RetiresOnSaturation();
517 517
518 SetAttemptState(auth_, state_.release()); 518 SetAttemptState(auth_, state_.release());
519 519
520 auth_->RecoverEncryptedData(std::string()); 520 auth_->RecoverEncryptedData(std::string());
521 message_loop_.Run(); 521 message_loop_.Run();
522 } 522 }
523 523
524 TEST_F(ParallelAuthenticatorTest, ResolveNoMount) { 524 TEST_F(ParallelAuthenticatorTest, ResolveNoMount) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 FailOnLoginFailure(); 621 FailOnLoginFailure();
622 622
623 // Set up mock cryptohome library to respond successfully to a key migration. 623 // Set up mock cryptohome library to respond successfully to a key migration.
624 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); 624 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
625 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, 625 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_,
626 state_->ascii_hash, 626 state_->ascii_hash,
627 _, 627 _,
628 _)) 628 _))
629 .Times(1) 629 .Times(1)
630 .RetiresOnSaturation(); 630 .RetiresOnSaturation();
631 EXPECT_CALL(*mock_cryptohome_library_, HashPassword(_)) 631 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
632 .WillOnce(Return(std::string())) 632 .WillOnce(Return(std::string()))
633 .RetiresOnSaturation(); 633 .RetiresOnSaturation();
634 634
635 // Set up state as though a cryptohome mount attempt has occurred and 635 // Set up state as though a cryptohome mount attempt has occurred and
636 // succeeded; also, an online request that never made it. 636 // succeeded; also, an online request that never made it.
637 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); 637 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE);
638 // state_ is released further down. 638 // state_ is released further down.
639 SetAttemptState(auth_, state_.get()); 639 SetAttemptState(auth_, state_.get());
640 RunResolve(auth_.get()); 640 RunResolve(auth_.get());
641 641
(...skipping 17 matching lines...) Expand all
659 std::string(), 659 std::string(),
660 std::string(), 660 std::string(),
661 std::string()); 661 std::string());
662 message_loop_.Run(); 662 message_loop_.Run();
663 message_loop_.RunAllPending(); 663 message_loop_.RunAllPending();
664 } 664 }
665 665
666 TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) { 666 TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) {
667 ExpectLoginSuccess(username_, password_, true); 667 ExpectLoginSuccess(username_, password_, true);
668 FailOnLoginFailure(); 668 FailOnLoginFailure();
669 EXPECT_CALL(*mock_cryptohome_library_, HashPassword(_)) 669 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
670 .WillOnce(Return(std::string())) 670 .WillOnce(Return(std::string()))
671 .RetiresOnSaturation(); 671 .RetiresOnSaturation();
672 672
673 // Set up state as though a cryptohome mount attempt has occurred and 673 // Set up state as though a cryptohome mount attempt has occurred and
674 // succeeded; also, an online request that never made it. 674 // succeeded; also, an online request that never made it.
675 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); 675 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE);
676 // state_ is released further down. 676 // state_ is released further down.
677 SetAttemptState(auth_, state_.get()); 677 SetAttemptState(auth_, state_.get());
678 RunResolve(auth_.get()); 678 RunResolve(auth_.get());
679 679
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 TEST_F(ParallelAuthenticatorTest, DriveUnlock) { 741 TEST_F(ParallelAuthenticatorTest, DriveUnlock) {
742 ExpectLoginSuccess(username_, std::string(), false); 742 ExpectLoginSuccess(username_, std::string(), false);
743 FailOnLoginFailure(); 743 FailOnLoginFailure();
744 744
745 // Set up mock cryptohome library to respond successfully to a cryptohome 745 // Set up mock cryptohome library to respond successfully to a cryptohome
746 // key-check attempt. 746 // key-check attempt.
747 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); 747 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
748 EXPECT_CALL(*mock_caller_, AsyncCheckKey(username_, _, _)) 748 EXPECT_CALL(*mock_caller_, AsyncCheckKey(username_, _, _))
749 .Times(1) 749 .Times(1)
750 .RetiresOnSaturation(); 750 .RetiresOnSaturation();
751 EXPECT_CALL(*mock_cryptohome_library_, HashPassword(_)) 751 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
752 .WillOnce(Return(std::string())) 752 .WillOnce(Return(std::string()))
753 .RetiresOnSaturation(); 753 .RetiresOnSaturation();
754 754
755 auth_->AuthenticateToUnlock(username_, ""); 755 auth_->AuthenticateToUnlock(username_, "");
756 message_loop_.Run(); 756 message_loop_.Run();
757 } 757 }
758 758
759 } // namespace chromeos 759 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/parallel_authenticator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698