| 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 #ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ | 5 #ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ |
| 6 #define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ | 6 #define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "ash/system/tray/default_system_tray_delegate.h" | 8 #include "ash/system/tray/default_system_tray_delegate.h" |
| 9 #include "base/time/time.h" |
| 9 | 10 |
| 10 namespace ash { | 11 namespace ash { |
| 11 namespace test { | 12 namespace test { |
| 12 | 13 |
| 13 class TestSystemTrayDelegate : public DefaultSystemTrayDelegate { | 14 class TestSystemTrayDelegate : public DefaultSystemTrayDelegate { |
| 14 public: | 15 public: |
| 15 TestSystemTrayDelegate(); | 16 TestSystemTrayDelegate(); |
| 16 virtual ~TestSystemTrayDelegate(); | 17 virtual ~TestSystemTrayDelegate(); |
| 17 | 18 |
| 18 // Changes the login status when initially the delegate is created. This will | 19 // Changes the login status when initially the delegate is created. This will |
| 19 // be called before AshTestBase::SetUp() to test the case when chrome is | 20 // be called before AshTestBase::SetUp() to test the case when chrome is |
| 20 // restarted right after the login (such like a flag is set). | 21 // restarted right after the login (such like a flag is set). |
| 21 // This value will be reset in AshTestHelper::TearDown, most test fixtures | 22 // This value will be reset in AshTestHelper::TearDown, most test fixtures |
| 22 // don't need to care its lifecycle. | 23 // don't need to care its lifecycle. |
| 23 static void SetInitialLoginStatus(user::LoginStatus login_status); | 24 static void SetInitialLoginStatus(user::LoginStatus login_status); |
| 24 | 25 |
| 25 // Changes the current login status in the test. This also invokes | 26 // Changes the current login status in the test. This also invokes |
| 26 // UpdateAfterLoginStatusChange(). Usually this is called in the test code to | 27 // UpdateAfterLoginStatusChange(). Usually this is called in the test code to |
| 27 // set up a login status. This will fit to most of the test cases, but this | 28 // set up a login status. This will fit to most of the test cases, but this |
| 28 // cannot be set during the initialization. To test the initialization, | 29 // cannot be set during the initialization. To test the initialization, |
| 29 // consider using SetInitialLoginStatus() instead. | 30 // consider using SetInitialLoginStatus() instead. |
| 30 void SetLoginStatus(user::LoginStatus login_status); | 31 void SetLoginStatus(user::LoginStatus login_status); |
| 31 | 32 |
| 32 void set_should_show_display_notification(bool should_show) { | 33 void set_should_show_display_notification(bool should_show) { |
| 33 should_show_display_notification_ = should_show; | 34 should_show_display_notification_ = should_show; |
| 34 } | 35 } |
| 35 | 36 |
| 37 // Updates the session length limit so that the limit will come from now in |
| 38 // |new_limit|. |
| 39 void SetSessionLengthLimitForTest(const base::TimeDelta& new_limit); |
| 40 |
| 41 // Clears the session length limit. |
| 42 void ClearSessionLengthLimit(); |
| 43 |
| 36 // Overridden from SystemTrayDelegate: | 44 // Overridden from SystemTrayDelegate: |
| 37 virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE; | 45 virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE; |
| 38 virtual bool ShouldShowDisplayNotification() OVERRIDE; | 46 virtual bool ShouldShowDisplayNotification() OVERRIDE; |
| 47 virtual bool GetSessionStartTime( |
| 48 base::TimeTicks* session_start_time) OVERRIDE; |
| 49 virtual bool GetSessionLengthLimit( |
| 50 base::TimeDelta* session_length_limit) OVERRIDE; |
| 39 virtual void ShutDown() OVERRIDE; | 51 virtual void ShutDown() OVERRIDE; |
| 40 virtual void SignOut() OVERRIDE; | 52 virtual void SignOut() OVERRIDE; |
| 41 | 53 |
| 42 private: | 54 private: |
| 43 bool should_show_display_notification_; | 55 bool should_show_display_notification_; |
| 44 user::LoginStatus login_status_; | 56 user::LoginStatus login_status_; |
| 57 base::TimeDelta session_length_limit_; |
| 58 bool session_length_limit_set_; |
| 45 | 59 |
| 46 DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate); | 60 DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate); |
| 47 }; | 61 }; |
| 48 | 62 |
| 49 } // namespace test | 63 } // namespace test |
| 50 } // namespace ash | 64 } // namespace ash |
| 51 | 65 |
| 52 #endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ | 66 #endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ |
| OLD | NEW |