1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef NAPI_SCREENLOCK_CALL_BACK_TEST_H 16 #define NAPI_SCREENLOCK_CALL_BACK_TEST_H 17 18 #include "screenlock_callback_stub.h" 19 #include "screenlock_common.h" 20 #include "screenlock_event_list_test.h" 21 #include "screenlock_callback_interface.h" 22 #include "screenlock_manager_stub.h" 23 #include "screenlock_system_ability_stub.h" 24 25 namespace OHOS { 26 namespace ScreenLock { 27 class ScreenLockSystemAbilityTest : public ScreenLockSystemAbilityStub { 28 public: 29 explicit ScreenLockSystemAbilityTest(const EventListenerTest &eventListener); 30 virtual ~ScreenLockSystemAbilityTest(); 31 void OnCallBack(const SystemEvent &systemEvent) override; 32 }; 33 34 class ScreenlockCallbackTest : public ScreenLockCallbackStub { 35 public: 36 explicit ScreenlockCallbackTest(const EventListenerTest &eventListener); 37 virtual ~ScreenlockCallbackTest(); 38 void OnCallBack(const int32_t screenLockResult) override; 39 }; 40 41 class ScreenLockManagerStubTest : public ScreenLockManagerStub { 42 public: 43 ScreenLockManagerStubTest(); 44 explicit ScreenLockManagerStubTest(bool flag); 45 virtual ~ScreenLockManagerStubTest(); 46 virtual int32_t IsLocked(bool &isLocked); 47 virtual bool IsScreenLocked(); 48 virtual bool GetSecure(); 49 virtual int32_t Unlock(const sptr<ScreenLockCallbackInterface> &listener); 50 virtual int32_t UnlockScreen(const sptr<ScreenLockCallbackInterface> &listener); 51 virtual int32_t Lock(const sptr<ScreenLockCallbackInterface> &listener); 52 virtual int32_t Lock(int32_t userId); 53 virtual int32_t OnSystemEvent(const sptr<ScreenLockSystemAbilityInterface> &listener); 54 virtual int32_t SendScreenLockEvent(const std::string &event, int param); 55 virtual int32_t IsScreenLockDisabled(int userId, bool &isDisabled); 56 virtual int32_t SetScreenLockDisabled(bool disable, int userId); 57 virtual int32_t SetScreenLockAuthState(int authState, int32_t userId, std::string &authToken); 58 virtual int32_t GetScreenLockAuthState(int userId, int32_t &authState); 59 virtual int32_t RequestStrongAuth(int reasonFlag, int32_t userId); 60 virtual int32_t GetStrongAuth(int32_t userId, int32_t &reasonFlag); 61 virtual int32_t IsDeviceLocked(int userId, bool &isDeviceLocked); 62 virtual int32_t IsLockedWithUserId(int userId, bool &isLocked); 63 virtual int32_t RegisterInnerListener(const int32_t userId, const ListenType listenType, 64 const sptr<InnerListenerIf> &listener); 65 virtual int32_t UnRegisterInnerListener(const int32_t userId, const ListenType listenType, 66 const sptr<InnerListenerIf> &listener); 67 private: 68 bool mFlag = false; 69 }; 70 71 } // namespace ScreenLock 72 } // namespace OHOS 73 #endif // NAPI_SCREENLOCK_CALL_BACK_TEST_H