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

Unified Diff: chrome/browser/chromeos/login/signin/device_id_browsertest.cc

Issue 1425093004: Revert of 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: Created 5 years, 2 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/signin/device_id_browsertest.cc
diff --git a/chrome/browser/chromeos/login/signin/device_id_browsertest.cc b/chrome/browser/chromeos/login/signin/device_id_browsertest.cc
index ad33d485855736bf950d07b9e53e7dbaecd905f3..e210e9aabd651176d36ad3d19a9188d33602cbfd 100644
--- a/chrome/browser/chromeos/login/signin/device_id_browsertest.cc
+++ b/chrome/browser/chromeos/login/signin/device_id_browsertest.cc
@@ -57,14 +57,14 @@
OobeBaseTest::TearDownOnMainThread();
}
- std::string GetDeviceId(const AccountId& account_id) {
- return user_manager::UserManager::Get()->GetKnownUserDeviceId(account_id);
- }
-
- std::string GetDeviceIdFromSigninClient(const AccountId& account_id) {
+ std::string GetDeviceId(const std::string& user_id) {
+ return user_manager::UserManager::Get()->GetKnownUserDeviceId(user_id);
+ }
+
+ std::string GetDeviceIdFromSigninClient(const std::string& user_id) {
return ChromeSigninClientFactory::GetForProfile(
ProfileHelper::Get()->GetProfileByUser(
- user_manager::UserManager::Get()->FindUser(account_id)))
+ user_manager::UserManager::Get()->FindUser(user_id)))
->GetSigninScopedDeviceId();
}
@@ -76,11 +76,11 @@
// are the same.
// If |refresh_token| is not empty, checks that device ID associated with the
// |refresh_token| in GAIA is the same as ID saved on device.
- void CheckDeviceIDIsConsistent(const AccountId& account_id,
+ void CheckDeviceIDIsConsistent(const std::string& user_id,
const std::string& refresh_token) {
const std::string device_id_in_signin_client =
- GetDeviceIdFromSigninClient(account_id);
- const std::string device_id_in_local_state = GetDeviceId(account_id);
+ GetDeviceIdFromSigninClient(user_id);
+ const std::string device_id_in_local_state = GetDeviceId(user_id);
EXPECT_FALSE(device_id_in_signin_client.empty());
EXPECT_EQ(device_id_in_signin_client, device_id_in_local_state);
@@ -122,8 +122,8 @@
WaitForSessionStart();
}
- void RemoveUser(const AccountId& account_id) {
- user_manager::UserManager::Get()->RemoveUser(account_id, this);
+ void RemoveUser(const std::string& user_id) {
+ user_manager::UserManager::Get()->RemoveUser(user_id, this);
user_removal_loop_.Run();
}
@@ -176,39 +176,34 @@
IN_PROC_BROWSER_TEST_F(DeviceIDTest, PRE_PRE_PRE_PRE_PRE_NewUsers) {
SignInOnline(kFakeUserEmail, kFakeUserPassword, kRefreshToken1,
kFakeUserGaiaId);
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail),
- kRefreshToken1);
+ CheckDeviceIDIsConsistent(kFakeUserEmail, kRefreshToken1);
}
// Authenticate the first user through GAIA and verify that device ID remains
// the same.
IN_PROC_BROWSER_TEST_F(DeviceIDTest, PRE_PRE_PRE_PRE_NewUsers) {
- const std::string device_id =
- GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail));
+ const std::string device_id = GetDeviceId(kFakeUserEmail);
EXPECT_FALSE(device_id.empty());
EXPECT_EQ(device_id, GetDeviceIdFromGAIA(kRefreshToken1));
SignInOnline(kFakeUserEmail, kFakeUserPassword, kRefreshToken2,
kFakeUserGaiaId);
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail),
- kRefreshToken2);
-
- CHECK_EQ(device_id, GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)));
+ CheckDeviceIDIsConsistent(kFakeUserEmail, kRefreshToken2);
+
+ CHECK_EQ(device_id, GetDeviceId(kFakeUserEmail));
}
// Authenticate the first user offline and verify that device ID remains
// the same.
IN_PROC_BROWSER_TEST_F(DeviceIDTest, PRE_PRE_PRE_NewUsers) {
- const std::string device_id =
- GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail));
+ const std::string device_id = GetDeviceId(kFakeUserEmail);
EXPECT_FALSE(device_id.empty());
SignInOffline(kFakeUserEmail, kFakeUserPassword);
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail),
- kRefreshToken2);
+ CheckDeviceIDIsConsistent(kFakeUserEmail, kRefreshToken2);
// Verify that device ID remained the same after offline auth.
- CHECK_EQ(device_id, GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)));
+ CHECK_EQ(device_id, GetDeviceId(kFakeUserEmail));
}
// Add the second user.
@@ -217,25 +212,23 @@
JS().ExecuteAsync("chrome.send('showAddUser')");
SignInOnline(kSecondUserEmail, kSecondUserPassword, kSecondUserRefreshToken1,
kSecondUserGaiaId);
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kSecondUserEmail),
- kSecondUserRefreshToken1);
+ CheckDeviceIDIsConsistent(kSecondUserEmail, kSecondUserRefreshToken1);
}
// Remove the second user.
IN_PROC_BROWSER_TEST_F(DeviceIDTest, PRE_NewUsers) {
WaitForSigninScreen();
- RemoveUser(AccountId::FromUserEmail(kSecondUserEmail));
+ RemoveUser(kSecondUserEmail);
}
// Add the second user back. Verify that device ID has been changed.
IN_PROC_BROWSER_TEST_F(DeviceIDTest, NewUsers) {
- EXPECT_TRUE(GetDeviceId(AccountId::FromUserEmail(kSecondUserEmail)).empty());
+ EXPECT_TRUE(GetDeviceId(kSecondUserEmail).empty());
SignInOnline(kSecondUserEmail, kSecondUserPassword, kSecondUserRefreshToken2,
kSecondUserGaiaId);
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kSecondUserEmail),
- kSecondUserRefreshToken2);
+ CheckDeviceIDIsConsistent(kSecondUserEmail, kSecondUserRefreshToken2);
EXPECT_NE(GetDeviceIdFromGAIA(kSecondUserRefreshToken1),
- GetDeviceId(AccountId::FromUserEmail(kSecondUserEmail)));
+ GetDeviceId(kSecondUserEmail));
}
// Set up a user that has a device ID stored in preference only.
@@ -249,21 +242,20 @@
->GetProfileByUser(user_manager::UserManager::Get()->GetActiveUser())
->GetPrefs();
prefs->SetString(prefs::kGoogleServicesSigninScopedDeviceId,
- GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)));
+ GetDeviceId(kFakeUserEmail));
// Can't use SetKnownUserDeviceId here, because it forbids changing a device
// ID.
user_manager::UserManager::Get()->SetKnownUserStringPref(
- AccountId::FromUserEmail(kFakeUserEmail), "device_id", std::string());
+ kFakeUserEmail, "device_id", std::string());
}
// Tests that after the first sign in the device ID has been moved to the Local
// state.
IN_PROC_BROWSER_TEST_F(DeviceIDTest, Migration) {
- EXPECT_TRUE(GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)).empty());
+ EXPECT_TRUE(GetDeviceId(kFakeUserEmail).empty());
SignInOffline(kFakeUserEmail, kFakeUserPassword);
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail),
- kRefreshToken1);
+ CheckDeviceIDIsConsistent(kFakeUserEmail, kRefreshToken1);
}
// Set up a user that doesn't have a device ID.
@@ -281,17 +273,16 @@
// Can't use SetKnownUserDeviceId here, because it forbids changing a device
// ID.
user_manager::UserManager::Get()->SetKnownUserStringPref(
- AccountId::FromUserEmail(kFakeUserEmail), "device_id", std::string());
+ kFakeUserEmail, "device_id", std::string());
}
// Tests that device ID has been generated after the first sign in.
IN_PROC_BROWSER_TEST_F(DeviceIDTest, LegacyUsers) {
- EXPECT_TRUE(GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)).empty());
+ EXPECT_TRUE(GetDeviceId(kFakeUserEmail).empty());
SignInOffline(kFakeUserEmail, kFakeUserPassword);
// Last param |auth_code| is empty, because we don't pass a device ID to GAIA
// in this case.
- CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail),
- std::string());
+ CheckDeviceIDIsConsistent(kFakeUserEmail, std::string());
}
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/signin/auth_sync_observer.cc ('k') | chrome/browser/chromeos/login/signin/oauth2_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698