/* * Copyright (C) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_DISTRIBUTED_DEVICE_PROFILE_CLIENT_MOCK_H #define OHOS_DISTRIBUTED_DEVICE_PROFILE_CLIENT_MOCK_H #include #include #include "distributed_device_profile_client.h" namespace OHOS { namespace DistributedDeviceProfile { class DpDistributedDeviceProfileClient { public: virtual ~DpDistributedDeviceProfileClient() = default; public: virtual int32_t GetAccessControlProfile(std::map params, std::vector& accessControlProfiles) = 0; virtual int32_t PutAccessControlProfile(const AccessControlProfile& accessControlProfile) = 0; virtual int32_t GetAllAccessControlProfile(std::vector& accessControlProfiles) = 0; virtual int32_t SubscribeDeviceProfileInited(int32_t saId, sptr initedCb) = 0; virtual int32_t UnSubscribeDeviceProfileInited(int32_t saId) = 0; virtual int32_t PutAllTrustedDevices(const std::vector &deviceInfos) = 0; virtual int32_t PutSessionKey(uint32_t userId, const std::vector& sessionKey, int32_t& sessionKeyId) = 0; virtual int32_t PutLocalServiceInfo(const LocalServiceInfo& localServiceInfo) = 0; virtual int32_t DeleteLocalServiceInfo(const std::string& bundleName, int32_t pinExchangeType) = 0; virtual int32_t UpdateLocalServiceInfo(const LocalServiceInfo& localServiceInfo) = 0; virtual int32_t GetLocalServiceInfoByBundleAndPinType(const std::string& bundleName, int32_t pinExchangeType, LocalServiceInfo& localServiceInfo) = 0; virtual int32_t GetBusinessEvent(BusinessEvent &event) = 0; virtual int32_t PutBusinessEvent(const DistributedDeviceProfile::BusinessEvent &event) = 0; virtual int32_t GetAllAclIncludeLnnAcl(std::vector& profiles) = 0; public: static inline std::shared_ptr dpDistributedDeviceProfileClient = nullptr; }; class DistributedDeviceProfileClientMock : public DpDistributedDeviceProfileClient { public: MOCK_METHOD(int32_t, GetAccessControlProfile, ((std::map), std::vector&)); MOCK_METHOD(int32_t, PutAccessControlProfile, (const AccessControlProfile&)); MOCK_METHOD(int32_t, GetAllAccessControlProfile, (std::vector&)); MOCK_METHOD(int32_t, SubscribeDeviceProfileInited, (int32_t, sptr)); MOCK_METHOD(int32_t, UnSubscribeDeviceProfileInited, (int32_t)); MOCK_METHOD(int32_t, PutAllTrustedDevices, (const std::vector &)); MOCK_METHOD(int32_t, PutSessionKey, (uint32_t, (const std::vector&), int32_t&)); MOCK_METHOD(int32_t, PutLocalServiceInfo, (const LocalServiceInfo&)); MOCK_METHOD(int32_t, DeleteLocalServiceInfo, (const std::string&, int32_t)); MOCK_METHOD(int32_t, UpdateLocalServiceInfo, (const LocalServiceInfo&)); MOCK_METHOD(int32_t, GetLocalServiceInfoByBundleAndPinType, (const std::string&, int32_t, LocalServiceInfo&)); MOCK_METHOD(int32_t, GetBusinessEvent, (BusinessEvent &event)); MOCK_METHOD(int32_t, PutBusinessEvent, (const DistributedDeviceProfile::BusinessEvent &event)); MOCK_METHOD(int32_t, GetAllAclIncludeLnnAcl, (std::vector&)); }; } } #endif