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