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