1 /*
2 * Copyright (c) 2022-2023 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 #include "dinput_source_callback_unittest.h"
17
18 #include <memory>
19 #include "dinput_errcode.h"
20 #include "dinput_ipc_interface_code.h"
21
22 namespace OHOS {
23 namespace DistributedHardware {
24 namespace DistributedInput {
SetUp()25 void DInputSourceCallBackTest::SetUp()
26 {
27 }
28
TearDown()29 void DInputSourceCallBackTest::TearDown()
30 {
31 }
32
SetUpTestCase()33 void DInputSourceCallBackTest::SetUpTestCase()
34 {
35 }
36
TearDownTestCase()37 void DInputSourceCallBackTest::TearDownTestCase()
38 {
39 }
40
Init()41 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::Init()
42 {
43 return DH_SUCCESS;
44 }
45
Release()46 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::Release()
47 {
48 return DH_SUCCESS;
49 }
50
RegisterDistributedHardware(const std::string & devId,const std::string & dhId,const std::string & parameters,sptr<IRegisterDInputCallback> callback)51 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterDistributedHardware(
52 const std::string &devId, const std::string &dhId, const std::string ¶meters,
53 sptr<IRegisterDInputCallback> callback)
54 {
55 (void)devId;
56 (void)dhId;
57 (void)parameters;
58 (void)callback;
59 return DH_SUCCESS;
60 }
61
UnregisterDistributedHardware(const std::string & devId,const std::string & dhId,sptr<IUnregisterDInputCallback> callback)62 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnregisterDistributedHardware(
63 const std::string &devId, const std::string &dhId,
64 sptr<IUnregisterDInputCallback> callback)
65 {
66 (void)devId;
67 (void)dhId;
68 (void)callback;
69 return DH_SUCCESS;
70 }
71
PrepareRemoteInput(const std::string & deviceId,sptr<IPrepareDInputCallback> callback)72 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::PrepareRemoteInput(
73 const std::string &deviceId, sptr<IPrepareDInputCallback> callback)
74 {
75 (void)deviceId;
76 (void)callback;
77 return DH_SUCCESS;
78 }
79
UnprepareRemoteInput(const std::string & deviceId,sptr<IUnprepareDInputCallback> callback)80 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnprepareRemoteInput(
81 const std::string &deviceId, sptr<IUnprepareDInputCallback> callback)
82 {
83 (void)deviceId;
84 (void)callback;
85 return DH_SUCCESS;
86 }
87
StartRemoteInput(const std::string & deviceId,const uint32_t & inputTypes,sptr<IStartDInputCallback> callback)88 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StartRemoteInput(
89 const std::string &deviceId, const uint32_t &inputTypes, sptr<IStartDInputCallback> callback)
90 {
91 (void)deviceId;
92 (void)inputTypes;
93 (void)callback;
94 return DH_SUCCESS;
95 }
96
StopRemoteInput(const std::string & deviceId,const uint32_t & inputTypes,sptr<IStopDInputCallback> callback)97 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StopRemoteInput(
98 const std::string &deviceId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback)
99 {
100 (void)deviceId;
101 (void)inputTypes;
102 (void)callback;
103 return DH_SUCCESS;
104 }
105
StartRemoteInput(const std::string & srcId,const std::string & sinkId,const uint32_t & inputTypes,sptr<IStartDInputCallback> callback)106 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StartRemoteInput(
107 const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
108 sptr<IStartDInputCallback> callback)
109 {
110 (void)srcId;
111 (void)sinkId;
112 (void)inputTypes;
113 (void)callback;
114 return DH_SUCCESS;
115 }
116
StopRemoteInput(const std::string & srcId,const std::string & sinkId,const uint32_t & inputTypes,sptr<IStopDInputCallback> callback)117 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StopRemoteInput(
118 const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
119 sptr<IStopDInputCallback> callback)
120 {
121 (void)srcId;
122 (void)sinkId;
123 (void)inputTypes;
124 (void)callback;
125 return DH_SUCCESS;
126 }
127
PrepareRemoteInput(const std::string & srcId,const std::string & sinkId,sptr<IPrepareDInputCallback> callback)128 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::PrepareRemoteInput(
129 const std::string &srcId, const std::string &sinkId,
130 sptr<IPrepareDInputCallback> callback)
131 {
132 (void)srcId;
133 (void)sinkId;
134 (void)callback;
135 return DH_SUCCESS;
136 }
137
UnprepareRemoteInput(const std::string & srcId,const std::string & sinkId,sptr<IUnprepareDInputCallback> callback)138 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnprepareRemoteInput(
139 const std::string &srcId, const std::string &sinkId,
140 sptr<IUnprepareDInputCallback> callback)
141 {
142 (void)srcId;
143 (void)sinkId;
144 (void)callback;
145 return DH_SUCCESS;
146 }
147
StartRemoteInput(const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)148 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StartRemoteInput(
149 const std::string &sinkId, const std::vector<std::string> &dhIds,
150 sptr<IStartStopDInputsCallback> callback)
151 {
152 (void)sinkId;
153 (void)dhIds;
154 (void)callback;
155 return DH_SUCCESS;
156 }
157
StopRemoteInput(const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)158 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StopRemoteInput(
159 const std::string &sinkId, const std::vector<std::string> &dhIds,
160 sptr<IStartStopDInputsCallback> callback)
161 {
162 (void)sinkId;
163 (void)dhIds;
164 (void)callback;
165 return DH_SUCCESS;
166 }
167
StartRemoteInput(const std::string & srcId,const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)168 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StartRemoteInput(
169 const std::string &srcId, const std::string &sinkId,
170 const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback)
171 {
172 (void)srcId;
173 (void)sinkId;
174 (void)dhIds;
175 (void)callback;
176 return DH_SUCCESS;
177 }
178
StopRemoteInput(const std::string & srcId,const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)179 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StopRemoteInput(
180 const std::string &srcId, const std::string &sinkId,
181 const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback)
182 {
183 (void)srcId;
184 (void)sinkId;
185 (void)dhIds;
186 (void)callback;
187 return DH_SUCCESS;
188 }
189
RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback)190 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterAddWhiteListCallback(
191 sptr<IAddWhiteListInfosCallback> addWhiteListCallback)
192 {
193 (void)addWhiteListCallback;
194 return DH_SUCCESS;
195 }
196
RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback)197 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterDelWhiteListCallback(
198 sptr<IDelWhiteListInfosCallback> delWhiteListCallback)
199 {
200 (void)delWhiteListCallback;
201 return DH_SUCCESS;
202 }
203
RegisterInputNodeListener(sptr<InputNodeListener> listener)204 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterInputNodeListener(
205 sptr<InputNodeListener> listener)
206 {
207 (void)listener;
208 return DH_SUCCESS;
209 }
210
UnregisterInputNodeListener(sptr<InputNodeListener> listener)211 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnregisterInputNodeListener(
212 sptr<InputNodeListener> listener)
213 {
214 (void)listener;
215 return DH_SUCCESS;
216 }
217
SyncNodeInfoRemoteInput(const std::string & userDevId,const std::string & dhid,const std::string & nodeDesc)218 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::SyncNodeInfoRemoteInput(
219 const std::string &userDevId, const std::string &dhid,
220 const std::string &nodeDesc)
221 {
222 (void)userDevId;
223 (void)dhid;
224 (void)nodeDesc;
225 return DH_SUCCESS;
226 }
227
RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)228 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterSimulationEventListener(
229 sptr<ISimulationEventListener> listener)
230 {
231 (void)listener;
232 return DH_SUCCESS;
233 }
234
UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener)235 int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnregisterSimulationEventListener(
236 sptr<ISimulationEventListener> listener)
237 {
238 (void)listener;
239 return DH_SUCCESS;
240 }
241
OnResult(const std::string & deviceId,const std::string & strJson)242 void DInputSourceCallBackTest::TestDInputSourceCallBackStub::OnResult(const std::string &deviceId,
243 const std::string &strJson)
244 {
245 deviceId_ = deviceId;
246 strJson_ = strJson;
247 }
248
OnResult(const std::string & devId,const std::string & dhId,const int32_t & status)249 void DInputSourceCallBackTest::TestDInputRegisterCallBack::OnResult(const std::string &devId,
250 const std::string &dhId, const int32_t &status)
251 {
252 (void)devId;
253 (void)dhId;
254 (void)status;
255 return;
256 }
257
OnResult(const std::string & devId,const std::string & dhId,const int32_t & status)258 void DInputSourceCallBackTest::TestDInputUnregisterCallBack::OnResult(const std::string &devId,
259 const std::string &dhId, const int32_t &status)
260 {
261 (void)devId;
262 (void)dhId;
263 (void)status;
264 return;
265 }
266
OnResult(const std::string & deviceId,const int32_t & status)267 void DInputSourceCallBackTest::TestDInputPrepareCallBack::OnResult(
268 const std::string &deviceId, const int32_t &status)
269 {
270 (void)deviceId;
271 (void)status;
272 return;
273 }
274
OnResult(const std::string & deviceId,const int32_t & status)275 void DInputSourceCallBackTest::TestDInputUnprepareCallBack::OnResult(
276 const std::string &deviceId, const int32_t &status)
277 {
278 (void)deviceId;
279 (void)status;
280 return;
281 }
282
OnResult(const std::string & deviceId,const uint32_t & inputTypes,const int32_t & status)283 void DInputSourceCallBackTest::TestDInputStartCallBack::OnResult(
284 const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status)
285 {
286 (void)deviceId;
287 (void)inputTypes;
288 (void)status;
289 return;
290 }
291
OnResult(const std::string & deviceId,const uint32_t & inputTypes,const int32_t & status)292 void DInputSourceCallBackTest::TestDInputStopCallBack::OnResult(
293 const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status)
294 {
295 (void)deviceId;
296 (void)inputTypes;
297 (void)status;
298 return;
299 }
300
OnResultDhids(const std::string & devId,const int32_t & status)301 void DInputSourceCallBackTest::TestVectorStartStopCallBackStub::OnResultDhids(const std::string &devId,
302 const int32_t &status)
303 {
304 (void)devId;
305 (void)status;
306 return;
307 }
308
OnResult(const std::string & deviceId,const std::string & strJson)309 void DInputSourceCallBackTest::TestAddWhiteListInfosCallBack::OnResult(
310 const std::string &deviceId, const std::string &strJson)
311 {
312 (void)deviceId;
313 (void)strJson;
314 return;
315 }
316
OnResult(const std::string & deviceId)317 void DInputSourceCallBackTest::TestDelWhiteListInfosCallBack::OnResult(
318 const std::string &deviceId)
319 {
320 (void)deviceId;
321 return;
322 }
323
OnNodeOnLine(const std::string srcDevId,const std::string sinkDevId,const std::string sinkNodeId,const std::string sinkNodeDesc)324 void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOnLine(const std::string srcDevId,
325 const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc)
326 {
327 (void)srcDevId;
328 (void)sinkDevId;
329 (void)sinkNodeId;
330 (void)sinkNodeDesc;
331 return;
332 }
333
OnNodeOffLine(const std::string srcDevId,const std::string sinkDevId,const std::string sinkNodeId)334 void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOffLine(const std::string srcDevId,
335 const std::string sinkDevId, const std::string sinkNodeId)
336 {
337 (void)srcDevId;
338 (void)sinkDevId;
339 (void)sinkNodeId;
340 return;
341 }
342
OnSimulationEvent(uint32_t type,uint32_t code,int32_t value)343 int32_t DInputSourceCallBackTest::TestDInputSimulationEventCallBack::OnSimulationEvent(uint32_t type, uint32_t code,
344 int32_t value)
345 {
346 (void)type;
347 (void)code;
348 (void)value;
349 return DH_SUCCESS;
350 }
351
352 HWTEST_F(DInputSourceCallBackTest, SendRequest01, testing::ext::TestSize.Level1)
353 {
354 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
355 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
356 IDInputSourceInterfaceCode code = IDInputSourceInterfaceCode::INIT;
357 MessageParcel data;
358 MessageParcel reply;
359 bool ret = callBackProxy.SendRequest(static_cast<uint32_t>(code), data, reply);
360 EXPECT_EQ(false, ret);
361 }
362
363 HWTEST_F(DInputSourceCallBackTest, Init01, testing::ext::TestSize.Level1)
364 {
365 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
366 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
367 int32_t ret = callBackProxy.Init();
368 EXPECT_EQ(DH_SUCCESS, ret);
369 }
370
371 HWTEST_F(DInputSourceCallBackTest, Release01, testing::ext::TestSize.Level1)
372 {
373 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
374 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
375 int32_t ret = callBackProxy.Release();
376 EXPECT_EQ(DH_SUCCESS, ret);
377 }
378
379 HWTEST_F(DInputSourceCallBackTest, RegisterDistributedHardware01, testing::ext::TestSize.Level1)
380 {
381 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
382 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
383 const std::string devId = "d6f4s6d4f6";
384 const std::string dhId = "Input_sd4f4s5d4f5s4";
385 const std::string parameters = "d4a6s5d46asd";
386 sptr<IRegisterDInputCallback> callback(new TestDInputRegisterCallBack());
387 int32_t ret = callBackProxy.RegisterDistributedHardware(devId, dhId, parameters, callback);
388 EXPECT_EQ(DH_SUCCESS, ret);
389 }
390
391 HWTEST_F(DInputSourceCallBackTest, UnregisterDistributedHardware01, testing::ext::TestSize.Level1)
392 {
393 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
394 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
395 const std::string devId = "d6f4s6d4f6";
396 const std::string dhId = "Input_sd4f4s5d4f5s4";
397 sptr<TestDInputUnregisterCallBack> callback(new TestDInputUnregisterCallBack());
398 int32_t ret = callBackProxy.UnregisterDistributedHardware(devId, dhId, callback);
399 EXPECT_EQ(DH_SUCCESS, ret);
400 }
401
402 HWTEST_F(DInputSourceCallBackTest, PrepareRemoteInput01, testing::ext::TestSize.Level1)
403 {
404 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
405 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
406 const std::string devId = "d6f4s6d4f6";
407 sptr<TestDInputPrepareCallBack> callback(new TestDInputPrepareCallBack());
408 int32_t ret = callBackProxy.PrepareRemoteInput(devId, callback);
409 EXPECT_EQ(DH_SUCCESS, ret);
410 }
411
412 HWTEST_F(DInputSourceCallBackTest, PrepareRemoteInput02, testing::ext::TestSize.Level1)
413 {
414 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
415 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
416 const std::string srcId = "d6f4s6d4f6";
417 const std::string sinkId = "5sd45s4d5s4d5";
418 sptr<TestDInputPrepareCallBack> callback(new TestDInputPrepareCallBack());
419 int32_t ret = callBackProxy.PrepareRemoteInput(srcId, sinkId, callback);
420 EXPECT_EQ(DH_SUCCESS, ret);
421 }
422
423 HWTEST_F(DInputSourceCallBackTest, UnprepareRemoteInput01, testing::ext::TestSize.Level1)
424 {
425 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
426 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
427 const std::string devId = "d6f4s6d4f6";
428 sptr<TestDInputUnprepareCallBack> callback(new TestDInputUnprepareCallBack());
429 int32_t ret = callBackProxy.UnprepareRemoteInput(devId, callback);
430 EXPECT_EQ(DH_SUCCESS, ret);
431 }
432
433 HWTEST_F(DInputSourceCallBackTest, UnprepareRemoteInput02, testing::ext::TestSize.Level1)
434 {
435 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
436 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
437 const std::string srcId = "d6f4s6d4f6";
438 const std::string sinkId = "5sd45s4d5s4d5";
439 sptr<TestDInputUnprepareCallBack> callback(new TestDInputUnprepareCallBack());
440 int32_t ret = callBackProxy.UnprepareRemoteInput(srcId, sinkId, callback);
441 EXPECT_EQ(DH_SUCCESS, ret);
442 }
443
444 HWTEST_F(DInputSourceCallBackTest, StartRemoteInput01, testing::ext::TestSize.Level1)
445 {
446 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
447 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
448 const std::string devId = "d6f4s6d4f6";
449 uint32_t inputTypes = 1;
450 sptr<TestDInputStartCallBack> callback(new TestDInputStartCallBack());
451 int32_t ret = callBackProxy.StartRemoteInput(devId, inputTypes, callback);
452 EXPECT_EQ(DH_SUCCESS, ret);
453 }
454
455 HWTEST_F(DInputSourceCallBackTest, StartRemoteInput02, testing::ext::TestSize.Level1)
456 {
457 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
458 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
459 const std::string srcId = "d6f4s6d4f6";
460 const std::string sinkId = "5sd45s4d5s4d5";
461 uint32_t inputTypes = 1;
462 sptr<TestDInputStartCallBack> callback(new TestDInputStartCallBack());
463 int32_t ret = callBackProxy.StartRemoteInput(srcId, sinkId, inputTypes, callback);
464 EXPECT_EQ(DH_SUCCESS, ret);
465 }
466
467 HWTEST_F(DInputSourceCallBackTest, StartRemoteInput03, testing::ext::TestSize.Level1)
468 {
469 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
470 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
471 const std::string sinkId = "d6f4s6d4f6";
472 std::vector<std::string> dhIds;
473 dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s");
474 sptr<TestVectorStartStopCallBackStub> callback(new TestVectorStartStopCallBackStub());
475 int32_t ret = callBackProxy.StartRemoteInput(sinkId, dhIds, callback);
476 EXPECT_EQ(DH_SUCCESS, ret);
477 }
478
479 HWTEST_F(DInputSourceCallBackTest, StartRemoteInput04, testing::ext::TestSize.Level1)
480 {
481 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
482 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
483 const std::string srcId = "d6f4s6d4f6";
484 const std::string sinkId = "5sd45s4d5s4d5";
485 std::vector<std::string> dhIds;
486 dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s");
487 sptr<TestVectorStartStopCallBackStub> callback(new TestVectorStartStopCallBackStub());
488 int32_t ret = callBackProxy.StartRemoteInput(srcId, sinkId, dhIds, callback);
489 EXPECT_EQ(DH_SUCCESS, ret);
490 }
491
492 HWTEST_F(DInputSourceCallBackTest, StopRemoteInput01, testing::ext::TestSize.Level1)
493 {
494 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
495 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
496 const std::string devId = "d6f4s6d4f6";
497 uint32_t inputTypes = 1;
498 sptr<TestDInputStopCallBack> callback(new TestDInputStopCallBack());
499 int32_t ret = callBackProxy.StopRemoteInput(devId, inputTypes, callback);
500 EXPECT_EQ(DH_SUCCESS, ret);
501 }
502
503 HWTEST_F(DInputSourceCallBackTest, StopRemoteInput02, testing::ext::TestSize.Level1)
504 {
505 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
506 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
507 const std::string srcId = "d6f4s6d4f6";
508 const std::string sinkId = "5sd45s4d5s4d5";
509 uint32_t inputTypes = 1;
510 sptr<TestDInputStopCallBack> callback(new TestDInputStopCallBack());
511 int32_t ret = callBackProxy.StopRemoteInput(srcId, sinkId, inputTypes, callback);
512 EXPECT_EQ(DH_SUCCESS, ret);
513 }
514
515 HWTEST_F(DInputSourceCallBackTest, StopRemoteInput03, testing::ext::TestSize.Level1)
516 {
517 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
518 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
519 const std::string sinkId = "d6f4s6d4f6";
520 std::vector<std::string> dhIds;
521 dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s");
522 sptr<TestVectorStartStopCallBackStub> callback(new TestVectorStartStopCallBackStub());
523 int32_t ret = callBackProxy.StopRemoteInput(sinkId, dhIds, callback);
524 EXPECT_EQ(DH_SUCCESS, ret);
525 }
526
527 HWTEST_F(DInputSourceCallBackTest, StopRemoteInput04, testing::ext::TestSize.Level1)
528 {
529 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
530 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
531 const std::string srcId = "d6f4s6d4f6";
532 const std::string sinkId = "5sd45s4d5s4d5";
533 std::vector<std::string> dhIds;
534 dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s");
535 sptr<TestVectorStartStopCallBackStub> callback(new TestVectorStartStopCallBackStub());
536 int32_t ret = callBackProxy.StopRemoteInput(srcId, sinkId, dhIds, callback);
537 EXPECT_EQ(DH_SUCCESS, ret);
538 }
539
540 HWTEST_F(DInputSourceCallBackTest, RegisterAddWhiteListCallback01, testing::ext::TestSize.Level1)
541 {
542 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
543 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
544 sptr<TestAddWhiteListInfosCallBack> callback(new TestAddWhiteListInfosCallBack());
545 int32_t ret = callBackProxy.RegisterAddWhiteListCallback(callback);
546 EXPECT_EQ(DH_SUCCESS, ret);
547 }
548
549 HWTEST_F(DInputSourceCallBackTest, RegisterDelWhiteListCallback01, testing::ext::TestSize.Level1)
550 {
551 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
552 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
553 sptr<TestDelWhiteListInfosCallBack> callback(new TestDelWhiteListInfosCallBack());
554 int32_t ret = callBackProxy.RegisterDelWhiteListCallback(callback);
555 EXPECT_EQ(DH_SUCCESS, ret);
556 }
557
558 HWTEST_F(DInputSourceCallBackTest, RegisterInputNodeListener01, testing::ext::TestSize.Level1)
559 {
560 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
561 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
562 sptr<TestDInputNodeListenerCallBack> listener(new TestDInputNodeListenerCallBack());
563 int32_t ret = callBackProxy.RegisterInputNodeListener(listener);
564 EXPECT_EQ(DH_SUCCESS, ret);
565 }
566
567 HWTEST_F(DInputSourceCallBackTest, UnregisterInputNodeListener01, testing::ext::TestSize.Level1)
568 {
569 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
570 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
571 sptr<TestDInputNodeListenerCallBack> listener(new TestDInputNodeListenerCallBack());
572 int32_t ret = callBackProxy.UnregisterInputNodeListener(listener);
573 EXPECT_EQ(DH_SUCCESS, ret);
574 }
575
576 HWTEST_F(DInputSourceCallBackTest, SyncNodeInfoRemoteInput01, testing::ext::TestSize.Level1)
577 {
578 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
579 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
580 const std::string userDevId = "a4sd654q8w7e9qwe";
581 const std::string dhid = "Input_sd65f46df46s54f";
582 const std::string nodeDesc = "65d4f6s54f6sd4f665d4sf6";
583 int32_t ret = callBackProxy.SyncNodeInfoRemoteInput(userDevId, dhid, nodeDesc);
584 EXPECT_EQ(DH_SUCCESS, ret);
585 }
586
587 HWTEST_F(DInputSourceCallBackTest, RegisterSimulationEventListener01, testing::ext::TestSize.Level1)
588 {
589 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
590 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
591 sptr<TestDInputSimulationEventCallBack> listener(new TestDInputSimulationEventCallBack());
592 int32_t ret = callBackProxy.RegisterSimulationEventListener(listener);
593 EXPECT_EQ(DH_SUCCESS, ret);
594 }
595
596 HWTEST_F(DInputSourceCallBackTest, UnregisterSimulationEventListener01, testing::ext::TestSize.Level1)
597 {
598 sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
599 DistributedInputSourceProxy callBackProxy(callBackStubPtr);
600 sptr<TestDInputSimulationEventCallBack> listener(new TestDInputSimulationEventCallBack());
601 int32_t ret = callBackProxy.UnregisterSimulationEventListener(listener);
602 EXPECT_EQ(DH_SUCCESS, ret);
603 }
604 } // namespace DistributedInput
605 } // namespace DistributedHardware
606 } // namespace OHOS