1 /* 2 * Copyright (c) 2025 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 16 #ifndef POWERMGR_CLIENT_CALLBACK_TEST_H 17 #define POWERMGR_CLIENT_CALLBACK_TEST_H 18 19 #include <gtest/gtest.h> 20 21 #include "power_mgr_service.h" 22 #include "power_runninglock_callback_stub.h" 23 #include "screen_off_pre_callback_stub.h" 24 #include "sync_hibernate_callback_stub.h" 25 #include "sync_sleep_callback_stub.h" 26 27 namespace OHOS { 28 namespace PowerMgr { 29 class PowerMgrClientCallbackTest : public testing::Test { 30 public: 31 32 class PowerRunningLockTest1Callback : public IRemoteStub<IPowerRunninglockCallback> { 33 public: PowerRunningLockTest1Callback()34 PowerRunningLockTest1Callback() {}; ~PowerRunningLockTest1Callback()35 virtual ~PowerRunningLockTest1Callback() {}; 36 virtual void HandleRunningLockMessage(std::string message) override; 37 }; 38 39 class ScreenOffPreTest1Callback : public IRemoteStub<IScreenOffPreCallback> { 40 public: ScreenOffPreTest1Callback()41 ScreenOffPreTest1Callback() {}; ~ScreenOffPreTest1Callback()42 virtual ~ScreenOffPreTest1Callback() {}; 43 virtual void OnScreenStateChanged(uint32_t state) override; 44 }; 45 46 class PowerSyncHibernateTest1Callback : public IRemoteStub<ISyncHibernateCallback> { 47 public: PowerSyncHibernateTest1Callback()48 PowerSyncHibernateTest1Callback() {}; ~PowerSyncHibernateTest1Callback()49 virtual ~PowerSyncHibernateTest1Callback() {}; 50 virtual void OnSyncHibernate() override; 51 virtual void OnSyncWakeup(bool hibernateResult = false) override; 52 }; 53 54 class PowerSyncSleepTest1Callback : public IRemoteStub<ISyncSleepCallback> { 55 public: PowerSyncSleepTest1Callback()56 PowerSyncSleepTest1Callback() {}; ~PowerSyncSleepTest1Callback()57 virtual ~PowerSyncSleepTest1Callback() {}; 58 virtual void OnSyncSleep(bool onForceSleep) override; 59 virtual void OnSyncWakeup(bool onForceSleep) override; 60 }; 61 }; 62 } // namespace PowerMgr 63 } // namespace OHOS 64 #endif // POWERMGR_CLIENT_CALLBACK_TEST_H