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(GetDefaultDisplayId, DisplayId()); 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 }; 44 45 class MockScreenManagerAdapter : public ScreenManagerAdapter { 46 public: 47 MOCK_METHOD0(Clear, void()); 48 MOCK_METHOD2(RegisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent, 49 DisplayManagerAgentType type)); 50 MOCK_METHOD2(UnregisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent, 51 DisplayManagerAgentType type)); 52 MOCK_METHOD2(RequestRotation, bool(ScreenId screenId, Rotation rotation)); 53 MOCK_METHOD1(CreateVirtualScreen, ScreenId(VirtualScreenOption option)); 54 MOCK_METHOD1(DestroyVirtualScreen, DMError(ScreenId screenId)); 55 MOCK_METHOD2(SetVirtualScreenSurface, DMError(ScreenId screenId, sptr<Surface> surface)); 56 MOCK_METHOD1(GetScreenGroupInfoById, sptr<ScreenGroupInfo>(ScreenId screenId)); 57 MOCK_METHOD0(GetAllScreenInfos, std::vector<sptr<ScreenInfo>>()); 58 MOCK_METHOD2(MakeMirror, ScreenId(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId)); 59 MOCK_METHOD2(MakeExpand, ScreenId(std::vector<ScreenId> screenId, std::vector<Point> startPoint)); 60 MOCK_METHOD2(SetScreenActiveMode, bool(ScreenId screenId, uint32_t modeId)); 61 MOCK_METHOD1(GetScreenInfo, sptr<ScreenInfo>(ScreenId screenId)); 62 MOCK_METHOD2(SetScreenPowerForAll, bool(ScreenPowerState state, PowerStateChangeReason reason)); 63 MOCK_METHOD1(GetScreenPower, ScreenPowerState(ScreenId dmsScreenId)); 64 65 MOCK_METHOD2(GetScreenSupportedColorGamuts, DMError(ScreenId screenId, std::vector<ScreenColorGamut>& colorGamuts)); 66 MOCK_METHOD2(GetScreenColorGamut, DMError(ScreenId screenId, ScreenColorGamut& colorGamut)); 67 MOCK_METHOD2(SetScreenColorGamut, DMError(ScreenId screenId, int32_t colorGamutIdx)); 68 MOCK_METHOD2(GetScreenGamutMap, DMError(ScreenId screenId, ScreenGamutMap& gamutMap)); 69 MOCK_METHOD2(SetScreenGamutMap, DMError(ScreenId screenId, ScreenGamutMap gamutMap)); 70 MOCK_METHOD1(SetScreenColorTransform, DMError(ScreenId screenId)); 71 }; 72 } 73 } // namespace OHOS 74 75 #endif // FRAMEWORKS_WM_TEST_UT_MOCK_DISPLAY_MANAGER_ADAPTER_H