| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 // Tests that session state can be set and reflected properly. | 176 // Tests that session state can be set and reflected properly. |
| 177 TEST_F(SessionControllerTest, SessionState) { | 177 TEST_F(SessionControllerTest, SessionState) { |
| 178 const struct { | 178 const struct { |
| 179 SessionState state; | 179 SessionState state; |
| 180 bool expected_is_screen_locked; | 180 bool expected_is_screen_locked; |
| 181 bool expected_is_user_session_blocked; | 181 bool expected_is_user_session_blocked; |
| 182 } kTestCases[] = { | 182 } kTestCases[] = { |
| 183 {SessionState::OOBE, false, true}, | 183 {SessionState::OOBE, false, true}, |
| 184 {SessionState::LOGIN_PRIMARY, false, true}, | 184 {SessionState::LOGIN_PRIMARY, false, true}, |
| 185 {SessionState::LOGGED_IN_NOT_ACTIVE, false, true}, | 185 {SessionState::LOGGED_IN_NOT_ACTIVE, false, false}, |
| 186 {SessionState::ACTIVE, false, false}, | 186 {SessionState::ACTIVE, false, false}, |
| 187 {SessionState::LOCKED, true, true}, | 187 {SessionState::LOCKED, true, true}, |
| 188 {SessionState::LOGIN_SECONDARY, false, true}, | 188 {SessionState::LOGIN_SECONDARY, false, true}, |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 mojom::SessionInfo info; | 191 mojom::SessionInfo info; |
| 192 FillDefaultSessionInfo(&info); | 192 FillDefaultSessionInfo(&info); |
| 193 for (const auto& test_case : kTestCases) { | 193 for (const auto& test_case : kTestCases) { |
| 194 info.state = test_case.state; | 194 info.state = test_case.state; |
| 195 SetSessionInfo(info); | 195 SetSessionInfo(info); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // Mark a running unlock animation unblocks user session. | 322 // Mark a running unlock animation unblocks user session. |
| 323 controller()->RunUnlockAnimation(base::Closure()); | 323 controller()->RunUnlockAnimation(base::Closure()); |
| 324 EXPECT_FALSE(controller()->IsUserSessionBlocked()); | 324 EXPECT_FALSE(controller()->IsUserSessionBlocked()); |
| 325 | 325 |
| 326 const struct { | 326 const struct { |
| 327 SessionState state; | 327 SessionState state; |
| 328 bool expected_is_user_session_blocked; | 328 bool expected_is_user_session_blocked; |
| 329 } kTestCases[] = { | 329 } kTestCases[] = { |
| 330 {SessionState::OOBE, true}, | 330 {SessionState::OOBE, true}, |
| 331 {SessionState::LOGIN_PRIMARY, true}, | 331 {SessionState::LOGIN_PRIMARY, true}, |
| 332 {SessionState::LOGGED_IN_NOT_ACTIVE, true}, | 332 {SessionState::LOGGED_IN_NOT_ACTIVE, false}, |
| 333 {SessionState::ACTIVE, false}, | 333 {SessionState::ACTIVE, false}, |
| 334 {SessionState::LOGIN_SECONDARY, true}, | 334 {SessionState::LOGIN_SECONDARY, true}, |
| 335 }; | 335 }; |
| 336 for (const auto& test_case : kTestCases) { | 336 for (const auto& test_case : kTestCases) { |
| 337 info.state = test_case.state; | 337 info.state = test_case.state; |
| 338 SetSessionInfo(info); | 338 SetSessionInfo(info); |
| 339 | 339 |
| 340 // Mark a running unlock animation. | 340 // Mark a running unlock animation. |
| 341 controller()->RunUnlockAnimation(base::Closure()); | 341 controller()->RunUnlockAnimation(base::Closure()); |
| 342 | 342 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 362 controller()->UpdateUserSession(std::move(session)); | 362 controller()->UpdateUserSession(std::move(session)); |
| 363 | 363 |
| 364 EXPECT_TRUE(controller()->IsUserChild()); | 364 EXPECT_TRUE(controller()->IsUserChild()); |
| 365 | 365 |
| 366 // Child accounts are supervised. | 366 // Child accounts are supervised. |
| 367 EXPECT_TRUE(controller()->IsUserSupervised()); | 367 EXPECT_TRUE(controller()->IsUserSupervised()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace | 370 } // namespace |
| 371 } // namespace ash | 371 } // namespace ash |
| OLD | NEW |