1 /* 2 * Copyright (c) 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 16 #ifndef PASTEBOARD_DEVICE_MANAGER_MOCK_H 17 #define PASTEBOARD_DEVICE_MANAGER_MOCK_H 18 19 #include <gmock/gmock.h> 20 #include <string> 21 22 #include "device_manager_impl.h" 23 24 namespace OHOS { 25 namespace DistributedHardware { 26 27 class PasteDeviceManager { 28 public: 29 virtual ~PasteDeviceManager() = default; 30 31 public: 32 virtual int32_t GetLocalDeviceInfo(const std::string &pkgName, DmDeviceInfo &deviceInfo) = 0; 33 virtual int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &networkId, std::string &udid) = 0; 34 virtual bool IsSameAccount(const std::string &networkId) = 0; 35 virtual int32_t GetLocalDeviceType(const std::string &pkgName, int32_t &deviceType) = 0; 36 virtual int32_t GetTrustedDeviceList( 37 const std::string &pkgName, const std::string &extra, std::vector<DmDeviceInfo> &deviceList) = 0; 38 39 public: 40 static inline std::shared_ptr<PasteDeviceManager> pasteDeviceManager = nullptr; 41 }; 42 43 class DeviceManagerMock : public PasteDeviceManager { 44 public: 45 MOCK_METHOD(int32_t, GetLocalDeviceInfo, (const std::string &, DmDeviceInfo &)); 46 MOCK_METHOD(int32_t, GetUdidByNetworkId, (const std::string &, const std::string &, std::string &)); 47 MOCK_METHOD(bool, IsSameAccount, (const std::string &)); 48 MOCK_METHOD(int32_t, GetLocalDeviceType, (const std::string &, int32_t &)); 49 MOCK_METHOD(int32_t, GetTrustedDeviceList, (const std::string &, const std::string &, std::vector<DmDeviceInfo> &)); 50 }; 51 52 } // namespace DistributedHardware 53 } // namespace OHOS 54 55 #endif // PASTEBOARD_DEVICE_MANAGER_MOCK_H