0

Remove test-only code in UserManagerImpl::UserLoggedIn.

The case shouldn't happen in the production.
CHECK the condition, instead, and fix test cases.

BUG=278643115
TEST=tryjob

Change-Id: Ibb7a3654b133ab9d690275ba52a4b62c88faa86e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6206566
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412460}
This commit is contained in:
Hidehiko Abe
2025-01-28 11:49:43 -08:00
committed by Chromium LUCI CQ
parent f45e2828c4
commit 2d7f11d138

@ -383,18 +383,11 @@ void UserManagerImpl::UserLoggedIn(const AccountId& account_id,
logged_in_users_.push_back(active_user_.get());
SetLRUUser(active_user_);
if (!primary_user_) {
primary_user_ = active_user_;
delegate_->OverrideDirHome(*primary_user_);
if (primary_user_->HasGaiaAccount()) {
SendGaiaUserLoginMetrics(account_id);
}
} else if (primary_user_ != active_user_) {
// This is only needed for tests where a new user session is created
// for non-existent user. The new user is created and automatically set
// to active and there will be no pending user switch in such case.
SetIsCurrentUserNew(true);
NotifyUserAddedToSession(active_user_);
CHECK(!primary_user_);
primary_user_ = active_user_;
delegate_->OverrideDirHome(*primary_user_);
if (primary_user_->HasGaiaAccount()) {
SendGaiaUserLoginMetrics(account_id);
}
base::UmaHistogramEnumeration("UserManager.LoginUserType",