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

Unified Diff: ash/test/test_session_state_delegate.cc

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ash/test/test_session_state_delegate.cc
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e21c0729b7cd1c0deea4616235b80e72c33f84dd
--- /dev/null
+++ b/ash/test/test_session_state_delegate.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/test/test_session_state_delegate.h"
+
+namespace ash {
+namespace test {
+
+TestSessionStateDelegate::TestSessionStateDelegate()
+ : has_active_user_(true),
+ active_user_session_started_(true),
+ can_lock_screen_(true),
+ screen_locked_(false) {
+}
+
+TestSessionStateDelegate::~TestSessionStateDelegate() {
+}
+
+bool TestSessionStateDelegate::HasActiveUser() const {
+ return has_active_user_;
+}
+
+bool TestSessionStateDelegate::IsActiveUserSessionStarted() const {
+ return active_user_session_started_;
+}
+
+bool TestSessionStateDelegate::CanLockScreen() const {
+ return has_active_user_ && can_lock_screen_;
+}
+
+bool TestSessionStateDelegate::IsScreenLocked() const {
+ return screen_locked_;
+}
+
+void TestSessionStateDelegate::LockScreen() {
+ screen_locked_ = true;
Daniel Erat 2013/04/16 17:34:15 does it make sense to CHECK(can_lock_screen_) here
bartfab (slow) 2013/04/17 08:14:41 It's not an error to request a screen lock when sc
+}
+
+void TestSessionStateDelegate::UnlockScreen() {
+ screen_locked_ = false;
+}
+
+void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) {
+ has_active_user_ = has_active_user;
+ if (!has_active_user)
+ active_user_session_started_ = false;
+}
+
+void TestSessionStateDelegate::SetActiveUserSessionStarted(
+ bool active_user_session_started) {
+ active_user_session_started_ = active_user_session_started;
+ if (active_user_session_started)
+ has_active_user_ = true;
+}
+
+void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) {
+ can_lock_screen_ = can_lock_screen;
+}
+
+} // namespace test
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698