Chromium Code Reviews| Index: chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc |
| diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc |
| index d4c0eed04424c2c1547fbfccc65aeeb4d9409654..7705f10c182edee1c89491fe9e94012a03974604 100644 |
| --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc |
| +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc |
| @@ -65,6 +65,12 @@ class LoginStateNotificationBlockerChromeOSTest |
| return blocker_->ShouldShowNotificationAsPopup(notification); |
| } |
| + void SetLockedState(bool locked) { |
| + // TODO(xiyuan): Use SessionManager and not call ash. |
| + static_cast<ash::SessionStateObserver*>(ash::Shell::Get()) |
|
stevenjb
2017/04/10 15:52:44
Why do we need the static_cast here?
xiyuan
2017/04/10 16:09:53
It is because LockStateChanged is now part of Sess
|
| + ->LockStateChanged(locked); |
| + } |
| + |
| private: |
| int state_changed_count_; |
| std::unique_ptr<message_center::NotificationBlocker> blocker_; |
| @@ -93,12 +99,12 @@ TEST_F(LoginStateNotificationBlockerChromeOSTest, BaseTest) { |
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| // Lock. |
| - ash::Shell::Get()->OnLockStateChanged(true); |
| + SetLockedState(true); |
| EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); |
| // Unlock. |
| - ash::Shell::Get()->OnLockStateChanged(false); |
| + SetLockedState(false); |
| EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| } |
| @@ -127,12 +133,12 @@ TEST_F(LoginStateNotificationBlockerChromeOSTest, AlwaysAllowedNotifier) { |
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| // Lock. |
| - ash::Shell::Get()->OnLockStateChanged(true); |
| + SetLockedState(true); |
| EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| // Unlock. |
| - ash::Shell::Get()->OnLockStateChanged(false); |
| + SetLockedState(false); |
| EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| } |