| OLD | NEW |
| 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" | |
| 12 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 14 #include "ash/test/test_launcher_delegate.h" | 13 #include "ash/test/test_launcher_delegate.h" |
| 15 #include "ash/test/test_session_state_delegate.h" | |
| 16 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 17 #include "base/logging.h" | |
| 18 #include "content/public/test/test_browser_context.h" | 15 #include "content/public/test/test_browser_context.h" |
| 19 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 20 | 17 |
| 21 namespace ash { | 18 namespace ash { |
| 22 namespace test { | 19 namespace test { |
| 23 | 20 |
| 24 TestShellDelegate::TestShellDelegate() | 21 TestShellDelegate::TestShellDelegate() |
| 25 : spoken_feedback_enabled_(false), | 22 : locked_(false), |
| 23 session_started_(true), |
| 24 spoken_feedback_enabled_(false), |
| 26 high_contrast_enabled_(false), | 25 high_contrast_enabled_(false), |
| 27 screen_magnifier_enabled_(false), | 26 screen_magnifier_enabled_(false), |
| 28 screen_magnifier_type_(kDefaultMagnifierType), | 27 screen_magnifier_type_(kDefaultMagnifierType), |
| 29 num_exit_requests_(0), | 28 user_logged_in_(true), |
| 30 test_session_state_delegate_(NULL) { | 29 can_lock_screen_(true), |
| 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 |
| 36 bool TestShellDelegate::IsFirstRunAfterBoot() const { | 48 bool TestShellDelegate::IsFirstRunAfterBoot() const { |
| 37 return false; | 49 return false; |
| 38 } | 50 } |
| 39 | 51 |
| 40 bool TestShellDelegate::IsMultiProfilesEnabled() const { | 52 bool TestShellDelegate::IsMultiProfilesEnabled() const { |
| 41 return false; | 53 return false; |
| 42 } | 54 } |
| 43 | 55 |
| 44 bool TestShellDelegate::IsRunningInForcedAppMode() const { | 56 bool TestShellDelegate::IsRunningInForcedAppMode() const { |
| 45 return false; | 57 return false; |
| 46 } | 58 } |
| 47 | 59 |
| 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 |
| 48 void TestShellDelegate::PreInit() { | 76 void TestShellDelegate::PreInit() { |
| 49 } | 77 } |
| 50 | 78 |
| 51 void TestShellDelegate::Shutdown() { | 79 void TestShellDelegate::Shutdown() { |
| 52 } | 80 } |
| 53 | 81 |
| 54 void TestShellDelegate::Exit() { | 82 void TestShellDelegate::Exit() { |
| 55 num_exit_requests_++; | 83 num_exit_requests_++; |
| 56 } | 84 } |
| 57 | 85 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 178 } |
| 151 | 179 |
| 152 UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() { | 180 UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() { |
| 153 return NULL; | 181 return NULL; |
| 154 } | 182 } |
| 155 | 183 |
| 156 CapsLockDelegate* TestShellDelegate::CreateCapsLockDelegate() { | 184 CapsLockDelegate* TestShellDelegate::CreateCapsLockDelegate() { |
| 157 return new CapsLockDelegateStub; | 185 return new CapsLockDelegateStub; |
| 158 } | 186 } |
| 159 | 187 |
| 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 | |
| 166 aura::client::UserActionClient* TestShellDelegate::CreateUserActionClient() { | 188 aura::client::UserActionClient* TestShellDelegate::CreateUserActionClient() { |
| 167 return NULL; | 189 return NULL; |
| 168 } | 190 } |
| 169 | 191 |
| 170 void TestShellDelegate::OpenFeedbackPage() { | 192 void TestShellDelegate::OpenFeedbackPage() { |
| 171 } | 193 } |
| 172 | 194 |
| 173 void TestShellDelegate::RecordUserMetricsAction(UserMetricsAction action) { | 195 void TestShellDelegate::RecordUserMetricsAction(UserMetricsAction action) { |
| 174 } | 196 } |
| 175 | 197 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 200 } | 222 } |
| 201 | 223 |
| 202 double TestShellDelegate::GetSavedScreenMagnifierScale() { | 224 double TestShellDelegate::GetSavedScreenMagnifierScale() { |
| 203 return std::numeric_limits<double>::min(); | 225 return std::numeric_limits<double>::min(); |
| 204 } | 226 } |
| 205 | 227 |
| 206 RootWindowHostFactory* TestShellDelegate::CreateRootWindowHostFactory() { | 228 RootWindowHostFactory* TestShellDelegate::CreateRootWindowHostFactory() { |
| 207 return RootWindowHostFactory::Create(); | 229 return RootWindowHostFactory::Create(); |
| 208 } | 230 } |
| 209 | 231 |
| 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 |
| 210 base::string16 TestShellDelegate::GetProductName() const { | 248 base::string16 TestShellDelegate::GetProductName() const { |
| 211 return base::string16(); | 249 return base::string16(); |
| 212 } | 250 } |
| 213 | 251 |
| 214 TestSessionStateDelegate* TestShellDelegate::test_session_state_delegate() { | |
| 215 return test_session_state_delegate_; | |
| 216 } | |
| 217 | 252 |
| 218 } // namespace test | 253 } // namespace test |
| 219 } // namespace ash | 254 } // namespace ash |
| OLD | NEW |