Commit e787f908 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: update current_account_id_ when user switch happens

This got lost in the refactoring. Added test coverage.

BUG=756085,875111
TEST=covered by test

Change-Id: I1b9bbc78b2657a1378b55542786b88f8911a4b9e
Reviewed-on: https://chromium-review.googlesource.com/c/1351144Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611899}
parent c2227ae1
......@@ -258,6 +258,9 @@ void MultiUserWindowManager::OnActiveUserSessionChanged(
// This needs to be set before the animation starts.
current_account_id_ = account_id;
if (delegate_)
delegate_->OnWillSwitchActiveAccount(current_account_id_);
// Here to avoid a very nasty race condition, we must destruct any previously
// created animation before creating a new one. Otherwise, the newly
// constructed will hide all windows of the old user in the first step of the
......
......@@ -1589,6 +1589,20 @@ TEST_F(MultiUserWindowManagerChromeOSTest, WindowBoundsAfterTabletMode) {
EXPECT_EQ(bounds, window(1)->bounds());
}
TEST_F(MultiUserWindowManagerChromeOSTest, AccountIdChangesAfterSwitch) {
SetUpForThisManyWindows(1);
const AccountId account1(AccountId::FromUserEmail("A"));
const AccountId account2(AccountId::FromUserEmail("B"));
AddTestUser(account1);
AddTestUser(account2);
SwitchActiveUser(account1);
EXPECT_EQ(account1, multi_user_window_manager()->GetCurrentUserForTest());
SwitchActiveUser(account2);
EXPECT_EQ(account2, multi_user_window_manager()->GetCurrentUserForTest());
}
class MultiUserWindowManagerChromeOSMashTest
: public MultiUserWindowManagerChromeOSTest {
public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment