| Index: chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc
|
| diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc
|
| index ff3e942f9201f8f32eb6e53aa4392c7a30350d28..16843b7cf6e5528b8d84ef9efb9c21077b1d59bc 100644
|
| --- a/chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc
|
| +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc
|
| @@ -15,7 +15,6 @@
|
| #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
|
| #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
|
| #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
|
| -#include "components/signin/core/account_id/account_id.h"
|
| #include "ui/aura/test/test_windows.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| @@ -34,9 +33,6 @@
|
|
|
| protected:
|
| FakeChromeUserManager* fake_user_manager() { return fake_user_manager_; }
|
| -
|
| - const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestAccount1);
|
| - const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestAccount2);
|
|
|
| private:
|
| FakeChromeUserManager* fake_user_manager_;
|
| @@ -73,7 +69,7 @@
|
| } // namespace
|
|
|
| TEST_F(WallpaperPrivateApiUnittest, HideAndRestoreWindows) {
|
| - fake_user_manager()->AddUser(test_account_id1_);
|
| + fake_user_manager()->AddUser(kTestAccount1);
|
| scoped_ptr<aura::Window> window4(CreateTestWindowInShellWithId(4));
|
| scoped_ptr<aura::Window> window3(CreateTestWindowInShellWithId(3));
|
| scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(2));
|
| @@ -136,7 +132,7 @@
|
| // 2. If some windows are manually unminimized, the following call will minimize
|
| // all the unminimized windows.
|
| TEST_F(WallpaperPrivateApiUnittest, HideAndManualUnminimizeWindows) {
|
| - fake_user_manager()->AddUser(test_account_id1_);
|
| + fake_user_manager()->AddUser(kTestAccount1);
|
| scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
|
| scoped_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0));
|
|
|
| @@ -200,10 +196,10 @@
|
|
|
| protected:
|
| void SetUpMultiUserWindowManager(
|
| - const AccountId& active_account_id,
|
| + const std::string& active_user_id,
|
| chrome::MultiUserWindowManager::MultiProfileMode mode);
|
|
|
| - void SwitchActiveUser(const AccountId& active_account_id);
|
| + void SwitchActiveUser(const std::string& active_user_id);
|
|
|
| chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager() {
|
| return multi_user_window_manager_;
|
| @@ -222,8 +218,8 @@
|
| session_state_delegate_ =
|
| static_cast<ash::test::TestSessionStateDelegate*> (
|
| ash::Shell::GetInstance()->session_state_delegate());
|
| - fake_user_manager()->AddUser(test_account_id1_);
|
| - fake_user_manager()->AddUser(test_account_id2_);
|
| + fake_user_manager()->AddUser(kTestAccount1);
|
| + fake_user_manager()->AddUser(kTestAccount2);
|
| }
|
|
|
| void WallpaperPrivateApiMultiUserUnittest::TearDown() {
|
| @@ -233,10 +229,10 @@
|
| }
|
|
|
| void WallpaperPrivateApiMultiUserUnittest::SetUpMultiUserWindowManager(
|
| - const AccountId& active_account_id,
|
| + const std::string& active_user_id,
|
| chrome::MultiUserWindowManager::MultiProfileMode mode) {
|
| - multi_user_window_manager_ = new chrome::MultiUserWindowManagerChromeOS(
|
| - active_account_id.GetUserEmail());
|
| + multi_user_window_manager_ =
|
| + new chrome::MultiUserWindowManagerChromeOS(active_user_id);
|
| multi_user_window_manager_->Init();
|
| chrome::MultiUserWindowManager::SetInstanceForTest(
|
| multi_user_window_manager_, mode);
|
| @@ -247,18 +243,16 @@
|
| }
|
|
|
| void WallpaperPrivateApiMultiUserUnittest::SwitchActiveUser(
|
| - const AccountId& active_account_id) {
|
| - fake_user_manager()->SwitchActiveUser(active_account_id);
|
| - multi_user_window_manager_->ActiveUserChanged(
|
| - active_account_id.GetUserEmail());
|
| + const std::string& active_user_id) {
|
| + fake_user_manager()->SwitchActiveUser(active_user_id);
|
| + multi_user_window_manager_->ActiveUserChanged(active_user_id);
|
| }
|
|
|
| // In multi profile mode, user may open wallpaper picker in one profile and
|
| // then switch to a different profile and open another wallpaper picker
|
| // without closing the first one.
|
| TEST_F(WallpaperPrivateApiMultiUserUnittest, HideAndRestoreWindowsTwoUsers) {
|
| - SetUpMultiUserWindowManager(
|
| - test_account_id1_,
|
| + SetUpMultiUserWindowManager(kTestAccount1,
|
| chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED);
|
|
|
| scoped_ptr<aura::Window> window4(CreateTestWindowInShellWithId(4));
|
| @@ -273,18 +267,13 @@
|
| ash::wm::WindowState* window3_state = ash::wm::GetWindowState(window3.get());
|
| ash::wm::WindowState* window4_state = ash::wm::GetWindowState(window4.get());
|
|
|
| - multi_user_window_manager()->SetWindowOwner(window0.get(),
|
| - test_account_id1_.GetUserEmail());
|
| - multi_user_window_manager()->SetWindowOwner(window1.get(),
|
| - test_account_id1_.GetUserEmail());
|
| + multi_user_window_manager()->SetWindowOwner(window0.get(), kTestAccount1);
|
| + multi_user_window_manager()->SetWindowOwner(window1.get(), kTestAccount1);
|
|
|
| // Set some windows to an inactive owner.
|
| - multi_user_window_manager()->SetWindowOwner(window2.get(),
|
| - test_account_id2_.GetUserEmail());
|
| - multi_user_window_manager()->SetWindowOwner(window3.get(),
|
| - test_account_id2_.GetUserEmail());
|
| - multi_user_window_manager()->SetWindowOwner(window4.get(),
|
| - test_account_id2_.GetUserEmail());
|
| + multi_user_window_manager()->SetWindowOwner(window2.get(), kTestAccount2);
|
| + multi_user_window_manager()->SetWindowOwner(window3.get(), kTestAccount2);
|
| + multi_user_window_manager()->SetWindowOwner(window4.get(), kTestAccount2);
|
|
|
| EXPECT_FALSE(window0_state->IsMinimized());
|
| EXPECT_FALSE(window1_state->IsMinimized());
|
| @@ -310,7 +299,7 @@
|
| EXPECT_FALSE(window4_state->IsMinimized());
|
|
|
| // Activate kTestAccount2. kTestAccount1 becomes inactive user.
|
| - SwitchActiveUser(test_account_id2_);
|
| + SwitchActiveUser(kTestAccount2);
|
|
|
| window2_state->Activate();
|
| EXPECT_TRUE(window2_state->IsActive());
|
| @@ -348,7 +337,7 @@
|
| EXPECT_FALSE(window0_state->IsMinimized());
|
| EXPECT_TRUE(window1_state->IsMinimized());
|
|
|
| - SwitchActiveUser(test_account_id1_);
|
| + SwitchActiveUser(kTestAccount1);
|
|
|
| // Then we destroy window 0 and call the restore function.
|
| window0.reset();
|
| @@ -363,8 +352,7 @@
|
| // In multi profile mode, user may teleport windows. Teleported window should
|
| // also be minimized when open wallpaper picker.
|
| TEST_F(WallpaperPrivateApiMultiUserUnittest, HideTeleportedWindow) {
|
| - SetUpMultiUserWindowManager(
|
| - AccountId::FromUserEmail(kTestAccount1),
|
| + SetUpMultiUserWindowManager(kTestAccount1,
|
| chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_MIXED);
|
|
|
| scoped_ptr<aura::Window> window3(CreateTestWindowInShellWithId(3));
|
| @@ -377,20 +365,15 @@
|
| ash::wm::WindowState* window2_state = ash::wm::GetWindowState(window2.get());
|
| ash::wm::WindowState* window3_state = ash::wm::GetWindowState(window3.get());
|
|
|
| - multi_user_window_manager()->SetWindowOwner(window0.get(),
|
| - test_account_id1_.GetUserEmail());
|
| - multi_user_window_manager()->SetWindowOwner(window1.get(),
|
| - test_account_id1_.GetUserEmail());
|
| + multi_user_window_manager()->SetWindowOwner(window0.get(), kTestAccount1);
|
| + multi_user_window_manager()->SetWindowOwner(window1.get(), kTestAccount1);
|
|
|
| // Set some windows to an inactive owner.
|
| - multi_user_window_manager()->SetWindowOwner(window2.get(),
|
| - test_account_id2_.GetUserEmail());
|
| - multi_user_window_manager()->SetWindowOwner(window3.get(),
|
| - test_account_id2_.GetUserEmail());
|
| + multi_user_window_manager()->SetWindowOwner(window2.get(), kTestAccount2);
|
| + multi_user_window_manager()->SetWindowOwner(window3.get(), kTestAccount2);
|
|
|
| // Teleport window2 to kTestAccount1.
|
| - multi_user_window_manager()->ShowWindowForUser(
|
| - window2.get(), test_account_id1_.GetUserEmail());
|
| + multi_user_window_manager()->ShowWindowForUser(window2.get(), kTestAccount1);
|
|
|
| // Initial window state. All windows shouldn't be minimized.
|
| EXPECT_FALSE(window0_state->IsMinimized());
|
|
|