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

Unified Diff: chrome/browser/signin/signin_manager_unittest.cc

Issue 1166373006: Prefer to use the AccountID to the Email from ListAccounts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 6 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/signin/signin_manager_unittest.cc
diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc
index 68a4c3b7179883ee78b882c86cf52fbe096e9c56..978198ba9055ffeeb68014ff47d8550311b370fb 100644
--- a/chrome/browser/signin/signin_manager_unittest.cc
+++ b/chrome/browser/signin/signin_manager_unittest.cc
@@ -444,3 +444,27 @@ TEST_F(SigninManagerTest, UpgradeToNewPrefs) {
EXPECT_EQ("user@gmail.com", info.email);
EXPECT_EQ("account_id", info.gaia);
}
+
+TEST_F(SigninManagerTest, CanonicalizesPrefs) {
+ profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
+ "user.C@gmail.com");
+ CreateNakedSigninManager();
+ manager_->Initialize(g_browser_process->local_state());
+ EXPECT_EQ("user.C@gmail.com", manager_->GetAuthenticatedUsername());
+
+ // TODO(rogerta): until the migration to gaia id, the account id will remain
+ // the old username.
+ EXPECT_EQ("userc@gmail.com", manager_->GetAuthenticatedAccountId());
+ EXPECT_EQ("userc@gmail.com",
+ profile()->GetPrefs()->GetString(prefs::kGoogleServicesAccountId));
+ EXPECT_EQ("",
+ profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername));
+
+ // Make sure account tracker has a canonicalized username.
+ AccountTrackerService* service =
+ AccountTrackerServiceFactory::GetForProfile(profile());
+ AccountTrackerService::AccountInfo info = service->GetAccountInfo(
+ manager_->GetAuthenticatedAccountId());
+ EXPECT_EQ("user.C@gmail.com", info.email);
+ EXPECT_EQ("userc@gmail.com", info.account_id);
+}

Powered by Google App Engine
This is Rietveld 408576698