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

Side by Side Diff: ash/test/test_system_tray_delegate.cc

Issue 2060003002: ash: Add a unit test for the system update tray item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movetraydelegate
Patch Set: rebase Created 4 years, 6 months 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 unified diff | Download patch
OLDNEW
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/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return LoginStatus::NOT_LOGGED_IN; 66 return LoginStatus::NOT_LOGGED_IN;
67 if (delegate->IsScreenLocked()) 67 if (delegate->IsScreenLocked())
68 return LoginStatus::LOCKED; 68 return LoginStatus::LOCKED;
69 return login_status_; 69 return login_status_;
70 } 70 }
71 71
72 bool TestSystemTrayDelegate::IsUserSupervised() const { 72 bool TestSystemTrayDelegate::IsUserSupervised() const {
73 return login_status_ == LoginStatus::SUPERVISED; 73 return login_status_ == LoginStatus::SUPERVISED;
74 } 74 }
75 75
76 void TestSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const {
77 DCHECK(info);
78 // In tests, default to not having an update required.
79 info->severity = UpdateInfo::UPDATE_NORMAL;
80 info->update_required = false;
81 info->factory_reset_required = false;
82 }
83
76 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() { 84 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
77 return should_show_display_notification_; 85 return should_show_display_notification_;
78 } 86 }
79 87
80 bool TestSystemTrayDelegate::GetSessionStartTime( 88 bool TestSystemTrayDelegate::GetSessionStartTime(
81 base::TimeTicks* session_start_time) { 89 base::TimeTicks* session_start_time) {
82 // Just returns TimeTicks::Now(), so the remaining time is always the 90 // Just returns TimeTicks::Now(), so the remaining time is always the
83 // specified limit. This is useful for testing. 91 // specified limit. This is useful for testing.
84 if (session_length_limit_set_) 92 if (session_length_limit_set_)
85 *session_start_time = base::TimeTicks::Now(); 93 *session_start_time = base::TimeTicks::Now();
86 return session_length_limit_set_; 94 return session_length_limit_set_;
87 } 95 }
88 96
89 bool TestSystemTrayDelegate::GetSessionLengthLimit( 97 bool TestSystemTrayDelegate::GetSessionLengthLimit(
90 base::TimeDelta* session_length_limit) { 98 base::TimeDelta* session_length_limit) {
91 if (session_length_limit_set_) 99 if (session_length_limit_set_)
92 *session_length_limit = session_length_limit_; 100 *session_length_limit = session_length_limit_;
93 return session_length_limit_set_; 101 return session_length_limit_set_;
94 } 102 }
95 103
96 void TestSystemTrayDelegate::SignOut() { 104 void TestSystemTrayDelegate::SignOut() {
97 base::MessageLoop::current()->QuitWhenIdle(); 105 base::MessageLoop::current()->QuitWhenIdle();
98 } 106 }
99 107
100 } // namespace test 108 } // namespace test
101 } // namespace ash 109 } // namespace ash
OLDNEW
« ash/system/tray/system_tray.h ('K') | « 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