| Index: chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc
|
| diff --git a/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc
|
| index c4a166587ec4b2bd370feebef85a3033b0e004ad..9ba0898a33bd19678c58334abbe79691700d4ca4 100644
|
| --- a/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc
|
| +++ b/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc
|
| @@ -3,10 +3,8 @@
|
| // found in the LICENSE file.
|
|
|
| #include "ash/common/system/system_notifier.h"
|
| -#include "ash/common/test/test_session_state_delegate.h"
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/test/ash_test_base.h"
|
| -#include "ash/test/ash_test_helper.h"
|
| #include "ash/test/test_shell_delegate.h"
|
| #include "base/macros.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| @@ -18,7 +16,6 @@
|
| #include "chrome/test/base/testing_browser_process.h"
|
| #include "chrome/test/base/testing_profile_manager.h"
|
| #include "components/signin/core/account_id/account_id.h"
|
| -#include "components/user_manager/user_info.h"
|
| #include "ui/message_center/message_center.h"
|
| #include "ui/message_center/notification.h"
|
|
|
| @@ -32,7 +29,8 @@ class MultiUserNotificationBlockerChromeOSTest
|
| : state_changed_count_(0),
|
| testing_profile_manager_(TestingBrowserProcess::GetGlobal()),
|
| window_id_(0),
|
| - user_manager_enabler_(new chromeos::FakeChromeUserManager) {}
|
| + fake_user_manager_(new chromeos::FakeChromeUserManager),
|
| + user_manager_enabler_(fake_user_manager_) {}
|
| ~MultiUserNotificationBlockerChromeOSTest() override {}
|
|
|
| // ash::test::AshTestBase overrides:
|
| @@ -42,6 +40,7 @@ class MultiUserNotificationBlockerChromeOSTest
|
|
|
| // MultiUserWindowManager is initialized after the log in.
|
| testing_profile_manager_.CreateTestingProfile(GetDefaultUserId());
|
| + fake_user_manager_->AddUser(AccountId::FromUserEmail(GetDefaultUserId()));
|
|
|
| ash::test::TestShellDelegate* shell_delegate =
|
| static_cast<ash::test::TestShellDelegate*>(
|
| @@ -49,8 +48,9 @@ class MultiUserNotificationBlockerChromeOSTest
|
| shell_delegate->set_multi_profiles_enabled(true);
|
| chrome::MultiUserWindowManager::CreateInstance();
|
|
|
| - ash::test::AshTestHelper::GetTestSessionStateDelegate()->AddUser(
|
| - AccountId::FromUserEmail("test2@example.com"));
|
| + const AccountId test2_account_id =
|
| + AccountId::FromUserEmail("test2@example.com");
|
| + fake_user_manager_->AddUser(test2_account_id);
|
|
|
| chromeos::WallpaperManager::Initialize();
|
|
|
| @@ -80,12 +80,7 @@ class MultiUserNotificationBlockerChromeOSTest
|
| chrome::MultiUserWindowManager::GetInstance());
|
| }
|
|
|
| - const std::string GetDefaultUserId() {
|
| - return ash::test::AshTestHelper::GetTestSessionStateDelegate()
|
| - ->GetUserInfo(0)
|
| - ->GetAccountId()
|
| - .GetUserEmail();
|
| - }
|
| + const std::string GetDefaultUserId() { return "test1@example.com"; }
|
|
|
| const message_center::NotificationBlocker* blocker() {
|
| return GetMultiUserWindowManager()->notification_blocker_.get();
|
| @@ -97,13 +92,11 @@ class MultiUserNotificationBlockerChromeOSTest
|
|
|
| void SwitchActiveUser(const std::string& name) {
|
| const AccountId account_id(AccountId::FromUserEmail(name));
|
| - ash::test::AshTestHelper::GetTestSessionStateDelegate()
|
| - ->SwitchActiveUser(account_id);
|
| if (chrome::MultiUserWindowManager::GetMultiProfileMode() ==
|
| chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) {
|
| static_cast<chrome::MultiUserWindowManagerChromeOS*>(
|
| chrome::MultiUserWindowManager::GetInstance())
|
| - ->ActiveUserChanged(account_id);
|
| + ->ActiveUserChanged(fake_user_manager_->FindUser(account_id));
|
| }
|
| }
|
|
|
| @@ -123,7 +116,7 @@ class MultiUserNotificationBlockerChromeOSTest
|
| message_center::NOTIFICATION_TYPE_SIMPLE, "popup-id",
|
| UTF8ToUTF16("popup-title"), UTF8ToUTF16("popup-message"), gfx::Image(),
|
| UTF8ToUTF16("popup-source"), GURL(), id_with_profile,
|
| - message_center::RichNotificationData(), NULL);
|
| + message_center::RichNotificationData(), nullptr);
|
|
|
| return blocker()->ShouldShowNotificationAsPopup(notification);
|
| }
|
| @@ -138,7 +131,7 @@ class MultiUserNotificationBlockerChromeOSTest
|
| message_center::NOTIFICATION_TYPE_SIMPLE, "notification-id",
|
| UTF8ToUTF16("notification-title"), UTF8ToUTF16("notification-message"),
|
| gfx::Image(), UTF8ToUTF16("notification-source"), GURL(),
|
| - id_with_profile, message_center::RichNotificationData(), NULL);
|
| + id_with_profile, message_center::RichNotificationData(), nullptr);
|
|
|
| return blocker()->ShouldShowNotification(notification);
|
| }
|
| @@ -155,6 +148,8 @@ class MultiUserNotificationBlockerChromeOSTest
|
| TestingProfileManager testing_profile_manager_;
|
| int window_id_;
|
|
|
| + // Owned by ScopedUserManagerEnabler.
|
| + chromeos::FakeChromeUserManager* fake_user_manager_ = nullptr;
|
| chromeos::ScopedUserManagerEnabler user_manager_enabler_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(MultiUserNotificationBlockerChromeOSTest);
|
|
|