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

Unified Diff: chrome/browser/chromeos/login/signin/oauth2_browsertest.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/signin/oauth2_browsertest.cc
diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
index b83bb0c22a8d2d137771d0e2220522dafb186334..3c224239332714891d3712c9497ff3cfbaffad00 100644
--- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
+++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
@@ -29,6 +29,7 @@
#include "chromeos/login/auth/user_context.h"
#include "components/app_modal/javascript_app_modal_dialog.h"
#include "components/app_modal/native_app_modal_dialog.h"
+#include "components/signin/core/account_id/account_id.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/user_manager/user.h"
@@ -197,7 +198,9 @@ class OAuth2Test : public OobeBaseTest {
user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
// Try login. Primary profile has changed.
- EXPECT_TRUE(TryToLogin(kTestGaiaId, kTestEmail, kTestAccountPassword));
+ EXPECT_TRUE(
+ TryToLogin(AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId),
+ kTestAccountPassword));
Profile* profile = ProfileManager::GetPrimaryUserProfile();
// Wait for the session merge to finish.
@@ -212,15 +215,13 @@ class OAuth2Test : public OobeBaseTest {
user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
}
- bool TryToLogin(const std::string& gaia_id,
- const std::string& username,
- const std::string& password) {
- if (!AddUserToSession(gaia_id, username, password))
+ bool TryToLogin(const AccountId& account_id, const std::string& password) {
+ if (!AddUserToSession(account_id, password))
return false;
if (const user_manager::User* active_user =
user_manager::UserManager::Get()->GetActiveUser()) {
- return active_user->email() == username;
+ return active_user->GetAccountId() == account_id;
}
return false;
@@ -251,8 +252,7 @@ class OAuth2Test : public OobeBaseTest {
return OobeBaseTest::profile();
}
- bool AddUserToSession(const std::string& gaia_id,
- const std::string& username,
+ bool AddUserToSession(const AccountId& account_id,
const std::string& password) {
ExistingUserController* controller =
ExistingUserController::current_controller();
@@ -261,8 +261,8 @@ class OAuth2Test : public OobeBaseTest {
return false;
}
- UserContext user_context(username);
- user_context.SetGaiaID(gaia_id);
+ UserContext user_context(account_id);
+ user_context.SetGaiaID(account_id.GetGaiaId());
user_context.SetKey(Key(password));
controller->Login(user_context, SigninSpecifics());
content::WindowedNotificationObserver(
@@ -273,7 +273,7 @@ class OAuth2Test : public OobeBaseTest {
for (user_manager::UserList::const_iterator it = logged_users.begin();
it != logged_users.end();
++it) {
- if ((*it)->email() == username)
+ if ((*it)->GetAccountId() == account_id)
return true;
}
return false;
@@ -494,7 +494,9 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, DISABLED_MergeSession) {
EXPECT_EQ(GetOAuthStatusFromLocalState(account_id),
user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
- EXPECT_TRUE(TryToLogin(kTestGaiaId, kTestEmail, kTestAccountPassword));
+ EXPECT_TRUE(
+ TryToLogin(AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId),
+ kTestAccountPassword));
// Wait for the session merge to finish.
WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_FAILED);

Powered by Google App Engine
This is Rietveld 408576698