1 /* 2 * Copyright (C) 2024-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 #ifndef MESSAGE_PARCEL_MOCK_H 16 #define MESSAGE_PARCEL_MOCK_H 17 18 #include <memory> 19 #include <string> 20 #include <gmock/gmock.h> 21 22 #include "dfx_hisysevent.h" 23 #include "event_filter_handler.h" 24 #include "fingersense_wrapper.h" 25 #include "input_device_manager.h" 26 #include "input_display_bind_helper.h" 27 #include "input_event_handler.h" 28 #include "knuckle_drawing_manager.h" 29 #include "knuckle_dynamic_drawing_manager.h" 30 #include "libinput_interface.h" 31 #include "mouse_event_normalize.h" 32 #include "multimodal_input_preferences_manager.h" 33 #include "pointer_drawing_manager.h" 34 #include "scene_board_judgement.h" 35 #include "setting_datashare.h" 36 #include "timer_manager.h" 37 #include "touch_drawing_manager.h" 38 #include "uds_server.h" 39 40 namespace OHOS { 41 namespace MMI { 42 class DfsMessageParcel { 43 public: 44 virtual ~DfsMessageParcel() = default; 45 public: 46 virtual SessionPtr GetSession(int32_t fd) = 0; 47 virtual int32_t GetClientFd(int32_t pid) = 0; 48 virtual bool HasPointerDevice() = 0; 49 virtual std::shared_ptr<InputDevice> GetInputDevice(int32_t deviceId, bool checked) = 0; 50 virtual bool GetMouseDisplayState() = 0; 51 virtual bool GetBoolValue(const std::string &key, bool defaultValue) = 0; 52 virtual bool SendMsg(NetPacket &pkt) = 0; 53 virtual bool IsSceneBoardEnabled() = 0; 54 virtual bool IsWindowRotation() = 0; 55 virtual int32_t GetDisplayId() = 0; 56 virtual std::string GetBindDisplayNameByInputDevice(int32_t inputDeviceId) = 0; 57 virtual std::optional<WindowInfo> SelectWindowInfo(int32_t logicalX, int32_t logicalY, 58 const std::shared_ptr<PointerEvent>& pointerEvent) = 0; 59 virtual bool UpdateDisplayId(int32_t& displayId) = 0; 60 virtual bool GetHardCursorEnabled() = 0; 61 virtual std::vector<int32_t> HandleHardwareCursor(const DisplayInfo *physicalDisplayInfo, 62 int32_t physicalX, int32_t physicalY) = 0; 63 public: 64 static inline std::shared_ptr<DfsMessageParcel> messageParcel = nullptr; 65 }; 66 67 class MessageParcelMock : public DfsMessageParcel { 68 public: 69 MOCK_METHOD1(GetSession, SessionPtr(int32_t fd)); 70 MOCK_METHOD1(GetClientFd, int32_t(int32_t pid)); 71 MOCK_METHOD1(GetBindDisplayNameByInputDevice, std::string(int32_t inputDeviceId)); 72 MOCK_METHOD0(HasPointerDevice, bool()); 73 MOCK_METHOD2(GetInputDevice, std::shared_ptr<InputDevice>(int32_t deviceId, bool checked)); 74 MOCK_METHOD0(GetMouseDisplayState, bool()); 75 MOCK_METHOD2(GetBoolValue, bool(const std::string &key, bool defaultValue)); 76 MOCK_METHOD1(SendMsg, bool(NetPacket &pkt)); 77 MOCK_METHOD0(IsSceneBoardEnabled, bool()); 78 MOCK_METHOD0(IsWindowRotation, bool()); 79 MOCK_METHOD0(GetDisplayId, int32_t()); 80 MOCK_METHOD3(SelectWindowInfo, std::optional<WindowInfo>(int32_t logicalX, int32_t logicalY, 81 const std::shared_ptr<PointerEvent>& pointerEvent)); 82 MOCK_METHOD1(UpdateDisplayId, bool(int32_t& displayId)); 83 MOCK_METHOD0(GetHardCursorEnabled, bool()); 84 MOCK_METHOD3(HandleHardwareCursor, std::vector<int32_t>(const DisplayInfo *physicalDisplayInfo, 85 int32_t physicalX, int32_t physicalY)); 86 }; 87 } // namespace MMI 88 } // namespace OHOS 89 #endif