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

Unified Diff: chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc

Issue 495563003: Move ParallelAuthnticator to chromeos and rename it to CryptohomeAuthenticator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
diff --git a/chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
similarity index 76%
rename from chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc
rename to chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
index 8b52d176f6708e542acb23bbc4c9be1897241d65..23df996ff06c4c530833bca016e79ab99df0227c 100644
--- a/chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/login/auth/parallel_authenticator.h"
+#include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h"
#include <string>
@@ -56,48 +56,46 @@ namespace {
// An owner key in PKCS#8 PrivateKeyInfo for testing owner checks.
const uint8 kOwnerPrivateKey[] = {
- 0x30, 0x82, 0x01, 0x53, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a,
- 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82,
- 0x01, 0x3d, 0x30, 0x82, 0x01, 0x39, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00,
- 0xb4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0x86, 0xbe, 0x8d, 0xf1, 0xbc, 0x2c, 0x79, 0x59, 0xf5, 0xff, 0xbc,
+ 0x6b, 0x02, 0x20, 0x7c, 0x09, 0x1c, 0xc1, 0x1c, 0xf2, 0x33, 0x9c, 0x1a,
+ 0x72, 0xcc, 0xd4, 0xf3, 0x97, 0xc6, 0x44, 0x55, 0xf2, 0xe0, 0x94, 0x9c,
+ 0x97, 0x75, 0x64, 0x34, 0x52, 0x4b, 0xc1, 0x53, 0xdd, 0x8f, 0x21, 0x02,
+ 0x20, 0x0e, 0xef, 0x48, 0x92, 0x2d, 0x9c, 0xe8, 0xd3, 0x7e, 0x1e, 0x55,
+ 0x0f, 0x23, 0x74, 0x76, 0x07, 0xec, 0x2c, 0x9e, 0xe4, 0x0e, 0xc0, 0x72,
+ 0xeb, 0x70, 0xcb, 0x74, 0xef, 0xcc, 0x26, 0x50, 0xff, 0x02, 0x20, 0x29,
+ 0x32, 0xd0, 0xbf, 0x11, 0xf2, 0xbf, 0x54, 0xfd, 0x6d, 0xf2, 0x1c, 0xbe,
+ 0x50, 0x18, 0x62, 0x6d, 0x23, 0xe4, 0x26, 0x03, 0x8b, 0xb3, 0x42, 0x24,
+ 0x7e, 0x68, 0x37, 0x26, 0xda, 0xb9, 0x87};
// The public key alone matcing kOwnerPrivateKey.
const uint8 kOwnerPublicKey[] = {
- 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
- 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41,
- 0x00, 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e,
- 0xdf, 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4,
- 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc,
- 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0,
- 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9,
- 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01
-};
+ 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
+ 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41,
+ 0x00, 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e,
+ 0xdf, 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4,
+ 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc,
+ 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0,
+ 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9,
+ 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01};
std::vector<uint8> GetOwnerPublicKey() {
return std::vector<uint8>(kOwnerPublicKey,
@@ -113,9 +111,9 @@ scoped_ptr<crypto::RSAPrivateKey> CreateOwnerKeyInSlot(PK11SlotInfo* slot) {
} // namespace
-class ParallelAuthenticatorTest : public testing::Test {
+class CryptohomeAuthenticatorTest : public testing::Test {
public:
- ParallelAuthenticatorTest()
+ CryptohomeAuthenticatorTest()
: user_context_("me@nowhere.org"),
user_manager_(new FakeUserManager()),
user_manager_enabler_(user_manager_),
@@ -135,7 +133,7 @@ class ParallelAuthenticatorTest : public testing::Test {
FakeCryptohomeClient::GetStubSystemSalt()));
}
- virtual ~ParallelAuthenticatorTest() {}
+ virtual ~CryptohomeAuthenticatorTest() {}
virtual void SetUp() {
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kLoginManager);
@@ -153,7 +151,7 @@ class ParallelAuthenticatorTest : public testing::Test {
OwnerSettingsService::SetOwnerKeyUtilForTesting(owner_key_util_);
- auth_ = new ParallelAuthenticator(&consumer_);
+ auth_ = new ChromeCryptohomeAuthenticator(&consumer_);
state_.reset(new TestAttemptState(user_context_, false));
}
@@ -234,17 +232,18 @@ class ParallelAuthenticatorTest : public testing::Test {
.RetiresOnSaturation();
}
- void RunResolve(ParallelAuthenticator* auth) {
+ void RunResolve(CryptohomeAuthenticator* auth) {
auth->Resolve();
base::MessageLoop::current()->RunUntilIdle();
}
- void SetAttemptState(ParallelAuthenticator* auth, TestAttemptState* state) {
+ void SetAttemptState(CryptohomeAuthenticator* auth, TestAttemptState* state) {
auth->set_attempt_state(state);
}
- ParallelAuthenticator::AuthState SetAndResolveState(
- ParallelAuthenticator* auth, TestAttemptState* state) {
+ CryptohomeAuthenticator::AuthState SetAndResolveState(
+ CryptohomeAuthenticator* auth,
+ TestAttemptState* state) {
auth->set_attempt_state(state);
return auth->ResolveState();
}
@@ -270,14 +269,14 @@ class ParallelAuthenticatorTest : public testing::Test {
MockAuthStatusConsumer consumer_;
- scoped_refptr<ParallelAuthenticator> auth_;
+ scoped_refptr<CryptohomeAuthenticator> auth_;
scoped_ptr<TestAttemptState> state_;
FakeCryptohomeClient* fake_cryptohome_client_;
scoped_refptr<MockOwnerKeyUtil> owner_key_util_;
};
-TEST_F(ParallelAuthenticatorTest, OnAuthSuccess) {
+TEST_F(CryptohomeAuthenticatorTest, OnAuthSuccess) {
EXPECT_CALL(consumer_, OnAuthSuccess(user_context_))
.Times(1)
.RetiresOnSaturation();
@@ -286,7 +285,7 @@ TEST_F(ParallelAuthenticatorTest, OnAuthSuccess) {
auth_->OnAuthSuccess();
}
-TEST_F(ParallelAuthenticatorTest, OnPasswordChangeDetected) {
+TEST_F(CryptohomeAuthenticatorTest, OnPasswordChangeDetected) {
EXPECT_CALL(consumer_, OnPasswordChangeDetected())
.Times(1)
.RetiresOnSaturation();
@@ -294,34 +293,33 @@ TEST_F(ParallelAuthenticatorTest, OnPasswordChangeDetected) {
auth_->OnPasswordChangeDetected();
}
-TEST_F(ParallelAuthenticatorTest, ResolveNothingDone) {
- EXPECT_EQ(ParallelAuthenticator::CONTINUE,
+TEST_F(CryptohomeAuthenticatorTest, ResolveNothingDone) {
+ EXPECT_EQ(CryptohomeAuthenticator::CONTINUE,
SetAndResolveState(auth_.get(), state_.release()));
}
-
-TEST_F(ParallelAuthenticatorTest, ResolvePossiblePwChangeToFailedMount) {
+TEST_F(CryptohomeAuthenticatorTest, ResolvePossiblePwChangeToFailedMount) {
// Set up state as though a cryptohome mount attempt has occurred
// and been rejected.
state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE);
// When there is no online attempt and online results, POSSIBLE_PW_CHANGE
- EXPECT_EQ(ParallelAuthenticator::FAILED_MOUNT,
+ EXPECT_EQ(CryptohomeAuthenticator::FAILED_MOUNT,
SetAndResolveState(auth_.get(), state_.release()));
}
-TEST_F(ParallelAuthenticatorTest, ResolveNeedOldPw) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveNeedOldPw) {
// Set up state as though a cryptohome mount attempt has occurred
// and been rejected because of unmatched key; additionally,
// an online auth attempt has completed successfully.
state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE);
state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone());
- EXPECT_EQ(ParallelAuthenticator::NEED_OLD_PW,
+ EXPECT_EQ(CryptohomeAuthenticator::NEED_OLD_PW,
SetAndResolveState(auth_.get(), state_.release()));
}
-TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededDirectFailedMount) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededDirectFailedMount) {
// Set up state as though a cryptohome mount attempt has occurred
// and succeeded but we are in safe mode and the current user is not owner.
// This is a high level test to verify the proper transitioning in this mode
@@ -330,30 +328,30 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededDirectFailedMount) {
state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE);
SetOwnerState(true, false);
- EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED,
+ EXPECT_EQ(CryptohomeAuthenticator::OWNER_REQUIRED,
SetAndResolveState(auth_.get(), state_.release()));
}
-TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededMount) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededMount) {
// Set up state as though a cryptohome mount attempt has occurred
// and succeeded but we are in safe mode and the current user is not owner.
// This test will check that the "safe-mode" policy is not set and will let
// the mount finish successfully.
state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE);
SetOwnerState(false, false);
- EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN,
+ EXPECT_EQ(CryptohomeAuthenticator::OFFLINE_LOGIN,
SetAndResolveState(auth_.get(), state_.release()));
}
// Test the case that login switches to SafeMode and a User that is not the
// owner tries to log in. The login should fail because of the missing owner
// private key.
-TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededFailedMount) {
crypto::ScopedTestNSSChromeOSUser user_slot(user_context_.GetUserIDHash());
owner_key_util_->SetPublicKey(GetOwnerPublicKey());
profile_manager_.reset(
- new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
+ new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(profile_manager_->SetUp());
FailOnLoginSuccess(); // Set failing on success as the default...
@@ -378,7 +376,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) {
// to SAFE_MODE.
LoginState::Initialize();
- EXPECT_EQ(ParallelAuthenticator::CONTINUE,
+ EXPECT_EQ(CryptohomeAuthenticator::CONTINUE,
SetAndResolveState(auth_.get(), state_.release()));
EXPECT_TRUE(LoginState::Get()->IsInSafeMode());
@@ -391,7 +389,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) {
// The owner key util should not have found the owner key, so login should
// not be allowed.
- EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED,
+ EXPECT_EQ(CryptohomeAuthenticator::OWNER_REQUIRED,
SetAndResolveState(auth_.get(), state_.release()));
EXPECT_TRUE(LoginState::Get()->IsInSafeMode());
@@ -405,7 +403,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) {
// Test the case that login switches to SafeMode and the Owner logs in, which
// should lead to a successful login.
-TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededSuccess) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededSuccess) {
crypto::ScopedTestNSSChromeOSUser test_user_db(user_context_.GetUserIDHash());
owner_key_util_->SetPublicKey(GetOwnerPublicKey());
@@ -437,7 +435,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededSuccess) {
// to SAFE_MODE.
LoginState::Initialize();
- EXPECT_EQ(ParallelAuthenticator::CONTINUE,
+ EXPECT_EQ(CryptohomeAuthenticator::CONTINUE,
SetAndResolveState(auth_.get(), state_.release()));
EXPECT_TRUE(LoginState::Get()->IsInSafeMode());
@@ -449,7 +447,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededSuccess) {
state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE);
// The owner key util should find the owner key, so login should succeed.
- EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN,
+ EXPECT_EQ(CryptohomeAuthenticator::OFFLINE_LOGIN,
SetAndResolveState(auth_.get(), state_.release()));
EXPECT_TRUE(LoginState::Get()->IsInSafeMode());
@@ -461,7 +459,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededSuccess) {
CrosSettings::Get()->AddSettingsProvider(device_settings_provider);
}
-TEST_F(ParallelAuthenticatorTest, DriveFailedMount) {
+TEST_F(CryptohomeAuthenticatorTest, DriveFailedMount) {
FailOnLoginSuccess();
ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME));
@@ -473,67 +471,59 @@ TEST_F(ParallelAuthenticatorTest, DriveFailedMount) {
RunResolve(auth_.get());
}
-TEST_F(ParallelAuthenticatorTest, DriveGuestLogin) {
+TEST_F(CryptohomeAuthenticatorTest, DriveGuestLogin) {
ExpectGuestLoginSuccess();
FailOnLoginFailure();
// Set up mock async method caller to respond as though a tmpfs mount
// attempt has occurred and succeeded.
mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncMountGuest(_))
- .Times(1)
- .RetiresOnSaturation();
+ EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation();
auth_->LoginOffTheRecord();
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) {
+TEST_F(CryptohomeAuthenticatorTest, DriveGuestLoginButFail) {
FailOnGuestLoginSuccess();
ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_TMPFS));
// Set up mock async method caller to respond as though a tmpfs mount
// attempt has occurred and failed.
mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncMountGuest(_))
- .Times(1)
- .RetiresOnSaturation();
+ EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation();
auth_->LoginOffTheRecord();
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveRetailModeUserLogin) {
+TEST_F(CryptohomeAuthenticatorTest, DriveRetailModeUserLogin) {
ExpectRetailModeLoginSuccess();
FailOnLoginFailure();
// Set up mock async method caller to respond as though a tmpfs mount
// attempt has occurred and succeeded.
mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncMountGuest(_))
- .Times(1)
- .RetiresOnSaturation();
+ EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation();
auth_->LoginRetailMode();
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveRetailModeLoginButFail) {
+TEST_F(CryptohomeAuthenticatorTest, DriveRetailModeLoginButFail) {
FailOnRetailModeLoginSuccess();
ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_TMPFS));
// Set up mock async method caller to respond as though a tmpfs mount
// attempt has occurred and failed.
mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncMountGuest(_))
- .Times(1)
- .RetiresOnSaturation();
+ EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation();
auth_->LoginRetailMode();
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
+TEST_F(CryptohomeAuthenticatorTest, DriveDataResync) {
UserContext expected_user_context(user_context_);
expected_user_context.SetUserIDHash(
cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername);
@@ -547,10 +537,11 @@ TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
EXPECT_CALL(*mock_caller_, AsyncRemove(user_context_.GetUserID(), _))
.Times(1)
.RetiresOnSaturation();
- EXPECT_CALL(*mock_caller_, AsyncMount(user_context_.GetUserID(),
- transformed_key_.GetSecret(),
- cryptohome::CREATE_IF_MISSING,
- _))
+ EXPECT_CALL(*mock_caller_,
+ AsyncMount(user_context_.GetUserID(),
+ transformed_key_.GetSecret(),
+ cryptohome::CREATE_IF_MISSING,
+ _))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_caller_,
@@ -565,7 +556,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveResyncFail) {
+TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) {
FailOnLoginSuccess();
ExpectLoginFailure(AuthFailure(AuthFailure::DATA_REMOVAL_FAILED));
@@ -581,7 +572,7 @@ TEST_F(ParallelAuthenticatorTest, DriveResyncFail) {
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) {
+TEST_F(CryptohomeAuthenticatorTest, DriveRequestOldPassword) {
FailOnLoginSuccess();
ExpectPasswordChange();
@@ -592,7 +583,7 @@ TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) {
RunResolve(auth_.get());
}
-TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
+TEST_F(CryptohomeAuthenticatorTest, DriveDataRecover) {
UserContext expected_user_context(user_context_);
expected_user_context.SetUserIDHash(
cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername);
@@ -601,22 +592,23 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
// Set up mock async method caller to respond successfully to a key migration.
mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncMigrateKey(user_context_.GetUserID(),
- _,
- transformed_key_.GetSecret(),
- _))
+ EXPECT_CALL(
+ *mock_caller_,
+ AsyncMigrateKey(
+ user_context_.GetUserID(), _, transformed_key_.GetSecret(), _))
.Times(1)
.RetiresOnSaturation();
- EXPECT_CALL(*mock_caller_, AsyncMount(user_context_.GetUserID(),
- transformed_key_.GetSecret(),
- cryptohome::MOUNT_FLAGS_NONE,
- _))
+ EXPECT_CALL(*mock_caller_,
+ AsyncMount(user_context_.GetUserID(),
+ transformed_key_.GetSecret(),
+ cryptohome::MOUNT_FLAGS_NONE,
+ _))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_caller_,
AsyncGetSanitizedUsername(user_context_.GetUserID(), _))
- .Times(1)
- .RetiresOnSaturation();
+ .Times(1)
+ .RetiresOnSaturation();
state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone());
SetAttemptState(auth_.get(), state_.release());
@@ -625,17 +617,17 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) {
+TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) {
FailOnLoginSuccess();
ExpectPasswordChange();
// Set up mock async method caller to fail a key migration attempt,
// asserting that the wrong password was used.
mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_KEY_FAILURE);
- EXPECT_CALL(*mock_caller_, AsyncMigrateKey(user_context_.GetUserID(),
- _,
- transformed_key_.GetSecret(),
- _))
+ EXPECT_CALL(
+ *mock_caller_,
+ AsyncMigrateKey(
+ user_context_.GetUserID(), _, transformed_key_.GetSecret(), _))
.Times(1)
.RetiresOnSaturation();
@@ -645,7 +637,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) {
base::MessageLoop::current()->Run();
}
-TEST_F(ParallelAuthenticatorTest, ResolveNoMountToFailedMount) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveNoMountToFailedMount) {
// Set up state as though a cryptohome mount attempt has occurred
// and been rejected because the user doesn't exist.
state_->PresetCryptohomeStatus(false,
@@ -653,11 +645,11 @@ TEST_F(ParallelAuthenticatorTest, ResolveNoMountToFailedMount) {
// When there is no online attempt and online results, NO_MOUNT will be
// resolved to FAILED_MOUNT.
- EXPECT_EQ(ParallelAuthenticator::FAILED_MOUNT,
+ EXPECT_EQ(CryptohomeAuthenticator::FAILED_MOUNT,
SetAndResolveState(auth_.get(), state_.release()));
}
-TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) {
+TEST_F(CryptohomeAuthenticatorTest, ResolveCreateNew) {
// Set up state as though a cryptohome mount attempt has occurred
// and been rejected because the user doesn't exist; additionally,
// an online auth attempt has completed successfully.
@@ -665,11 +657,11 @@ TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) {
cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST);
state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone());
- EXPECT_EQ(ParallelAuthenticator::CREATE_NEW,
+ EXPECT_EQ(CryptohomeAuthenticator::CREATE_NEW,
SetAndResolveState(auth_.get(), state_.release()));
}
-TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
+TEST_F(CryptohomeAuthenticatorTest, DriveCreateForNewUser) {
UserContext expected_user_context(user_context_);
expected_user_context.SetUserIDHash(
cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername);
@@ -679,10 +671,11 @@ TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
// Set up mock async method caller to respond successfully to a cryptohome
// create attempt (indicated by the |CREATE_IF_MISSING| flag to AsyncMount).
mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncMount(user_context_.GetUserID(),
- transformed_key_.GetSecret(),
- cryptohome::CREATE_IF_MISSING,
- _))
+ EXPECT_CALL(*mock_caller_,
+ AsyncMount(user_context_.GetUserID(),
+ transformed_key_.GetSecret(),
+ cryptohome::CREATE_IF_MISSING,
+ _))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_caller_,
@@ -701,7 +694,7 @@ TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
RunResolve(auth_.get());
}
-TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) {
+TEST_F(CryptohomeAuthenticatorTest, DriveOfflineLogin) {
ExpectLoginSuccess(user_context_);
FailOnLoginFailure();
@@ -713,7 +706,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) {
RunResolve(auth_.get());
}
-TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
+TEST_F(CryptohomeAuthenticatorTest, DriveOnlineLogin) {
ExpectLoginSuccess(user_context_);
FailOnLoginFailure();
@@ -726,7 +719,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
RunResolve(auth_.get());
}
-TEST_F(ParallelAuthenticatorTest, DriveUnlock) {
+TEST_F(CryptohomeAuthenticatorTest, DriveUnlock) {
ExpectLoginSuccess(user_context_);
FailOnLoginFailure();

Powered by Google App Engine
This is Rietveld 408576698