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_METHOD3(GetAvoidAreaByType, WMError(uint32_t windowId, AvoidAreaType type, AvoidArea& avoidArea)); 35 MOCK_METHOD2(BindDialogTarget, WMError(uint32_t& windowId, sptr<IRemoteObject> targetToken)); 36 MOCK_METHOD2(UpdateRsTree, WMError(uint32_t windowId, bool isAdd)); 37 MOCK_METHOD1(MinimizeAllAppWindows, WMError(DisplayId displayId)); 38 MOCK_METHOD0(ToggleShownStateForAllAppWindows, WMError()); 39 MOCK_METHOD2(ProcessPointDown, void(uint32_t windowId, bool isPointDown)); 40 MOCK_METHOD1(ProcessPointUp, void(uint32_t windowId)); 41 MOCK_METHOD1(RequestFocus, WMError(uint32_t windowId)); 42 MOCK_METHOD2(NotifyWindowTransition, WMError(sptr<WindowTransitionInfo> from, sptr<WindowTransitionInfo> to)); 43 MOCK_METHOD2(GetModeChangeHotZones, WMError(DisplayId displayId, ModeChangeHotZones& hotZones)); 44 MOCK_METHOD3(NotifyServerReadyToMoveOrDrag, void(uint32_t windowId, sptr<WindowProperty>& windowProperty, 45 sptr<MoveDragProperty>& moveDragProperty)); 46 MOCK_METHOD2(RegisterWindowManagerAgent, WMError(WindowManagerAgentType type, 47 const sptr<IWindowManagerAgent>& windowManagerAgent)); 48 MOCK_METHOD2(UnregisterWindowManagerAgent, WMError(WindowManagerAgentType type, 49 const sptr<IWindowManagerAgent>& windowManagerAgent)); 50 MOCK_METHOD1(GetVisibilityWindowInfo, WMError(std::vector<sptr<WindowVisibilityInfo>>& infos)); 51 MOCK_METHOD1(GetAccessibilityWindowInfo, WMError(std::vector<sptr<AccessibilityWindowInfo>>& infos)); 52 MOCK_METHOD2(GetUnreliableWindowInfo, WMError(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos)); 53 MOCK_METHOD1(RaiseToAppTop, WMError(uint32_t windowId)); 54 MOCK_METHOD1(GetSystemConfig, WMError(SystemConfig& systemConfig)); 55 MOCK_METHOD2(DispatchKeyEvent, void(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event)); 56 MOCK_METHOD0(GetMaximizeMode, MaximizeMode()); 57 MOCK_METHOD1(GetWindowModeType, WMError(WindowModeType& windowModeType)); 58 }; 59 } 60 } // namespace OHOS 61 62 #endif // FRAMEWORKS_WM_TEST_UT_MOCK_WINDOW_ADAPTER_H