1/*
2 * Copyright (c) 2023-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
16#ifndef OHOS_DM_PIN_HOLDER_TEST_H
17#define OHOS_DM_PIN_HOLDER_TEST_H
18
19#include <gtest/gtest.h>
20#include <refbase.h>
21
22#include <memory>
23#include <cstdint>
24#include "mock/mock_ipc_client_proxy.h"
25#include "device_manager.h"
26#include "dm_single_instance.h"
27#include "idevice_manager_service_listener.h"
28
29namespace OHOS {
30namespace DistributedHardware {
31class DmPinHolderTest : public testing::Test {
32public:
33    static void SetUpTestCase();
34    static void TearDownTestCase();
35    void SetUp();
36    void TearDown();
37};
38
39class DmInitCallbackTest : public DmInitCallback {
40public:
41    DmInitCallbackTest() : DmInitCallback() {}
42    virtual ~DmInitCallbackTest() {}
43    void OnRemoteDied() override {}
44};
45
46class DmPinHolderCallbackTest : public PinHolderCallback {
47public:
48    DmPinHolderCallbackTest() : PinHolderCallback() {}
49    virtual ~DmPinHolderCallbackTest() {}
50    void OnPinHolderCreate(const std::string &deviceId, DmPinType pinType, const std::string &payload) override;
51    void OnPinHolderDestroy(DmPinType pinType, const std::string &payload) override;
52    void OnCreateResult(int32_t result) override;
53    void OnDestroyResult(int32_t result) override;
54    void OnPinHolderEvent(DmPinHolderEvent event, int32_t result, const std::string &content) override;
55};
56
57class IDeviceManagerServiceListenerTest : public IDeviceManagerServiceListener {
58public:
59    virtual ~IDeviceManagerServiceListenerTest()
60    {
61    }
62
63    void OnDeviceStateChange(const std::string &pkgName, const DmDeviceState &state, const DmDeviceInfo &info) override
64    {
65        (void)pkgName;
66        (void)state;
67        (void)info;
68    }
69
70    void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, const DmDeviceInfo &info) override
71    {
72        (void)pkgName;
73        (void)subscribeId;
74        (void)info;
75    }
76
77    void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, DmDeviceBasicInfo &info) override
78    {
79        (void)pkgName;
80        (void)subscribeId;
81        (void)info;
82    }
83
84    void OnDiscoveryFailed(const std::string &pkgName, uint16_t subscribeId, int32_t failedReason) override
85    {
86        (void)pkgName;
87        (void)subscribeId;
88        (void)failedReason;
89    }
90
91    void OnDiscoverySuccess(const std::string &pkgName, int32_t subscribeId) override
92    {
93        (void)pkgName;
94        (void)subscribeId;
95    }
96
97    void OnPublishResult(const std::string &pkgName, int32_t publishId, int32_t publishResult) override
98    {
99        (void)pkgName;
100        (void)publishId;
101        (void)publishResult;
102    }
103
104    void OnAuthResult(const std::string &pkgName, const std::string &deviceId, const std::string &token, int32_t status,
105        int32_t reason) override
106    {
107        (void)pkgName;
108        (void)deviceId;
109        (void)token;
110        (void)status;
111        (void)reason;
112    }
113
114    void OnUiCall(std::string &pkgName, std::string &paramJson) override
115    {
116        (void)pkgName;
117        (void)paramJson;
118    }
119
120    void OnCredentialResult(const std::string &pkgName, int32_t action, const std::string &resultInfo) override
121    {
122        (void)pkgName;
123        (void)action;
124        (void)resultInfo;
125    }
126
127    void OnBindResult(const std::string &pkgName, const PeerTargetId &targetId, int32_t result, int32_t status,
128        std::string content) override
129    {
130        (void)pkgName;
131        (void)targetId;
132        (void)result;
133        (void)status;
134        (void)content;
135    }
136
137    void OnUnbindResult(const std::string &pkgName, const PeerTargetId &targetId, int32_t result,
138        std::string content) override
139    {
140        (void)pkgName;
141        (void)targetId;
142        (void)result;
143        (void)content;
144    }
145
146    void OnPinHolderCreate(const std::string &pkgName, const std::string &deviceId, DmPinType pinType,
147        const std::string &payload) override
148    {
149        (void)pkgName;
150        (void)deviceId;
151        (void)pinType;
152        (void)payload;
153    }
154
155    void OnPinHolderDestroy(const std::string &pkgName, DmPinType pinType, const std::string &payload) override
156    {
157        (void)pkgName;
158        (void)pinType;
159        (void)payload;
160    }
161
162    void OnCreateResult(const std::string &pkgName, int32_t result) override
163    {
164        (void)pkgName;
165        (void)result;
166    }
167
168    void OnDestroyResult(const std::string &pkgName, int32_t result) override
169    {
170        (void)pkgName;
171        (void)result;
172    }
173
174    void OnPinHolderEvent(const std::string &pkgName, DmPinHolderEvent event, int32_t result,
175        const std::string &content) override
176    {
177        (void)pkgName;
178        (void)event;
179        (void)result;
180        (void)content;
181    }
182
183    void OnDeviceTrustChange(const std::string &udid, const std::string &uuid, DmAuthForm authForm) override
184    {
185        (void)udid;
186        (void)uuid;
187        (void)authForm;
188    }
189
190    void OnDeviceScreenStateChange(const std::string &pkgName, DmDeviceInfo &devInfo) override
191    {
192        (void)pkgName;
193        (void)devInfo;
194    }
195
196    void OnCredentialAuthStatus(const std::string &pkgName, const std::string &deviceList, uint16_t deviceTypeId,
197                                int32_t errcode) override
198    {
199        (void)pkgName;
200        (void)deviceList;
201        (void)deviceTypeId;
202        (void)errcode;
203    }
204
205    void OnAppUnintall(const std::string &pkgName) override
206    {
207        (void)pkgName;
208    }
209};
210} // namespace DistributedHardware
211} // namespace OHOS
212
213#endif // OHOS_DM_PIN_HOLDER_TEST_H
214