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

Side by Side Diff: ash/common/test/test_session_state_delegate.cc

Issue 2446453002: Refactor ShouldLockScreenBeforeSuspending to ShouldLockScreenAutomatically (Closed)
Patch Set: comment Created 4 years, 1 month 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
« no previous file with comments | « ash/common/test/test_session_state_delegate.h ('k') | ash/mus/bridge/wm_shell_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_session_state_delegate.h" 5 #include "ash/common/test/test_session_state_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/common/login_status.h" 10 #include "ash/common/login_status.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool IsSessionStarted() const { return session_started_; } 80 bool IsSessionStarted() const { return session_started_; }
81 81
82 private: 82 private:
83 // True if SessionStarted() has been called. 83 // True if SessionStarted() has been called.
84 bool session_started_; 84 bool session_started_;
85 DISALLOW_COPY_AND_ASSIGN(TestUserManager); 85 DISALLOW_COPY_AND_ASSIGN(TestUserManager);
86 }; 86 };
87 87
88 TestSessionStateDelegate::TestSessionStateDelegate() 88 TestSessionStateDelegate::TestSessionStateDelegate()
89 : can_lock_screen_(true), 89 : can_lock_screen_(true),
90 should_lock_screen_before_suspending_(false), 90 should_lock_screen_automatically_(false),
91 screen_locked_(false), 91 screen_locked_(false),
92 user_adding_screen_running_(false), 92 user_adding_screen_running_(false),
93 logged_in_users_(1), 93 logged_in_users_(1),
94 active_user_index_(0), 94 active_user_index_(0),
95 user_manager_(new TestUserManager()), 95 user_manager_(new TestUserManager()),
96 session_state_(session_manager::SessionState::LOGIN_PRIMARY) { 96 session_state_(session_manager::SessionState::LOGIN_PRIMARY) {
97 // This is intended to be capitalized. 97 // This is intended to be capitalized.
98 user_list_.push_back(base::MakeUnique<MockUserInfo>("First@tray")); 98 user_list_.push_back(base::MakeUnique<MockUserInfo>("First@tray"));
99 // This is intended to be capitalized. 99 // This is intended to be capitalized.
100 user_list_.push_back(base::MakeUnique<MockUserInfo>("Second@tray")); 100 user_list_.push_back(base::MakeUnique<MockUserInfo>("Second@tray"));
(...skipping 28 matching lines...) Expand all
129 } 129 }
130 130
131 bool TestSessionStateDelegate::CanLockScreen() const { 131 bool TestSessionStateDelegate::CanLockScreen() const {
132 return IsActiveUserSessionStarted() && can_lock_screen_; 132 return IsActiveUserSessionStarted() && can_lock_screen_;
133 } 133 }
134 134
135 bool TestSessionStateDelegate::IsScreenLocked() const { 135 bool TestSessionStateDelegate::IsScreenLocked() const {
136 return screen_locked_; 136 return screen_locked_;
137 } 137 }
138 138
139 bool TestSessionStateDelegate::ShouldLockScreenBeforeSuspending() const { 139 bool TestSessionStateDelegate::ShouldLockScreenAutomatically() const {
140 return should_lock_screen_before_suspending_; 140 return should_lock_screen_automatically_;
141 } 141 }
142 142
143 void TestSessionStateDelegate::LockScreen() { 143 void TestSessionStateDelegate::LockScreen() {
144 if (CanLockScreen()) 144 if (CanLockScreen())
145 screen_locked_ = true; 145 screen_locked_ = true;
146 } 146 }
147 147
148 void TestSessionStateDelegate::UnlockScreen() { 148 void TestSessionStateDelegate::UnlockScreen() {
149 screen_locked_ = false; 149 screen_locked_ = false;
150 } 150 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 // static 185 // static
186 void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) { 186 void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) {
187 CHECK(WmShell::HasInstance()); 187 CHECK(WmShell::HasInstance());
188 static_cast<ash::test::TestSessionStateDelegate*>( 188 static_cast<ash::test::TestSessionStateDelegate*>(
189 WmShell::Get()->GetSessionStateDelegate()) 189 WmShell::Get()->GetSessionStateDelegate())
190 ->can_lock_screen_ = can_lock_screen; 190 ->can_lock_screen_ = can_lock_screen;
191 } 191 }
192 192
193 void TestSessionStateDelegate::SetShouldLockScreenBeforeSuspending( 193 void TestSessionStateDelegate::SetShouldLockScreenAutomatically(
194 bool should_lock) { 194 bool should_lock) {
195 should_lock_screen_before_suspending_ = should_lock; 195 should_lock_screen_automatically_ = should_lock;
196 } 196 }
197 197
198 void TestSessionStateDelegate::SetUserAddingScreenRunning( 198 void TestSessionStateDelegate::SetUserAddingScreenRunning(
199 bool user_adding_screen_running) { 199 bool user_adding_screen_running) {
200 user_adding_screen_running_ = user_adding_screen_running; 200 user_adding_screen_running_ = user_adding_screen_running;
201 if (user_adding_screen_running_) 201 if (user_adding_screen_running_)
202 session_state_ = session_manager::SessionState::LOGIN_SECONDARY; 202 session_state_ = session_manager::SessionState::LOGIN_SECONDARY;
203 else 203 else
204 session_state_ = session_manager::SessionState::ACTIVE; 204 session_state_ = session_manager::SessionState::ACTIVE;
205 } 205 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 void TestSessionStateDelegate::AddSessionStateObserver( 249 void TestSessionStateDelegate::AddSessionStateObserver(
250 SessionStateObserver* observer) {} 250 SessionStateObserver* observer) {}
251 251
252 void TestSessionStateDelegate::RemoveSessionStateObserver( 252 void TestSessionStateDelegate::RemoveSessionStateObserver(
253 SessionStateObserver* observer) {} 253 SessionStateObserver* observer) {}
254 254
255 } // namespace test 255 } // namespace test
256 } // namespace ash 256 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/test/test_session_state_delegate.h ('k') | ash/mus/bridge/wm_shell_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698