Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2180)

Unified Diff: ash/test/test_system_tray_delegate.cc

Issue 108213009: Adds TraySessionLengthLimitTest to ash_unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ASH_EXPORT to SessionLengthLimitObserver Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/test/test_system_tray_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/test/test_system_tray_delegate.cc
diff --git a/ash/test/test_system_tray_delegate.cc b/ash/test/test_system_tray_delegate.cc
index 0f47aeaa7c1f54fa4f88c2603ac68cb470d213de..473802d5f8f1bab1d3cf8c38c8e5fbc96c61316d 100644
--- a/ash/test/test_system_tray_delegate.cc
+++ b/ash/test/test_system_tray_delegate.cc
@@ -22,7 +22,8 @@ user::LoginStatus g_initial_status = user::LOGGED_IN_USER;
TestSystemTrayDelegate::TestSystemTrayDelegate()
: should_show_display_notification_(false),
- login_status_(g_initial_status) {
+ login_status_(g_initial_status),
+ session_length_limit_set_(false) {
}
TestSystemTrayDelegate::~TestSystemTrayDelegate() {
@@ -39,6 +40,16 @@ void TestSystemTrayDelegate::SetLoginStatus(user::LoginStatus login_status) {
Shell::GetInstance()->UpdateAfterLoginStatusChange(login_status);
}
+void TestSystemTrayDelegate::SetSessionLengthLimitForTest(
+ const base::TimeDelta& new_limit) {
+ session_length_limit_ = new_limit;
+ session_length_limit_set_ = true;
+}
+
+void TestSystemTrayDelegate::ClearSessionLengthLimit() {
+ session_length_limit_set_ = false;
+}
+
user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
// Initial login status has been changed for testing.
if (g_initial_status != user::LOGGED_IN_USER &&
@@ -62,6 +73,22 @@ bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
return should_show_display_notification_;
}
+bool TestSystemTrayDelegate::GetSessionStartTime(
+ base::TimeTicks* session_start_time) {
+ // Just returns TimeTicks::Now(), so the remaining time is always the
+ // specified limit. This is useful for testing.
+ if (session_length_limit_set_)
+ *session_start_time = base::TimeTicks::Now();
+ return session_length_limit_set_;
+}
+
+bool TestSystemTrayDelegate::GetSessionLengthLimit(
+ base::TimeDelta* session_length_limit) {
+ if (session_length_limit_set_)
+ *session_length_limit = session_length_limit_;
+ return session_length_limit_set_;
+}
+
void TestSystemTrayDelegate::ShutDown() {
base::MessageLoop::current()->Quit();
}
« no previous file with comments | « ash/test/test_system_tray_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698