OLD | NEW |
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/test/test_session_state_delegate.h" | 5 #include "ash/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" |
| 11 #include "ash/common/wm_shell.h" |
11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "components/signin/core/account_id/account_id.h" | 16 #include "components/signin/core/account_id/account_id.h" |
16 #include "components/user_manager/user_info.h" | 17 #include "components/user_manager/user_info.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace ash { | 20 namespace ash { |
20 namespace test { | 21 namespace test { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 user_manager_->SessionStarted(); | 176 user_manager_->SessionStarted(); |
176 session_state_ = SESSION_STATE_ACTIVE; | 177 session_state_ = SESSION_STATE_ACTIVE; |
177 Shell::GetInstance()->CreateShelf(); | 178 Shell::GetInstance()->CreateShelf(); |
178 Shell::GetInstance()->UpdateAfterLoginStatusChange(LoginStatus::USER); | 179 Shell::GetInstance()->UpdateAfterLoginStatusChange(LoginStatus::USER); |
179 } else { | 180 } else { |
180 session_state_ = SESSION_STATE_LOGIN_PRIMARY; | 181 session_state_ = SESSION_STATE_LOGIN_PRIMARY; |
181 user_manager_.reset(new TestUserManager()); | 182 user_manager_.reset(new TestUserManager()); |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
| 186 // static |
185 void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) { | 187 void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) { |
186 can_lock_screen_ = can_lock_screen; | 188 CHECK(WmShell::HasInstance()); |
| 189 static_cast<ash::test::TestSessionStateDelegate*>( |
| 190 WmShell::Get()->GetSessionStateDelegate()) |
| 191 ->can_lock_screen_ = can_lock_screen; |
187 } | 192 } |
188 | 193 |
189 void TestSessionStateDelegate::SetShouldLockScreenBeforeSuspending( | 194 void TestSessionStateDelegate::SetShouldLockScreenBeforeSuspending( |
190 bool should_lock) { | 195 bool should_lock) { |
191 should_lock_screen_before_suspending_ = should_lock; | 196 should_lock_screen_before_suspending_ = should_lock; |
192 } | 197 } |
193 | 198 |
194 void TestSessionStateDelegate::SetUserAddingScreenRunning( | 199 void TestSessionStateDelegate::SetUserAddingScreenRunning( |
195 bool user_adding_screen_running) { | 200 bool user_adding_screen_running) { |
196 user_adding_screen_running_ = user_adding_screen_running; | 201 user_adding_screen_running_ = user_adding_screen_running; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 248 } |
244 | 249 |
245 void TestSessionStateDelegate::AddSessionStateObserver( | 250 void TestSessionStateDelegate::AddSessionStateObserver( |
246 SessionStateObserver* observer) {} | 251 SessionStateObserver* observer) {} |
247 | 252 |
248 void TestSessionStateDelegate::RemoveSessionStateObserver( | 253 void TestSessionStateDelegate::RemoveSessionStateObserver( |
249 SessionStateObserver* observer) {} | 254 SessionStateObserver* observer) {} |
250 | 255 |
251 } // namespace test | 256 } // namespace test |
252 } // namespace ash | 257 } // namespace ash |
OLD | NEW |