| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/session/session_controller.h" | 5 #include "ash/session/session_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 // Tests that session state can be set and reflected properly. | 180 // Tests that session state can be set and reflected properly. |
| 181 TEST_F(SessionControllerTest, SessionState) { | 181 TEST_F(SessionControllerTest, SessionState) { |
| 182 const struct { | 182 const struct { |
| 183 SessionState state; | 183 SessionState state; |
| 184 bool expected_is_screen_locked; | 184 bool expected_is_screen_locked; |
| 185 bool expected_is_user_session_blocked; | 185 bool expected_is_user_session_blocked; |
| 186 } kTestCases[] = { | 186 } kTestCases[] = { |
| 187 {SessionState::OOBE, false, true}, | 187 {SessionState::OOBE, false, true}, |
| 188 {SessionState::LOGIN_PRIMARY, false, true}, | 188 {SessionState::LOGIN_PRIMARY, false, true}, |
| 189 {SessionState::LOGGED_IN_NOT_ACTIVE, false, true}, | 189 {SessionState::LOGGED_IN_NOT_ACTIVE, false, false}, |
| 190 {SessionState::ACTIVE, false, false}, | 190 {SessionState::ACTIVE, false, false}, |
| 191 {SessionState::LOCKED, true, true}, | 191 {SessionState::LOCKED, true, true}, |
| 192 {SessionState::LOGIN_SECONDARY, false, true}, | 192 {SessionState::LOGIN_SECONDARY, false, true}, |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 mojom::SessionInfo info; | 195 mojom::SessionInfo info; |
| 196 FillDefaultSessionInfo(&info); | 196 FillDefaultSessionInfo(&info); |
| 197 for (const auto& test_case : kTestCases) { | 197 for (const auto& test_case : kTestCases) { |
| 198 info.state = test_case.state; | 198 info.state = test_case.state; |
| 199 SetSessionInfo(info); | 199 SetSessionInfo(info); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // Mark a running unlock animation unblocks user session. | 326 // Mark a running unlock animation unblocks user session. |
| 327 controller()->RunUnlockAnimation(base::Closure()); | 327 controller()->RunUnlockAnimation(base::Closure()); |
| 328 EXPECT_FALSE(controller()->IsUserSessionBlocked()); | 328 EXPECT_FALSE(controller()->IsUserSessionBlocked()); |
| 329 | 329 |
| 330 const struct { | 330 const struct { |
| 331 SessionState state; | 331 SessionState state; |
| 332 bool expected_is_user_session_blocked; | 332 bool expected_is_user_session_blocked; |
| 333 } kTestCases[] = { | 333 } kTestCases[] = { |
| 334 {SessionState::OOBE, true}, | 334 {SessionState::OOBE, true}, |
| 335 {SessionState::LOGIN_PRIMARY, true}, | 335 {SessionState::LOGIN_PRIMARY, true}, |
| 336 {SessionState::LOGGED_IN_NOT_ACTIVE, true}, | 336 {SessionState::LOGGED_IN_NOT_ACTIVE, false}, |
| 337 {SessionState::ACTIVE, false}, | 337 {SessionState::ACTIVE, false}, |
| 338 {SessionState::LOGIN_SECONDARY, true}, | 338 {SessionState::LOGIN_SECONDARY, true}, |
| 339 }; | 339 }; |
| 340 for (const auto& test_case : kTestCases) { | 340 for (const auto& test_case : kTestCases) { |
| 341 info.state = test_case.state; | 341 info.state = test_case.state; |
| 342 SetSessionInfo(info); | 342 SetSessionInfo(info); |
| 343 | 343 |
| 344 // Mark a running unlock animation. | 344 // Mark a running unlock animation. |
| 345 controller()->RunUnlockAnimation(base::Closure()); | 345 controller()->RunUnlockAnimation(base::Closure()); |
| 346 | 346 |
| 347 EXPECT_EQ(test_case.expected_is_user_session_blocked, | 347 EXPECT_EQ(test_case.expected_is_user_session_blocked, |
| 348 controller()->IsUserSessionBlocked()) | 348 controller()->IsUserSessionBlocked()) |
| 349 << "Test case state=" << static_cast<int>(test_case.state); | 349 << "Test case state=" << static_cast<int>(test_case.state); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace | 353 } // namespace |
| 354 } // namespace ash | 354 } // namespace ash |
| OLD | NEW |