1 /* 2 * Copyright (c) 2021 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_WINDOW_ADAPTER_H 17 #define FRAMEWORKS_WM_TEST_UT_MOCK_WINDOW_ADAPTER_H 18 #include <gmock/gmock.h> 19 20 #include "window_adapter.h" 21 22 namespace OHOS { 23 namespace Rosen { 24 class MockWindowAdapter : public WindowAdapter { 25 public: 26 MOCK_METHOD5(CreateWindow, WMError(sptr<IWindow>& window, sptr<WindowProperty>& windowProperty, 27 std::shared_ptr<RSSurfaceNode> surfaceNode, uint32_t& windowId, const sptr<IRemoteObject>& token)); 28 MOCK_METHOD1(AddWindow, WMError(sptr<WindowProperty>& windowProperty)); 29 MOCK_METHOD2(RemoveWindow, WMError(uint32_t windowId, bool isFromInnerkits)); 30 MOCK_METHOD0(ClearWindowAdapter, void()); 31 MOCK_METHOD1(DestroyWindow, WMError(uint32_t windowId)); 32 MOCK_METHOD2(UpdateProperty, WMError(sptr<WindowProperty>& windowProperty, PropertyChangeAction action)); 33 MOCK_METHOD2(GetTopWindowId, WMError(uint32_t mainWinId, uint32_t& topWinId)); 34 MOCK_METHOD4(GetAvoidAreaByType, WMError( 35 uint32_t windowId, AvoidAreaType type, AvoidArea& avoidArea, const Rect& rect)); 36 MOCK_METHOD2(BindDialogTarget, WMError(uint32_t& windowId, sptr<IRemoteObject> targetToken)); 37 MOCK_METHOD2(UpdateRsTree, WMError(uint32_t windowId, bool isAdd)); 38 MOCK_METHOD1(MinimizeAllAppWindows, WMError(DisplayId displayId)); 39 MOCK_METHOD0(ToggleShownStateForAllAppWindows, WMError()); 40 MOCK_METHOD2(ProcessPointDown, void(uint32_t windowId, bool isPointDown)); 41 MOCK_METHOD1(ProcessPointUp, void(uint32_t windowId)); 42 MOCK_METHOD1(RequestFocus, WMError(uint32_t windowId)); 43 MOCK_METHOD2(NotifyWindowTransition, WMError(sptr<WindowTransitionInfo> from, sptr<WindowTransitionInfo> to)); 44 MOCK_METHOD2(GetModeChangeHotZones, WMError(DisplayId displayId, ModeChangeHotZones& hotZones)); 45 MOCK_METHOD3(NotifyServerReadyToMoveOrDrag, void(uint32_t windowId, sptr<WindowProperty>& windowProperty, 46 sptr<MoveDragProperty>& moveDragProperty)); 47 MOCK_METHOD2(RegisterWindowManagerAgent, WMError(WindowManagerAgentType type, 48 const sptr<IWindowManagerAgent>& windowManagerAgent)); 49 MOCK_METHOD2(UnregisterWindowManagerAgent, WMError(WindowManagerAgentType type, 50 const sptr<IWindowManagerAgent>& windowManagerAgent)); 51 MOCK_METHOD1(GetVisibilityWindowInfo, WMError(std::vector<sptr<WindowVisibilityInfo>>& infos)); 52 MOCK_METHOD1(GetAccessibilityWindowInfo, WMError(std::vector<sptr<AccessibilityWindowInfo>>& infos)); 53 MOCK_METHOD2(GetUnreliableWindowInfo, WMError(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos)); 54 MOCK_METHOD1(RaiseToAppTop, WMError(uint32_t windowId)); 55 MOCK_METHOD1(GetSystemConfig, WMError(SystemConfig& systemConfig)); 56 MOCK_METHOD2(DispatchKeyEvent, void(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event)); 57 MOCK_METHOD0(GetMaximizeMode, MaximizeMode()); 58 MOCK_METHOD1(GetWindowModeType, WMError(WindowModeType& windowModeType)); 59 MOCK_METHOD6(RecoverAndReconnectSceneSession, WMError(const sptr<ISessionStage>& sessionStage, 60 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 61 sptr<ISession>& session, sptr<WindowSessionProperty> property, sptr<IRemoteObject> token)); 62 MOCK_METHOD6(RecoverAndConnectSpecificSession, void(const sptr<ISessionStage>& sessionStage, 63 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 64 sptr<WindowSessionProperty> property, sptr<ISession>& session, sptr<IRemoteObject> token)); 65 MOCK_METHOD2(SetParentWindow, WMError(int32_t subWindowId, int32_t newParentWindowId)); 66 }; 67 } 68 } // namespace OHOS 69 70 #endif // FRAMEWORKS_WM_TEST_UT_MOCK_WINDOW_ADAPTER_H