| 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/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 bool g_system_update_required = false; | 20 bool g_system_update_required = false; |
| 21 LoginStatus g_initial_status = LoginStatus::USER; | 21 LoginStatus g_initial_status = LoginStatus::USER; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 TestSystemTrayDelegate::TestSystemTrayDelegate() | 25 TestSystemTrayDelegate::TestSystemTrayDelegate() |
| 26 : should_show_display_notification_(false), | 26 : login_status_(g_initial_status), session_length_limit_set_(false) {} |
| 27 login_status_(g_initial_status), | |
| 28 session_length_limit_set_(false) {} | |
| 29 | 27 |
| 30 TestSystemTrayDelegate::~TestSystemTrayDelegate() {} | 28 TestSystemTrayDelegate::~TestSystemTrayDelegate() {} |
| 31 | 29 |
| 32 // static | 30 // static |
| 33 void TestSystemTrayDelegate::SetInitialLoginStatus(LoginStatus login_status) { | 31 void TestSystemTrayDelegate::SetInitialLoginStatus(LoginStatus login_status) { |
| 34 g_initial_status = login_status; | 32 g_initial_status = login_status; |
| 35 } | 33 } |
| 36 | 34 |
| 37 // static | 35 // static |
| 38 void TestSystemTrayDelegate::SetSystemUpdateRequired(bool required) { | 36 void TestSystemTrayDelegate::SetSystemUpdateRequired(bool required) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return login_status_ == LoginStatus::SUPERVISED; | 82 return login_status_ == LoginStatus::SUPERVISED; |
| 85 } | 83 } |
| 86 | 84 |
| 87 void TestSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const { | 85 void TestSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const { |
| 88 DCHECK(info); | 86 DCHECK(info); |
| 89 info->severity = UpdateInfo::UPDATE_NONE; | 87 info->severity = UpdateInfo::UPDATE_NONE; |
| 90 info->update_required = g_system_update_required; | 88 info->update_required = g_system_update_required; |
| 91 info->factory_reset_required = false; | 89 info->factory_reset_required = false; |
| 92 } | 90 } |
| 93 | 91 |
| 94 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() { | |
| 95 return should_show_display_notification_; | |
| 96 } | |
| 97 | |
| 98 bool TestSystemTrayDelegate::GetSessionStartTime( | 92 bool TestSystemTrayDelegate::GetSessionStartTime( |
| 99 base::TimeTicks* session_start_time) { | 93 base::TimeTicks* session_start_time) { |
| 100 // Just returns TimeTicks::Now(), so the remaining time is always the | 94 // Just returns TimeTicks::Now(), so the remaining time is always the |
| 101 // specified limit. This is useful for testing. | 95 // specified limit. This is useful for testing. |
| 102 if (session_length_limit_set_) | 96 if (session_length_limit_set_) |
| 103 *session_start_time = base::TimeTicks::Now(); | 97 *session_start_time = base::TimeTicks::Now(); |
| 104 return session_length_limit_set_; | 98 return session_length_limit_set_; |
| 105 } | 99 } |
| 106 | 100 |
| 107 bool TestSystemTrayDelegate::GetSessionLengthLimit( | 101 bool TestSystemTrayDelegate::GetSessionLengthLimit( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 118 void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) { | 112 void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) { |
| 119 *info = current_ime_; | 113 *info = current_ime_; |
| 120 } | 114 } |
| 121 | 115 |
| 122 void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) { | 116 void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) { |
| 123 *list = ime_list_; | 117 *list = ime_list_; |
| 124 } | 118 } |
| 125 | 119 |
| 126 } // namespace test | 120 } // namespace test |
| 127 } // namespace ash | 121 } // namespace ash |
| OLD | NEW |