| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef ASH_TEST_TEST_SESSION_CONTROLLER_CLIENT_H_ | 5 #ifndef ASH_TEST_TEST_SESSION_CONTROLLER_CLIENT_H_ |
| 6 #define ASH_TEST_TEST_SESSION_CONTROLLER_CLIENT_H_ | 6 #define ASH_TEST_TEST_SESSION_CONTROLLER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "ash/public/interfaces/session_controller.mojom.h" | 12 #include "ash/public/interfaces/session_controller.mojom.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "components/user_manager/user_type.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 15 | 16 |
| 16 class AccountId; | 17 class AccountId; |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| 20 class SessionController; | 21 class SessionController; |
| 21 | 22 |
| 22 namespace test { | 23 namespace test { |
| 23 | 24 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 void SetSessionState(session_manager::SessionState state); | 46 void SetSessionState(session_manager::SessionState state); |
| 46 | 47 |
| 47 // Creates the |count| pre-defined user sessions. The users are named by | 48 // Creates the |count| pre-defined user sessions. The users are named by |
| 48 // numbers using "user%d@tray" template. Note that existing user sessions | 49 // numbers using "user%d@tray" template. Note that existing user sessions |
| 49 // prior this call will be removed without sending out notifications. | 50 // prior this call will be removed without sending out notifications. |
| 50 void CreatePredefinedUserSessions(int count); | 51 void CreatePredefinedUserSessions(int count); |
| 51 | 52 |
| 52 // Adds a user session from a given display email. The display email will be | 53 // Adds a user session from a given display email. The display email will be |
| 53 // canonicalized and used to construct an AccountId. |enable_settings| sets | 54 // canonicalized and used to construct an AccountId. |enable_settings| sets |
| 54 // whether web UI settings are allowed. | 55 // whether web UI settings are allowed. |
| 55 void AddUserSession(const std::string& display_email, | 56 void AddUserSession( |
| 56 bool enable_settings = true); | 57 const std::string& display_email, |
| 58 user_manager::UserType user_type = user_manager::USER_TYPE_REGULAR, |
| 59 bool enable_settings = true); |
| 57 | 60 |
| 58 // Simulates screen unlocking. It is virtual so that test cases can override | 61 // Simulates screen unlocking. It is virtual so that test cases can override |
| 59 // it. The default implementation sets the session state of SessionController | 62 // it. The default implementation sets the session state of SessionController |
| 60 // to be ACTIVE. | 63 // to be ACTIVE. |
| 61 virtual void UnlockScreen(); | 64 virtual void UnlockScreen(); |
| 62 | 65 |
| 63 // ash::mojom::SessionControllerClient: | 66 // ash::mojom::SessionControllerClient: |
| 64 void RequestLockScreen() override; | 67 void RequestLockScreen() override; |
| 65 void SwitchActiveUser(const AccountId& account_id) override; | 68 void SwitchActiveUser(const AccountId& account_id) override; |
| 66 void CycleActiveUser(CycleUserDirection direction) override; | 69 void CycleActiveUser(CycleUserDirection direction) override; |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 SessionController* const controller_; | 72 SessionController* const controller_; |
| 70 | 73 |
| 71 // Binds to the client interface. | 74 // Binds to the client interface. |
| 72 mojo::Binding<ash::mojom::SessionControllerClient> binding_; | 75 mojo::Binding<ash::mojom::SessionControllerClient> binding_; |
| 73 | 76 |
| 74 int fake_session_id_ = 0; | 77 int fake_session_id_ = 0; |
| 75 mojom::SessionInfoPtr session_info_; | 78 mojom::SessionInfoPtr session_info_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(TestSessionControllerClient); | 80 DISALLOW_COPY_AND_ASSIGN(TestSessionControllerClient); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 } // namespace test | 83 } // namespace test |
| 81 } // namespace ash | 84 } // namespace ash |
| 82 | 85 |
| 83 #endif // ASH_TEST_TEST_SESSION_CONTROLLER_CLIENT_H_ | 86 #endif // ASH_TEST_TEST_SESSION_CONTROLLER_CLIENT_H_ |
| OLD | NEW |