| 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/test/test_system_tray_delegate.h" | 5 #include "ash/test/test_system_tray_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.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 TestSystemTrayDelegate::TestSystemTrayDelegate() = default; | 15 TestSystemTrayDelegate::TestSystemTrayDelegate() = default; |
| 16 | 16 |
| 17 TestSystemTrayDelegate::~TestSystemTrayDelegate() = default; | 17 TestSystemTrayDelegate::~TestSystemTrayDelegate() = default; |
| 18 | 18 |
| 19 void TestSystemTrayDelegate::SetSessionLengthLimitForTest( | 19 void TestSystemTrayDelegate::SetSessionLengthLimitForTest( |
| 20 const base::TimeDelta& new_limit) { | 20 const base::TimeDelta& new_limit) { |
| 21 session_length_limit_ = new_limit; | 21 session_length_limit_ = new_limit; |
| 22 session_length_limit_set_ = true; | 22 session_length_limit_set_ = true; |
| 23 } | 23 } |
| 24 | 24 |
| 25 void TestSystemTrayDelegate::ClearSessionLengthLimit() { | 25 void TestSystemTrayDelegate::ClearSessionLengthLimit() { |
| 26 session_length_limit_set_ = false; | 26 session_length_limit_set_ = false; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void TestSystemTrayDelegate::SetCurrentIME(const IMEInfo& info) { | |
| 30 current_ime_ = info; | |
| 31 } | |
| 32 | |
| 33 void TestSystemTrayDelegate::SetAvailableIMEList(const IMEInfoList& list) { | |
| 34 ime_list_ = list; | |
| 35 } | |
| 36 | |
| 37 bool TestSystemTrayDelegate::GetSessionStartTime( | 29 bool TestSystemTrayDelegate::GetSessionStartTime( |
| 38 base::TimeTicks* session_start_time) { | 30 base::TimeTicks* session_start_time) { |
| 39 // Just returns TimeTicks::Now(), so the remaining time is always the | 31 // Just returns TimeTicks::Now(), so the remaining time is always the |
| 40 // specified limit. This is useful for testing. | 32 // specified limit. This is useful for testing. |
| 41 if (session_length_limit_set_) | 33 if (session_length_limit_set_) |
| 42 *session_start_time = base::TimeTicks::Now(); | 34 *session_start_time = base::TimeTicks::Now(); |
| 43 return session_length_limit_set_; | 35 return session_length_limit_set_; |
| 44 } | 36 } |
| 45 | 37 |
| 46 bool TestSystemTrayDelegate::GetSessionLengthLimit( | 38 bool TestSystemTrayDelegate::GetSessionLengthLimit( |
| 47 base::TimeDelta* session_length_limit) { | 39 base::TimeDelta* session_length_limit) { |
| 48 if (session_length_limit_set_) | 40 if (session_length_limit_set_) |
| 49 *session_length_limit = session_length_limit_; | 41 *session_length_limit = session_length_limit_; |
| 50 return session_length_limit_set_; | 42 return session_length_limit_set_; |
| 51 } | 43 } |
| 52 | 44 |
| 53 void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) { | |
| 54 *info = current_ime_; | |
| 55 } | |
| 56 | |
| 57 void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) { | |
| 58 *list = ime_list_; | |
| 59 } | |
| 60 | |
| 61 } // namespace test | 45 } // namespace test |
| 62 } // namespace ash | 46 } // namespace ash |
| OLD | NEW |