| 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/session/tray_session_length_limit.h" | 5 #include "ash/system/session/tray_session_length_limit.h" |
| 6 | 6 |
| 7 #include "ash/session/session_controller.h" | 7 #include "ash/session/session_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/tray/label_tray_view.h" | 9 #include "ash/system/tray/label_tray_view.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 11 #include "ash/system/tray/system_tray_test_api.h" |
| 11 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "ui/message_center/message_center.h" | 15 #include "ui/message_center/message_center.h" |
| 15 #include "ui/message_center/notification.h" | 16 #include "ui/message_center/notification.h" |
| 16 #include "ui/message_center/notification_types.h" | 17 #include "ui/message_center/notification_types.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 namespace test { | 20 namespace test { |
| 20 | 21 |
| 21 class TraySessionLengthLimitTest : public AshTestBase { | 22 class TraySessionLengthLimitTest : public AshTestBase { |
| 22 public: | 23 public: |
| 23 TraySessionLengthLimitTest() = default; | 24 TraySessionLengthLimitTest() = default; |
| 24 ~TraySessionLengthLimitTest() override = default; | 25 ~TraySessionLengthLimitTest() override = default; |
| 25 | 26 |
| 26 protected: | 27 protected: |
| 27 LabelTrayView* GetSessionLengthLimitTrayView() { | 28 LabelTrayView* GetSessionLengthLimitTrayView() { |
| 28 return GetPrimarySystemTray() | 29 return SystemTrayTestApi(GetPrimarySystemTray()) |
| 29 ->GetTraySessionLengthLimitForTesting() | 30 .tray_session_length_limit() |
| 30 ->tray_bubble_view_; | 31 ->tray_bubble_view_; |
| 31 } | 32 } |
| 32 | 33 |
| 33 void UpdateSessionLengthLimitInMin(int mins) { | 34 void UpdateSessionLengthLimitInMin(int mins) { |
| 34 Shell::Get()->session_controller()->SetSessionLengthLimit( | 35 Shell::Get()->session_controller()->SetSessionLengthLimit( |
| 35 base::TimeDelta::FromMinutes(mins), base::TimeTicks::Now()); | 36 base::TimeDelta::FromMinutes(mins), base::TimeTicks::Now()); |
| 36 } | 37 } |
| 37 | 38 |
| 38 message_center::Notification* GetNotification() { | 39 message_center::Notification* GetNotification() { |
| 39 const message_center::NotificationList::Notifications& notifications = | 40 const message_center::NotificationList::Notifications& notifications = |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // re-appear and be re-read. | 159 // re-appear and be re-read. |
| 159 UpdateSessionLengthLimitInMin(15); | 160 UpdateSessionLengthLimitInMin(15); |
| 160 notification = GetNotification(); | 161 notification = GetNotification(); |
| 161 EXPECT_TRUE(notification); | 162 EXPECT_TRUE(notification); |
| 162 EXPECT_TRUE(notification->rich_notification_data() | 163 EXPECT_TRUE(notification->rich_notification_data() |
| 163 .should_make_spoken_feedback_for_popup_updates); | 164 .should_make_spoken_feedback_for_popup_updates); |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace test | 167 } // namespace test |
| 167 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |