| 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/common/test/test_system_tray_delegate.h" | 5 #include "ash/common/test/test_system_tray_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/common/login_status.h" | 9 #include "ash/common/login_status.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 namespace test { | 15 namespace test { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 bool g_system_update_required = false; | |
| 20 LoginStatus g_initial_status = LoginStatus::USER; | 19 LoginStatus g_initial_status = LoginStatus::USER; |
| 21 | 20 |
| 22 } // namespace | 21 } // namespace |
| 23 | 22 |
| 24 TestSystemTrayDelegate::TestSystemTrayDelegate() | 23 TestSystemTrayDelegate::TestSystemTrayDelegate() |
| 25 : login_status_(g_initial_status), session_length_limit_set_(false) {} | 24 : login_status_(g_initial_status), session_length_limit_set_(false) {} |
| 26 | 25 |
| 27 TestSystemTrayDelegate::~TestSystemTrayDelegate() {} | 26 TestSystemTrayDelegate::~TestSystemTrayDelegate() {} |
| 28 | 27 |
| 29 void TestSystemTrayDelegate::SetLoginStatus(LoginStatus login_status) { | 28 void TestSystemTrayDelegate::SetLoginStatus(LoginStatus login_status) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return LoginStatus::NOT_LOGGED_IN; | 63 return LoginStatus::NOT_LOGGED_IN; |
| 65 if (delegate->IsScreenLocked()) | 64 if (delegate->IsScreenLocked()) |
| 66 return LoginStatus::LOCKED; | 65 return LoginStatus::LOCKED; |
| 67 return login_status_; | 66 return login_status_; |
| 68 } | 67 } |
| 69 | 68 |
| 70 bool TestSystemTrayDelegate::IsUserSupervised() const { | 69 bool TestSystemTrayDelegate::IsUserSupervised() const { |
| 71 return login_status_ == LoginStatus::SUPERVISED; | 70 return login_status_ == LoginStatus::SUPERVISED; |
| 72 } | 71 } |
| 73 | 72 |
| 74 void TestSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const { | |
| 75 DCHECK(info); | |
| 76 info->severity = UpdateInfo::UPDATE_NONE; | |
| 77 info->update_required = g_system_update_required; | |
| 78 info->factory_reset_required = false; | |
| 79 } | |
| 80 | |
| 81 bool TestSystemTrayDelegate::GetSessionStartTime( | 73 bool TestSystemTrayDelegate::GetSessionStartTime( |
| 82 base::TimeTicks* session_start_time) { | 74 base::TimeTicks* session_start_time) { |
| 83 // Just returns TimeTicks::Now(), so the remaining time is always the | 75 // Just returns TimeTicks::Now(), so the remaining time is always the |
| 84 // specified limit. This is useful for testing. | 76 // specified limit. This is useful for testing. |
| 85 if (session_length_limit_set_) | 77 if (session_length_limit_set_) |
| 86 *session_start_time = base::TimeTicks::Now(); | 78 *session_start_time = base::TimeTicks::Now(); |
| 87 return session_length_limit_set_; | 79 return session_length_limit_set_; |
| 88 } | 80 } |
| 89 | 81 |
| 90 bool TestSystemTrayDelegate::GetSessionLengthLimit( | 82 bool TestSystemTrayDelegate::GetSessionLengthLimit( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 108 : old_status_(g_initial_status) { | 100 : old_status_(g_initial_status) { |
| 109 g_initial_status = new_status; | 101 g_initial_status = new_status; |
| 110 } | 102 } |
| 111 | 103 |
| 112 ScopedInitialLoginStatus::~ScopedInitialLoginStatus() { | 104 ScopedInitialLoginStatus::~ScopedInitialLoginStatus() { |
| 113 g_initial_status = old_status_; | 105 g_initial_status = old_status_; |
| 114 } | 106 } |
| 115 | 107 |
| 116 } // namespace test | 108 } // namespace test |
| 117 } // namespace ash | 109 } // namespace ash |
| OLD | NEW |