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

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

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Fix Win GN build. Created 5 years, 1 month 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/cryptohome_authenticator_unittest.cc b/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
index c96e922adc1e9bbe568c771d455df5158bd22dd5..9a5385f43352ff53a0b7f3ea7cc2122fb0afa4b9 100644
--- a/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
@@ -131,7 +131,7 @@ bool CreateOwnerKeyInSlot(PK11SlotInfo* slot) {
class CryptohomeAuthenticatorTest : public testing::Test {
public:
CryptohomeAuthenticatorTest()
- : user_context_("me@nowhere.org"),
+ : user_context_(AccountId::FromUserEmail("me@nowhere.org")),
user_manager_(new user_manager::FakeUserManager()),
user_manager_enabler_(user_manager_),
mock_caller_(NULL),
@@ -142,8 +142,8 @@ class CryptohomeAuthenticatorTest : public testing::Test {
user_context_.SetKey(Key("fakepass"));
user_context_.SetUserIDHash("me_nowhere_com_hash");
const user_manager::User* user =
- user_manager_->AddUser(user_context_.GetUserID());
- profile_.set_profile_name(user_context_.GetUserID());
+ user_manager_->AddUser(user_context_.GetAccountId());
+ profile_.set_profile_name(user_context_.GetAccountId().GetUserEmail());
ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, &profile_);
@@ -264,13 +264,12 @@ class CryptohomeAuthenticatorTest : public testing::Test {
cryptohome::KeyDefinition::ProviderData("salt"));
key_definition.provider_data.back().bytes = salt.Pass();
}
- EXPECT_CALL(*mock_homedir_methods_, GetKeyDataEx(
- cryptohome::Identification(user_context_.GetUserID()),
- kCryptohomeGAIAKeyLabel,
- _))
+ EXPECT_CALL(*mock_homedir_methods_,
+ GetKeyDataEx(cryptohome::Identification(
+ user_context_.GetAccountId().GetUserEmail()),
+ kCryptohomeGAIAKeyLabel, _))
.WillOnce(WithArg<2>(Invoke(
- this,
- &CryptohomeAuthenticatorTest::InvokeGetDataExCallback)));
+ this, &CryptohomeAuthenticatorTest::InvokeGetDataExCallback)));
}
void ExpectMountExCall(bool expect_create_attempt) {
@@ -285,10 +284,9 @@ class CryptohomeAuthenticatorTest : public testing::Test {
cryptohome::PRIV_DEFAULT));
}
EXPECT_CALL(*mock_homedir_methods_,
- MountEx(cryptohome::Identification(user_context_.GetUserID()),
- cryptohome::Authorization(auth_key),
- mount,
- _))
+ MountEx(cryptohome::Identification(
+ user_context_.GetAccountId().GetUserEmail()),
+ cryptohome::Authorization(auth_key), mount, _))
.Times(1)
.RetiresOnSaturation();
}
@@ -562,7 +560,8 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataResync) {
// Set up mock async method caller to respond successfully to a cryptohome
// remove attempt.
mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncRemove(user_context_.GetUserID(), _))
+ EXPECT_CALL(*mock_caller_,
+ AsyncRemove(user_context_.GetAccountId().GetUserEmail(), _))
.Times(1)
.RetiresOnSaturation();
@@ -584,7 +583,8 @@ TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) {
// Set up mock async method caller to fail a cryptohome remove attempt.
mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncRemove(user_context_.GetUserID(), _))
+ EXPECT_CALL(*mock_caller_,
+ AsyncRemove(user_context_.GetAccountId().GetUserEmail(), _))
.Times(1)
.RetiresOnSaturation();
@@ -614,10 +614,9 @@ TEST_F(CryptohomeAuthenticatorTest, 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_.GetAccountId().GetUserEmail(), _,
+ transformed_key_.GetSecret(), _))
.Times(1)
.RetiresOnSaturation();
@@ -640,10 +639,9 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) {
// 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_.GetAccountId().GetUserEmail(), _,
+ transformed_key_.GetSecret(), _))
.Times(1)
.RetiresOnSaturation();
@@ -732,7 +730,8 @@ TEST_F(CryptohomeAuthenticatorTest, DriveUnlock) {
// Set up mock async method caller to respond successfully to a cryptohome
// key-check attempt.
mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE);
- EXPECT_CALL(*mock_caller_, AsyncCheckKey(user_context_.GetUserID(), _, _))
+ EXPECT_CALL(*mock_caller_,
+ AsyncCheckKey(user_context_.GetAccountId().GetUserEmail(), _, _))
.Times(1)
.RetiresOnSaturation();

Powered by Google App Engine
This is Rietveld 408576698