| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/system/chromeos/session/tray_session_length_limit.h" | 5 #include "ash/system/chromeos/session/tray_session_length_limit.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 11 #include "ash/test/test_system_tray_delegate.h" | 11 #include "ash/test/test_system_tray_delegate.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "ui/message_center/message_center.h" | 13 #include "ui/message_center/message_center.h" |
| 14 #include "ui/message_center/notification.h" | 14 #include "ui/message_center/notification.h" |
| 15 #include "ui/message_center/notification_types.h" | 15 #include "ui/message_center/notification_types.h" |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 namespace test { | 18 namespace test { |
| 19 | 19 |
| 20 class TraySessionLengthLimitTest : public AshTestBase { | 20 class TraySessionLengthLimitTest : public AshTestBase { |
| 21 public: | 21 public: |
| 22 TraySessionLengthLimitTest() {} | 22 TraySessionLengthLimitTest() {} |
| 23 virtual ~TraySessionLengthLimitTest() {} | 23 ~TraySessionLengthLimitTest() override {} |
| 24 | 24 |
| 25 virtual void SetUp() override { | 25 void SetUp() override { |
| 26 AshTestBase::SetUp(); | 26 AshTestBase::SetUp(); |
| 27 SystemTray* system_tray = | 27 SystemTray* system_tray = |
| 28 Shell::GetPrimaryRootWindowController()->GetSystemTray(); | 28 Shell::GetPrimaryRootWindowController()->GetSystemTray(); |
| 29 tray_session_length_limit_ = new TraySessionLengthLimit(system_tray); | 29 tray_session_length_limit_ = new TraySessionLengthLimit(system_tray); |
| 30 system_tray->AddTrayItem(tray_session_length_limit_); | 30 system_tray->AddTrayItem(tray_session_length_limit_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void TearDown() override { | 33 void TearDown() override { AshTestBase::TearDown(); } |
| 34 AshTestBase::TearDown(); | |
| 35 } | |
| 36 | 34 |
| 37 protected: | 35 protected: |
| 38 void UpdateSessionLengthLimitInMin(int mins) { | 36 void UpdateSessionLengthLimitInMin(int mins) { |
| 39 GetSystemTrayDelegate()->SetSessionLengthLimitForTest( | 37 GetSystemTrayDelegate()->SetSessionLengthLimitForTest( |
| 40 base::TimeDelta::FromMinutes(mins)); | 38 base::TimeDelta::FromMinutes(mins)); |
| 41 tray_session_length_limit_->OnSessionLengthLimitChanged(); | 39 tray_session_length_limit_->OnSessionLengthLimitChanged(); |
| 42 } | 40 } |
| 43 | 41 |
| 44 message_center::Notification* GetNotification() { | 42 message_center::Notification* GetNotification() { |
| 45 const message_center::NotificationList::Notifications& notifications = | 43 const message_center::NotificationList::Notifications& notifications = |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // re-appear and be re-read. | 148 // re-appear and be re-read. |
| 151 UpdateSessionLengthLimitInMin(15); | 149 UpdateSessionLengthLimitInMin(15); |
| 152 notification = GetNotification(); | 150 notification = GetNotification(); |
| 153 EXPECT_TRUE(notification); | 151 EXPECT_TRUE(notification); |
| 154 EXPECT_TRUE(notification->rich_notification_data(). | 152 EXPECT_TRUE(notification->rich_notification_data(). |
| 155 should_make_spoken_feedback_for_popup_updates); | 153 should_make_spoken_feedback_for_popup_updates); |
| 156 } | 154 } |
| 157 | 155 |
| 158 } // namespace test | 156 } // namespace test |
| 159 } // namespace ash | 157 } // namespace ash |
| OLD | NEW |