| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "ash/system/system_notifier.h" | 6 #include "ash/system/system_notifier.h" |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" | 9 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" |
| 10 #include "chromeos/login/login_state.h" | 10 #include "chromeos/login/login_state.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 int state_changed_count_; | 57 int state_changed_count_; |
| 58 scoped_ptr<message_center::NotificationBlocker> blocker_; | 58 scoped_ptr<message_center::NotificationBlocker> blocker_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlockerChromeOSTest); | 60 DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlockerChromeOSTest); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 TEST_F(LoginStateNotificationBlockerChromeOSTest, BaseTest) { | 63 TEST_F(LoginStateNotificationBlockerChromeOSTest, BaseTest) { |
| 64 // Default status: OOBE. | 64 // Default status: OOBE. |
| 65 message_center::NotifierId notifier_id; | 65 message_center::NotifierId notifier_id( |
| 66 message_center::NotifierId::APPLICATION, "test-notifier"); |
| 66 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); | 67 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); |
| 67 | 68 |
| 68 // Login screen. | 69 // Login screen. |
| 69 chromeos::LoginState::Get()->SetLoggedInState( | 70 chromeos::LoginState::Get()->SetLoggedInState( |
| 70 chromeos::LoginState::LOGGED_IN_NONE, | 71 chromeos::LoginState::LOGGED_IN_NONE, |
| 71 chromeos::LoginState::LOGGED_IN_USER_NONE); | 72 chromeos::LoginState::LOGGED_IN_USER_NONE); |
| 72 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 73 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 73 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); | 74 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); |
| 74 | 75 |
| 75 // Logged in as a normal user. | 76 // Logged in as a normal user. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Lock. | 117 // Lock. |
| 117 ash::Shell::GetInstance()->OnLockStateChanged(true); | 118 ash::Shell::GetInstance()->OnLockStateChanged(true); |
| 118 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 119 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 119 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 120 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| 120 | 121 |
| 121 // Unlock. | 122 // Unlock. |
| 122 ash::Shell::GetInstance()->OnLockStateChanged(false); | 123 ash::Shell::GetInstance()->OnLockStateChanged(false); |
| 123 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 124 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 124 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 125 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| 125 } | 126 } |
| OLD | NEW |