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

Unified Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.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/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
index 4faee0cd42fcba4569b21326fbf7703002cc4c3f..7cf0ea87e2906a2906237670b3538957f4c84a25 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
@@ -55,9 +55,9 @@
const user_manager::UserManager* user_manager =
user_manager::UserManager::Get();
const user_manager::User* active_user = user_manager->GetActiveUser();
- return active_user ? multi_user_util::GetProfileFromUserID(
- active_user->GetAccountId().GetUserEmail())
- : NULL;
+ return active_user
+ ? multi_user_util::GetProfileFromUserID(active_user->GetUserID())
+ : NULL;
}
content::BrowserContext* GetBrowserContextByIndex(
@@ -158,9 +158,8 @@
TestingProfileManager* profile_manager() { return profile_manager_.get(); }
const user_manager::User* AddTestUser(const std::string& user_email) {
- const user_manager::User* user =
- fake_user_manager_->AddUser(AccountId::FromUserEmail(user_email));
- fake_user_manager_->LoginUser(AccountId::FromUserEmail(user_email));
+ const user_manager::User* user = fake_user_manager_->AddUser(user_email);
+ fake_user_manager_->LoginUser(user_email);
session_state_delegate_->AddUser(user_email);
TestingProfile* profile =
profile_manager()->CreateTestingProfile(user_email);
@@ -199,13 +198,12 @@
// The test session state observer does not automatically call the window
// manager. This function gets the current user from it and also sets it to
// the multi user window manager.
- AccountId GetAndValidateCurrentUserFromSessionStateObserver() {
- const AccountId account_id =
- session_state_delegate()->GetActiveUserInfo()->GetAccountId();
- if (account_id.GetUserEmail() !=
- multi_user_window_manager_->GetCurrentUserForTest())
- multi_user_window_manager()->ActiveUserChanged(account_id.GetUserEmail());
- return account_id;
+ std::string GetAndValidateCurrentUserFromSessionStateObserver() {
+ const std::string& user =
+ session_state_delegate()->GetActiveUserInfo()->GetUserID();
+ if (user != multi_user_window_manager_->GetCurrentUserForTest())
+ multi_user_window_manager()->ActiveUserChanged(user);
+ return user;
}
// Initiate a user transition.
@@ -798,17 +796,11 @@
// Making the window system modal should not change anything.
MakeWindowSystemModal(window(0));
- EXPECT_EQ("a", session_state_delegate()
- ->GetActiveUserInfo()
- ->GetAccountId()
- .GetUserEmail());
+ EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID());
// Making the window owned by user B should switch users.
multi_user_window_manager()->SetWindowOwner(window(0), "b");
- EXPECT_EQ("b", session_state_delegate()
- ->GetActiveUserInfo()
- ->GetAccountId()
- .GetUserEmail());
+ EXPECT_EQ("b", session_state_delegate()->GetActiveUserInfo()->GetUserID());
}
// Test that a system modal dialog will not switch desktop if active user has
@@ -819,17 +811,11 @@
// Making the window system modal should not change anything.
MakeWindowSystemModal(window(0));
- EXPECT_EQ("a", session_state_delegate()
- ->GetActiveUserInfo()
- ->GetAccountId()
- .GetUserEmail());
+ EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID());
// Making the window owned by user a should not switch users.
multi_user_window_manager()->SetWindowOwner(window(0), "a");
- EXPECT_EQ("a", session_state_delegate()
- ->GetActiveUserInfo()
- ->GetAccountId()
- .GetUserEmail());
+ EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID());
}
// Test that a system modal dialog will not switch if shown on correct desktop
@@ -845,10 +831,7 @@
MakeWindowSystemModal(window(0));
// Showing the window should trigger no user switch.
window(0)->Show();
- EXPECT_EQ("a", session_state_delegate()
- ->GetActiveUserInfo()
- ->GetAccountId()
- .GetUserEmail());
+ EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID());
}
// Test that a system modal dialog will switch if shown on incorrect desktop but
@@ -864,10 +847,7 @@
MakeWindowSystemModal(window(0));
// Showing the window should trigger a user switch.
window(0)->Show();
- EXPECT_EQ("b", session_state_delegate()
- ->GetActiveUserInfo()
- ->GetAccountId()
- .GetUserEmail());
+ EXPECT_EQ("b", session_state_delegate()->GetActiveUserInfo()->GetUserID());
}
// Test that using the full user switch animations are working as expected.
@@ -1149,31 +1129,26 @@
EXPECT_EQ("S[a], H[b], H[c]", GetStatus());
// SetWindowOwner should not have changed the active user.
- EXPECT_EQ("a",
- GetAndValidateCurrentUserFromSessionStateObserver().GetUserEmail());
+ EXPECT_EQ("a", GetAndValidateCurrentUserFromSessionStateObserver());
// Check that teleporting the window of the currently active user will
// teleport to the new desktop.
multi_user_window_manager()->ShowWindowForUser(window(0), "b");
- EXPECT_EQ("b",
- GetAndValidateCurrentUserFromSessionStateObserver().GetUserEmail());
+ EXPECT_EQ("b", GetAndValidateCurrentUserFromSessionStateObserver());
EXPECT_EQ("S[a,b], S[b], H[c]", GetStatus());
// Check that teleporting a window from a currently inactive user will not
// trigger a switch.
multi_user_window_manager()->ShowWindowForUser(window(2), "a");
- EXPECT_EQ("b",
- GetAndValidateCurrentUserFromSessionStateObserver().GetUserEmail());
+ EXPECT_EQ("b", GetAndValidateCurrentUserFromSessionStateObserver());
EXPECT_EQ("S[a,b], S[b], H[c,a]", GetStatus());
multi_user_window_manager()->ShowWindowForUser(window(2), "b");
- EXPECT_EQ("b",
- GetAndValidateCurrentUserFromSessionStateObserver().GetUserEmail());
+ EXPECT_EQ("b", GetAndValidateCurrentUserFromSessionStateObserver());
EXPECT_EQ("S[a,b], S[b], S[c,b]", GetStatus());
// Check that teleporting back will also change the desktop.
multi_user_window_manager()->ShowWindowForUser(window(2), "c");
- EXPECT_EQ("c",
- GetAndValidateCurrentUserFromSessionStateObserver().GetUserEmail());
+ EXPECT_EQ("c", GetAndValidateCurrentUserFromSessionStateObserver());
EXPECT_EQ("H[a,b], H[b], S[c]", GetStatus());
}
@@ -1329,7 +1304,7 @@
wm::GetWindowState(window(2))->Minimize();
// Windows belonging to user2 (window #2 and #3) can't be activated by user1.
- user_manager()->SwitchActiveUser(AccountId::FromUserEmail(user1));
+ user_manager()->SwitchActiveUser(user1);
multi_user_window_manager()->ActiveUserChanged(user1);
EXPECT_TRUE(::wm::CanActivateWindow(window(0)));
EXPECT_TRUE(::wm::CanActivateWindow(window(1)));
@@ -1337,7 +1312,7 @@
EXPECT_FALSE(::wm::CanActivateWindow(window(3)));
// Windows belonging to user1 (window #0 and #1) can't be activated by user2.
- user_manager()->SwitchActiveUser(AccountId::FromUserEmail(user2));
+ user_manager()->SwitchActiveUser(user2);
multi_user_window_manager()->ActiveUserChanged(user2);
EXPECT_FALSE(::wm::CanActivateWindow(window(0)));
EXPECT_FALSE(::wm::CanActivateWindow(window(1)));
@@ -1358,7 +1333,7 @@
multi_user_window_manager()->SetWindowOwner(window(0), user1);
multi_user_window_manager()->SetWindowOwner(window(1), user2);
- user_manager()->SwitchActiveUser(AccountId::FromUserEmail(user1));
+ user_manager()->SwitchActiveUser(user1);
multi_user_window_manager()->ActiveUserChanged(user1);
EXPECT_TRUE(::wm::CanActivateWindow(window(0)));
EXPECT_FALSE(::wm::CanActivateWindow(window(1)));
@@ -1369,7 +1344,7 @@
EXPECT_FALSE(::wm::CanActivateWindow(window(0)));
// Test that window #0 can be activated by user2.
- user_manager()->SwitchActiveUser(AccountId::FromUserEmail(user2));
+ user_manager()->SwitchActiveUser(user2);
multi_user_window_manager()->ActiveUserChanged(user2);
EXPECT_TRUE(::wm::CanActivateWindow(window(0)));
EXPECT_TRUE(::wm::CanActivateWindow(window(1)));

Powered by Google App Engine
This is Rietveld 408576698