• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DISTRIBUTED_DEVICE_PROFILE_CLIENT_MOCK_H
17 #define PASTEBOARD_DISTRIBUTED_DEVICE_PROFILE_CLIENT_MOCK_H
18 
19 #include <gmock/gmock.h>
20 #include <string>
21 
22 #include "device_profile_client.h"
23 
24 namespace OHOS {
25 namespace DistributedDeviceProfile {
26 
27 class IDeviceProfileClient {
28 public:
29     virtual ~IDeviceProfileClient() = default;
30     virtual int32_t PutCharacteristicProfile(const CharacteristicProfile &characteristicProfile) = 0;
31     virtual int32_t GetCharacteristicProfile(const std::string &deviceId, const std::string &serviceName,
32         const std::string &characteristicId, CharacteristicProfile &characteristicProfile) = 0;
33     virtual int32_t SubscribeDeviceProfile(const SubscribeInfo &subscribeInfo) = 0;
34     virtual int32_t UnSubscribeDeviceProfile(const SubscribeInfo &subscribeInfo) = 0;
35     virtual void SendSubscribeInfos() = 0;
36     virtual void ClearDeviceProfileService() = 0;
37     virtual void LoadSystemAbilitySuccess(const sptr<IRemoteObject> &remoteObject) = 0;
38     virtual void LoadSystemAbilityFail() = 0;
39 };
40 
41 class DeviceProfileClientMock : public IDeviceProfileClient {
42 public:
43     DeviceProfileClientMock();
44     ~DeviceProfileClientMock();
45     static DeviceProfileClientMock *GetMock();
46 
47     MOCK_METHOD(int32_t, PutCharacteristicProfile, (const CharacteristicProfile &characteristicProfile), (override));
48     MOCK_METHOD(int32_t, GetCharacteristicProfile, (const std::string &deviceId, const std::string &serviceName,
49         const std::string &characteristicId, CharacteristicProfile &characteristicProfile), (override));
50     MOCK_METHOD(int32_t, SubscribeDeviceProfile, (const SubscribeInfo &subscribeInfo), (override));
51     MOCK_METHOD(int32_t, UnSubscribeDeviceProfile, (const SubscribeInfo &subscribeInfo), (override));
52     MOCK_METHOD(void, SendSubscribeInfos, (), (override));
53     MOCK_METHOD(void, ClearDeviceProfileService, (), (override));
54     MOCK_METHOD(void, LoadSystemAbilitySuccess, (const sptr<IRemoteObject> &remoteObject), (override));
55     MOCK_METHOD(void, LoadSystemAbilityFail, (), (override));
56 
57 private:
58     static inline DeviceProfileClientMock *mock_ = nullptr;
59 };
60 } // namespace DistributedDeviceProfile
61 } // namespace OHOS
62 
63 #endif // PASTEBOARD_DISTRIBUTED_DEVICE_PROFILE_CLIENT_MOCK_H