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

Side by Side Diff: ash/test/test_shell_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_shell_delegate.h" 5 #include "ash/test/test_shell_delegate.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ash/caps_lock_delegate_stub.h" 9 #include "ash/caps_lock_delegate_stub.h"
10 #include "ash/host/root_window_host_factory.h" 10 #include "ash/host/root_window_host_factory.h"
11 #include "ash/session_state_delegate.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
13 #include "ash/test/test_launcher_delegate.h" 14 #include "ash/test/test_launcher_delegate.h"
15 #include "ash/test/test_session_state_delegate.h"
14 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
17 #include "base/logging.h"
15 #include "content/public/test/test_browser_context.h" 18 #include "content/public/test/test_browser_context.h"
16 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
17 20
18 namespace ash { 21 namespace ash {
19 namespace test { 22 namespace test {
20 23
21 TestShellDelegate::TestShellDelegate() 24 TestShellDelegate::TestShellDelegate()
22 : locked_(false), 25 : spoken_feedback_enabled_(false),
23 session_started_(true),
24 spoken_feedback_enabled_(false),
25 high_contrast_enabled_(false), 26 high_contrast_enabled_(false),
26 screen_magnifier_enabled_(false), 27 screen_magnifier_enabled_(false),
27 screen_magnifier_type_(kDefaultMagnifierType), 28 screen_magnifier_type_(kDefaultMagnifierType),
28 user_logged_in_(true), 29 num_exit_requests_(0),
29 can_lock_screen_(true), 30 test_session_state_delegate_(NULL) {
30 num_exit_requests_(0) {
31 } 31 }
32 32
33 TestShellDelegate::~TestShellDelegate() { 33 TestShellDelegate::~TestShellDelegate() {
34 } 34 }
35 35
36 bool TestShellDelegate::IsUserLoggedIn() const {
37 return user_logged_in_;
38 }
39
40 bool TestShellDelegate::IsSessionStarted() const {
41 return session_started_;
42 }
43
44 bool TestShellDelegate::IsGuestSession() const {
45 return false;
46 }
47
48 bool TestShellDelegate::IsFirstRunAfterBoot() const { 36 bool TestShellDelegate::IsFirstRunAfterBoot() const {
49 return false; 37 return false;
50 } 38 }
51 39
52 bool TestShellDelegate::IsMultiProfilesEnabled() const { 40 bool TestShellDelegate::IsMultiProfilesEnabled() const {
53 return false; 41 return false;
54 } 42 }
55 43
56 bool TestShellDelegate::IsRunningInForcedAppMode() const { 44 bool TestShellDelegate::IsRunningInForcedAppMode() const {
57 return false; 45 return false;
58 } 46 }
59 47
60 bool TestShellDelegate::CanLockScreen() const {
61 return user_logged_in_ && can_lock_screen_;
62 }
63
64 void TestShellDelegate::LockScreen() {
65 locked_ = true;
66 }
67
68 void TestShellDelegate::UnlockScreen() {
69 locked_ = false;
70 }
71
72 bool TestShellDelegate::IsScreenLocked() const {
73 return locked_;
74 }
75
76 void TestShellDelegate::PreInit() { 48 void TestShellDelegate::PreInit() {
77 } 49 }
78 50
79 void TestShellDelegate::Shutdown() { 51 void TestShellDelegate::Shutdown() {
80 } 52 }
81 53
82 void TestShellDelegate::Exit() { 54 void TestShellDelegate::Exit() {
83 num_exit_requests_++; 55 num_exit_requests_++;
84 } 56 }
85 57
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 150 }
179 151
180 UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() { 152 UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() {
181 return NULL; 153 return NULL;
182 } 154 }
183 155
184 CapsLockDelegate* TestShellDelegate::CreateCapsLockDelegate() { 156 CapsLockDelegate* TestShellDelegate::CreateCapsLockDelegate() {
185 return new CapsLockDelegateStub; 157 return new CapsLockDelegateStub;
186 } 158 }
187 159
160 SessionStateDelegate* TestShellDelegate::CreateSessionStateDelegate() {
161 DCHECK(!test_session_state_delegate_);
162 test_session_state_delegate_ = new TestSessionStateDelegate();
163 return test_session_state_delegate_;
164 }
165
188 aura::client::UserActionClient* TestShellDelegate::CreateUserActionClient() { 166 aura::client::UserActionClient* TestShellDelegate::CreateUserActionClient() {
189 return NULL; 167 return NULL;
190 } 168 }
191 169
192 void TestShellDelegate::OpenFeedbackPage() { 170 void TestShellDelegate::OpenFeedbackPage() {
193 } 171 }
194 172
195 void TestShellDelegate::RecordUserMetricsAction(UserMetricsAction action) { 173 void TestShellDelegate::RecordUserMetricsAction(UserMetricsAction action) {
196 } 174 }
197 175
(...skipping 24 matching lines...) Expand all
222 } 200 }
223 201
224 double TestShellDelegate::GetSavedScreenMagnifierScale() { 202 double TestShellDelegate::GetSavedScreenMagnifierScale() {
225 return std::numeric_limits<double>::min(); 203 return std::numeric_limits<double>::min();
226 } 204 }
227 205
228 RootWindowHostFactory* TestShellDelegate::CreateRootWindowHostFactory() { 206 RootWindowHostFactory* TestShellDelegate::CreateRootWindowHostFactory() {
229 return RootWindowHostFactory::Create(); 207 return RootWindowHostFactory::Create();
230 } 208 }
231 209
232 void TestShellDelegate::SetSessionStarted(bool session_started) {
233 session_started_ = session_started;
234 if (session_started)
235 user_logged_in_ = true;
236 }
237
238 void TestShellDelegate::SetUserLoggedIn(bool user_logged_in) {
239 user_logged_in_ = user_logged_in;
240 if (!user_logged_in)
241 session_started_ = false;
242 }
243
244 void TestShellDelegate::SetCanLockScreen(bool can_lock_screen) {
245 can_lock_screen_ = can_lock_screen;
246 }
247
248 base::string16 TestShellDelegate::GetProductName() const { 210 base::string16 TestShellDelegate::GetProductName() const {
249 return base::string16(); 211 return base::string16();
250 } 212 }
251 213
214 TestSessionStateDelegate* TestShellDelegate::test_session_state_delegate() {
215 return test_session_state_delegate_;
216 }
252 217
253 } // namespace test 218 } // namespace test
254 } // namespace ash 219 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698