1 /* 2 * Copyright (C) 2024 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 public: 57 static inline std::shared_ptr<DfsMessageParcel> messageParcel = nullptr; 58 }; 59 60 class MessageParcelMock : public DfsMessageParcel { 61 public: 62 MOCK_METHOD1(GetSession, SessionPtr(int32_t fd)); 63 MOCK_METHOD1(GetClientFd, int32_t(int32_t pid)); 64 MOCK_METHOD0(HasPointerDevice, bool()); 65 MOCK_METHOD2(GetInputDevice, std::shared_ptr<InputDevice>(int32_t deviceId, bool checked)); 66 MOCK_METHOD0(GetMouseDisplayState, bool()); 67 MOCK_METHOD2(GetBoolValue, bool(const std::string &key, bool defaultValue)); 68 MOCK_METHOD1(SendMsg, bool(NetPacket &pkt)); 69 MOCK_METHOD0(IsSceneBoardEnabled, bool()); 70 MOCK_METHOD0(IsWindowRotation, bool()); 71 MOCK_METHOD0(GetDisplayId, int32_t()); 72 }; 73 } // namespace MMI 74 } // namespace OHOS 75 #endif