1 /* 2 * Copyright (c) 2021-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 16 #ifndef FRAMEWORKS_WM_TEST_UT_MOCK_DISPLAY_MANAGER_ADAPTER_H 17 #define FRAMEWORKS_WM_TEST_UT_MOCK_DISPLAY_MANAGER_ADAPTER_H 18 #include <gmock/gmock.h> 19 20 #include "display_manager_adapter.h" 21 22 namespace OHOS { 23 namespace Rosen { 24 class MockDisplayManagerAdapter : public DisplayManagerAdapter { 25 public: 26 MOCK_METHOD0(Clear, void()); 27 MOCK_METHOD2(RegisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent, 28 DisplayManagerAgentType type)); 29 MOCK_METHOD2(UnregisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent, 30 DisplayManagerAgentType type)); 31 MOCK_METHOD0(GetDefaultDisplayInfo, sptr<DisplayInfo>()); 32 MOCK_METHOD1(GetDisplayInfoByScreenId, sptr<DisplayInfo>(ScreenId screenId)); 33 MOCK_METHOD1(GetDisplaySnapshot, std::shared_ptr<Media::PixelMap>(DisplayId displayId)); 34 35 MOCK_METHOD1(WakeUpBegin, bool(PowerStateChangeReason reason)); 36 MOCK_METHOD0(WakeUpEnd, bool()); 37 MOCK_METHOD1(SuspendBegin, bool(PowerStateChangeReason reason)); 38 MOCK_METHOD0(SuspendEnd, bool()); 39 MOCK_METHOD1(SetDisplayState, bool(DisplayState state)); 40 MOCK_METHOD1(GetDisplayState, DisplayState(DisplayId displayId)); 41 MOCK_METHOD1(NotifyDisplayEvent, void(DisplayEvent event)); 42 MOCK_METHOD1(GetDisplayInfo, sptr<DisplayInfo>(DisplayId displayId)); 43 MOCK_METHOD1(GetCutoutInfo, sptr<CutoutInfo>(DisplayId displayId)); 44 }; 45 46 class MockScreenManagerAdapter : public ScreenManagerAdapter { 47 public: 48 MOCK_METHOD0(Clear, void()); 49 MOCK_METHOD2(RegisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent, 50 DisplayManagerAgentType type)); 51 MOCK_METHOD2(UnregisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent, 52 DisplayManagerAgentType type)); 53 MOCK_METHOD2(RequestRotation, bool(ScreenId screenId, Rotation rotation)); 54 MOCK_METHOD2(CreateVirtualScreen, ScreenId(VirtualScreenOption option, 55 const sptr<IDisplayManagerAgent>& displayManagerAgent)); 56 MOCK_METHOD1(DestroyVirtualScreen, DMError(ScreenId screenId)); 57 MOCK_METHOD2(SetVirtualScreenSurface, DMError(ScreenId screenId, sptr<Surface> surface)); 58 MOCK_METHOD1(GetScreenGroupInfoById, sptr<ScreenGroupInfo>(ScreenId screenId)); 59 MOCK_METHOD0(GetAllScreenInfos, std::vector<sptr<ScreenInfo>>()); 60 MOCK_METHOD2(MakeMirror, ScreenId(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId)); 61 MOCK_METHOD2(MakeExpand, ScreenId(std::vector<ScreenId> screenId, std::vector<Point> startPoint)); 62 MOCK_METHOD2(SetScreenActiveMode, bool(ScreenId screenId, uint32_t modeId)); 63 MOCK_METHOD1(GetScreenInfo, sptr<ScreenInfo>(ScreenId screenId)); 64 MOCK_METHOD2(SetScreenPowerForAll, bool(ScreenPowerState state, PowerStateChangeReason reason)); 65 MOCK_METHOD1(GetScreenPower, ScreenPowerState(ScreenId dmsScreenId)); 66 67 MOCK_METHOD2(GetScreenSupportedColorGamuts, DMError(ScreenId screenId, std::vector<ScreenColorGamut>& colorGamuts)); 68 MOCK_METHOD2(GetScreenColorGamut, DMError(ScreenId screenId, ScreenColorGamut& colorGamut)); 69 MOCK_METHOD2(SetScreenColorGamut, DMError(ScreenId screenId, int32_t colorGamutIdx)); 70 MOCK_METHOD2(GetScreenGamutMap, DMError(ScreenId screenId, ScreenGamutMap& gamutMap)); 71 MOCK_METHOD2(SetScreenGamutMap, DMError(ScreenId screenId, ScreenGamutMap gamutMap)); 72 MOCK_METHOD1(SetScreenColorTransform, DMError(ScreenId screenId)); 73 74 MOCK_METHOD1(RemoveVirtualScreenFromGroup, void(std::vector<ScreenId> screens)); 75 MOCK_METHOD1(SetScreenRotationLocked, void(bool isLocked)); 76 MOCK_METHOD0(IsScreenRotationLocked, bool()); 77 }; 78 } 79 } // namespace OHOS 80 81 #endif // FRAMEWORKS_WM_TEST_UT_MOCK_DISPLAY_MANAGER_ADAPTER_H