1 /*
2 * Copyright (c) 2022-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 #include "distributed_input_client_test.h"
17
18 #include "nlohmann/json.hpp"
19
20 #include "dinput_errcode.h"
21 #include "add_white_list_infos_call_back_proxy.h"
22 #include "add_white_list_infos_call_back_stub.h"
23 #include "distributed_input_inject.h"
24
25 using namespace testing::ext;
26 using namespace OHOS::DistributedHardware::DistributedInput;
27 using namespace std;
28 namespace OHOS {
29 namespace DistributedHardware {
30 namespace DistributedInput {
SetUp()31 void DistributedInputClientTest::SetUp()
32 {
33 }
34
TearDown()35 void DistributedInputClientTest::TearDown()
36 {
37 }
38
SetUpTestCase()39 void DistributedInputClientTest::SetUpTestCase()
40 {
41 }
42
TearDownTestCase()43 void DistributedInputClientTest::TearDownTestCase()
44 {
45 }
46
StructTransJson(const InputDevice & pBuf,std::string & strDescriptor) const47 int32_t DistributedInputClientTest::StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) const
48 {
49 nlohmann::json tmpJson;
50 tmpJson["name"] = pBuf.name;
51 tmpJson["physicalPath"] = pBuf.physicalPath;
52 tmpJson["uniqueId"] = pBuf.uniqueId;
53 tmpJson["bus"] = pBuf.bus;
54 tmpJson["vendor"] = pBuf.vendor;
55 tmpJson["product"] = pBuf.product;
56 tmpJson["version"] = pBuf.version;
57 tmpJson["descriptor"] = pBuf.descriptor;
58 tmpJson["classes"] = pBuf.classes;
59
60 std::ostringstream stream;
61 stream << tmpJson.dump();
62 strDescriptor = stream.str();
63 return DH_SUCCESS;
64 }
65
OnRegisterResult(const std::string & devId,const std::string & dhId,int32_t status,const std::string & data)66 int32_t DistributedInputClientTest::TestRegisterDInputCallback::OnRegisterResult(const std::string &devId,
67 const std::string &dhId, int32_t status, const std::string &data)
68 {
69 (void)dhId;
70 (void)status;
71 (void)data;
72 return DH_SUCCESS;
73 }
74
OnUnregisterResult(const std::string & devId,const std::string & dhId,int32_t status,const std::string & data)75 int32_t DistributedInputClientTest::TestUnregisterDInputCallback::OnUnregisterResult(const std::string &devId,
76 const std::string &dhId, int32_t status, const std::string &data)
77 {
78 (void)dhId;
79 (void)status;
80 (void)data;
81 return DH_SUCCESS;
82 }
83
OnResult(const std::string & deviceId,const int32_t & status)84 void DistributedInputClientTest::TestPrepareDInputCallback::OnResult(
85 const std::string &deviceId, const int32_t &status)
86 {
87 (void)deviceId;
88 (void)status;
89 return;
90 }
91
OnResult(const std::string & deviceId,const int32_t & status)92 void DistributedInputClientTest::TestUnprepareDInputCallback::OnResult(
93 const std::string &deviceId, const int32_t &status)
94 {
95 (void)deviceId;
96 (void)status;
97 return;
98 }
99
OnResult(const std::string & deviceId,const uint32_t & inputTypes,const int32_t & status)100 void DistributedInputClientTest::TestStartDInputCallback::OnResult(
101 const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status)
102 {
103 (void)deviceId;
104 (void)inputTypes;
105 (void)status;
106 return;
107 }
108
OnResult(const std::string & deviceId,const uint32_t & inputTypes,const int32_t & status)109 void DistributedInputClientTest::TestStopDInputCallback::OnResult(
110 const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status)
111 {
112 (void)deviceId;
113 (void)inputTypes;
114 (void)status;
115 return;
116 }
117
OnResultDhids(const std::string & devId,const int32_t & status)118 void DistributedInputClientTest::TestStartStopDInputCallback::OnResultDhids(
119 const std::string &devId, const int32_t &status)
120 {
121 (void)devId;
122 (void)status;
123 return;
124 }
125
OnNodeOnLine(const std::string & srcDevId,const std::string & sinkDevId,const std::string & sinkNodeId,const std::string & sinkNodeDesc)126 void DistributedInputClientTest::TestInputNodeListener::OnNodeOnLine(const std::string &srcDevId,
127 const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc)
128 {
129 (void)srcDevId;
130 (void)sinkDevId;
131 (void)sinkNodeId;
132 (void)sinkNodeDesc;
133 return;
134 }
135
OnNodeOffLine(const std::string & srcDevId,const std::string & sinkDevId,const std::string & sinkNodeId)136 void DistributedInputClientTest::TestInputNodeListener::OnNodeOffLine(const std::string &srcDevId,
137 const std::string &sinkDevId, const std::string &sinkNodeId)
138 {
139 (void)srcDevId;
140 (void)sinkDevId;
141 (void)sinkNodeId;
142 return;
143 }
144
OnSimulationEvent(uint32_t type,uint32_t code,int32_t value)145 int32_t DistributedInputClientTest::TestSimulationEventListenerStub::OnSimulationEvent(
146 uint32_t type, uint32_t code, int32_t value)
147 {
148 (void)type;
149 (void)code;
150 (void)value;
151 return DH_SUCCESS;
152 }
153
154 HWTEST_F(DistributedInputClientTest, InitSource01, testing::ext::TestSize.Level1)
155 {
156 int32_t ret = DistributedInputClient::GetInstance().InitSource();
157 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_INIT_FAIL, ret);
158 }
159
160 HWTEST_F(DistributedInputClientTest, InitSink01, testing::ext::TestSize.Level1)
161 {
162 int32_t ret = DistributedInputClient::GetInstance().InitSink();
163 EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_MANAGER_INIT_FAIL, ret);
164 }
165
166 HWTEST_F(DistributedInputClientTest, RegisterDistributedHardware01, testing::ext::TestSize.Level1)
167 {
168 std::string devId;
169 std::string dhId;
170 std::string parameters;
171 std::shared_ptr<RegisterCallback> callback;
172 int32_t ret = DistributedInputClient::GetInstance().RegisterDistributedHardware(devId, dhId, parameters, callback);
173 EXPECT_EQ(ERR_DH_INPUT_CLIENT_REGISTER_FAIL, ret);
174 }
175
176 HWTEST_F(DistributedInputClientTest, UnregisterDistributedHardware01, testing::ext::TestSize.Level1)
177 {
178 std::string devId;
179 std::string dhId;
180 std::shared_ptr<UnregisterCallback> callback;
181 int32_t ret = DistributedInputClient::GetInstance().UnregisterDistributedHardware(devId, dhId, callback);
182 EXPECT_EQ(ERR_DH_INPUT_CLIENT_UNREGISTER_FAIL, ret);
183 }
184
185 HWTEST_F(DistributedInputClientTest, UnregisterDistributedHardware02, testing::ext::TestSize.Level1)
186 {
187 std::shared_ptr<TestUnregisterDInputCallback> unregisterDInputCallback =
188 std::make_shared<TestUnregisterDInputCallback>();
189 int32_t ret = DistributedInputClient::GetInstance().UnregisterDistributedHardware("devId",
190 "dhId", unregisterDInputCallback);
191 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret);
192 }
193
194 HWTEST_F(DistributedInputClientTest, PrepareRemoteInput01, testing::ext::TestSize.Level1)
195 {
196 string deviceId = "PrepareRemoteInput01";
197 sptr<TestPrepareDInputCallback> callback(new TestPrepareDInputCallback());
198 int32_t ret = DistributedInputClient::GetInstance().PrepareRemoteInput(deviceId, callback);
199 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
200 }
201
202 HWTEST_F(DistributedInputClientTest, PrepareRemoteInput02, testing::ext::TestSize.Level1)
203 {
204 string deviceId = "";
205 sptr<TestPrepareDInputCallback> callback = nullptr;
206 std::shared_ptr<TestUnregisterDInputCallback> unregisterDInputCallback =
207 std::make_shared<TestUnregisterDInputCallback>();
208 int32_t ret = DistributedInputClient::GetInstance().PrepareRemoteInput(deviceId, callback);
209 EXPECT_EQ(ERR_DH_INPUT_CLIENT_PREPARE_FAIL, ret);
210 }
211
212 HWTEST_F(DistributedInputClientTest, PrepareRemoteInput03, testing::ext::TestSize.Level0)
213 {
214 std::string srcId = "PrepareRemoteInput_test";
215 std::string sinkId = "PrepareRemoteInput_test";
216 sptr<IPrepareDInputCallback> callback(new TestPrepareDInputCallback());
217 int32_t ret = DistributedInputClient::GetInstance().PrepareRemoteInput(srcId, sinkId, callback);
218 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
219 }
220
221 HWTEST_F(DistributedInputClientTest, PrepareRemoteInput04, testing::ext::TestSize.Level0)
222 {
223 std::string srcId = "";
224 std::string sinkId = "";
225 sptr<TestPrepareDInputCallback> callback = nullptr;
226 int32_t ret = DistributedInputClient::GetInstance().PrepareRemoteInput(srcId, sinkId, callback);
227 EXPECT_EQ(ERR_DH_INPUT_CLIENT_PREPARE_FAIL, ret);
228 }
229
230 HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput01, testing::ext::TestSize.Level0)
231 {
232 string deviceId = "UnprepareRemoteInput01";
233 sptr<TestUnprepareDInputCallback> callback(new TestUnprepareDInputCallback());
234 int32_t ret = DistributedInputClient::GetInstance().UnprepareRemoteInput(deviceId, callback);
235 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
236 }
237
238 HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput02, testing::ext::TestSize.Level0)
239 {
240 string deviceId = "";
241 sptr<TestUnprepareDInputCallback> callback = nullptr;
242 int32_t ret = DistributedInputClient::GetInstance().UnprepareRemoteInput(deviceId, callback);
243 EXPECT_EQ(ERR_DH_INPUT_CLIENT_UNPREPARE_FAIL, ret);
244 }
245
246 HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput03, testing::ext::TestSize.Level0)
247 {
248 std::string srcId = "PrepareRemoteInput_src";
249 std::string sinkId = "PrepareRemoteInput_sink";
250 sptr<TestUnprepareDInputCallback> callback(new TestUnprepareDInputCallback());
251 int32_t ret = DistributedInputClient::GetInstance().UnprepareRemoteInput(srcId, sinkId, callback);
252 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
253 }
254
255 HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput04, testing::ext::TestSize.Level0)
256 {
257 std::string srcId = "";
258 std::string sinkId = "";
259 sptr<TestUnprepareDInputCallback> callback = nullptr;
260 int32_t ret = DistributedInputClient::GetInstance().UnprepareRemoteInput(srcId, sinkId, callback);
261 EXPECT_EQ(ERR_DH_INPUT_CLIENT_UNPREPARE_FAIL, ret);
262 }
263
264 HWTEST_F(DistributedInputClientTest, StartRemoteInput01, testing::ext::TestSize.Level0)
265 {
266 string deviceId = "StartRemoteInput01";
267 sptr<TestStartDInputCallback> callback(new TestStartDInputCallback());
268 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(
269 deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
270 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
271 }
272
273 HWTEST_F(DistributedInputClientTest, StartRemoteInput02, testing::ext::TestSize.Level0)
274 {
275 string deviceId = "";
276 sptr<TestStartDInputCallback> callback = nullptr;
277 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(
278 deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
279 EXPECT_EQ(ERR_DH_INPUT_CLIENT_START_FAIL, ret);
280 }
281
282 HWTEST_F(DistributedInputClientTest, StartRemoteInput03, testing::ext::TestSize.Level0)
283 {
284 std::string sinkId = "StartRemoteInput_sink";
285 std::vector<std::string> dhIds = {"dhIds_test"};
286 sptr<TestStartStopDInputCallback> callback(new TestStartStopDInputCallback());
287 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(sinkId, dhIds, callback);
288 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
289 }
290
291 HWTEST_F(DistributedInputClientTest, StartRemoteInput04, testing::ext::TestSize.Level0)
292 {
293 std::string sinkId = "";
294 std::vector<std::string> dhIds;
295 sptr<TestStartStopDInputCallback> callback = nullptr;
296 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(sinkId, dhIds, callback);
297 EXPECT_EQ(ERR_DH_INPUT_CLIENT_START_FAIL, ret);
298 }
299
300 HWTEST_F(DistributedInputClientTest, StartRemoteInput05, testing::ext::TestSize.Level0)
301 {
302 string srcId = "StartRemoteInput01-src";
303 string sinkId = "StartRemoteInput01-sink";
304 sptr<TestStartDInputCallback> callback(new TestStartDInputCallback());
305 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(
306 srcId, sinkId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
307 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
308 }
309
310 HWTEST_F(DistributedInputClientTest, StartRemoteInput06, testing::ext::TestSize.Level0)
311 {
312 string srcId = "";
313 string sinkId = "";
314 sptr<TestStartDInputCallback> callback = nullptr;
315 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(
316 srcId, sinkId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
317 EXPECT_EQ(ERR_DH_INPUT_CLIENT_START_FAIL, ret);
318 }
319
320 HWTEST_F(DistributedInputClientTest, StartRemoteInput07, testing::ext::TestSize.Level0)
321 {
322 string srcId = "StartRemoteInput01-src";
323 string sinkId = "StartRemoteInput01-sink";
324 std::vector<std::string> dhIds = {"dhIds_test"};
325 sptr<TestStartStopDInputCallback> callback(new TestStartStopDInputCallback());
326 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(srcId, sinkId, dhIds, callback);
327 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
328 }
329
330 HWTEST_F(DistributedInputClientTest, StartRemoteInput08, testing::ext::TestSize.Level0)
331 {
332 string srcId = "";
333 string sinkId = "";
334 std::vector<std::string> dhIds;
335 sptr<TestStartStopDInputCallback> callback = nullptr;
336 int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(srcId, sinkId, dhIds, callback);
337 EXPECT_EQ(ERR_DH_INPUT_CLIENT_START_FAIL, ret);
338 }
339
340 HWTEST_F(DistributedInputClientTest, StopRemoteInput01, testing::ext::TestSize.Level0)
341 {
342 string deviceId = "StopRemoteInput01";
343 sptr<TestStopDInputCallback> callback(new TestStopDInputCallback());
344 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(
345 deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
346 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
347 }
348
349 HWTEST_F(DistributedInputClientTest, StopRemoteInput02, testing::ext::TestSize.Level0)
350 {
351 string deviceId = "";
352 sptr<TestStopDInputCallback> callback = nullptr;
353 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(
354 deviceId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
355 EXPECT_EQ(ERR_DH_INPUT_CLIENT_STOP_FAIL, ret);
356 }
357
358 HWTEST_F(DistributedInputClientTest, StopRemoteInput03, testing::ext::TestSize.Level0)
359 {
360 std::string sinkId = "StartRemoteInput_test";
361 std::vector<std::string> dhIds = {"dhIds_test"};
362 sptr<TestStartStopDInputCallback> callback(new TestStartStopDInputCallback());
363 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(sinkId, dhIds, callback);
364 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
365 }
366
367 HWTEST_F(DistributedInputClientTest, StopRemoteInput04, testing::ext::TestSize.Level0)
368 {
369 std::string sinkId = "";
370 std::vector<std::string> dhIds;
371 sptr<TestStartStopDInputCallback> callback = nullptr;
372 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(sinkId, dhIds, callback);
373 EXPECT_EQ(ERR_DH_INPUT_CLIENT_STOP_FAIL, ret);
374 }
375
376 HWTEST_F(DistributedInputClientTest, StopRemoteInput05, testing::ext::TestSize.Level0)
377 {
378 string srcId = "StopRemoteInput03-src";
379 string sinkId = "StopRemoteInput03-sink";
380 sptr<TestStopDInputCallback> callback(new TestStopDInputCallback());
381 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(
382 srcId, sinkId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
383 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
384 }
385
386 HWTEST_F(DistributedInputClientTest, StopRemoteInput06, testing::ext::TestSize.Level0)
387 {
388 string srcId = "";
389 string sinkId = "";
390 sptr<TestStopDInputCallback> callback = nullptr;
391 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(
392 srcId, sinkId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
393 EXPECT_EQ(ERR_DH_INPUT_CLIENT_STOP_FAIL, ret);
394 }
395
396 HWTEST_F(DistributedInputClientTest, StopRemoteInput07, testing::ext::TestSize.Level0)
397 {
398 string srcId = "StartRemoteInput01-src";
399 string sinkId = "StartRemoteInput01-sink";
400 std::vector<std::string> dhIds = {"dhIds_test"};
401 sptr<TestStartStopDInputCallback> callback(new TestStartStopDInputCallback());
402 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, dhIds, callback);
403 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
404 }
405
406 HWTEST_F(DistributedInputClientTest, StopRemoteInput08, testing::ext::TestSize.Level0)
407 {
408 string srcId = "";
409 string sinkId = "";
410 std::vector<std::string> dhIds;
411 sptr<TestStartStopDInputCallback> callback = nullptr;
412 int32_t status = 0;
413 DistributedInputClient::RegisterDInputCb regCb;
414 regCb.OnResult(srcId, sinkId, status);
415 DistributedInputClient::UnregisterDInputCb unregCb;
416 unregCb.OnResult(srcId, sinkId, status);
417 DistributedInputClient::AddWhiteListInfosCb addCb;
418 addCb.OnResult(srcId, sinkId);
419 DistributedInputClient::DelWhiteListInfosCb delCb;
420 delCb.OnResult(srcId);
421 DistributedInputClient::GetSinkScreenInfosCb getSinkCb;
422 getSinkCb.OnResult(srcId);
423 DistributedInputClient::SharingDhIdListenerCb sharingCb;
424 sharingCb.OnSharing(srcId);
425 sharingCb.OnNoSharing(srcId);
426
427 int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, dhIds, callback);
428 EXPECT_EQ(ERR_DH_INPUT_CLIENT_STOP_FAIL, ret);
429 }
430
431 HWTEST_F(DistributedInputClientTest, ProcessEvent01, testing::ext::TestSize.Level0)
432 {
433 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
434 DistributedInputClient::DInputClientEventHandler eventHandler(runner);
435 AppExecFwk::InnerEvent::Pointer event =
436 AppExecFwk::InnerEvent::Get(DINPUT_CLIENT_CHECK_SOURCE_CALLBACK_REGISTER_MSG, 4809);
437 ASSERT_NE(nullptr, event);
438 eventHandler.ProcessEvent(event);
439 EXPECT_EQ(event->GetInnerEventId(), DINPUT_CLIENT_CHECK_SOURCE_CALLBACK_REGISTER_MSG);
440 }
441
442 HWTEST_F(DistributedInputClientTest, ProcessEvent02, testing::ext::TestSize.Level0)
443 {
444 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
445 DistributedInputClient::DInputClientEventHandler eventHandler(runner);
446 AppExecFwk::InnerEvent::Pointer event =
447 AppExecFwk::InnerEvent::Get(DINPUT_CLIENT_CHECK_SINK_CALLBACK_REGISTER_MSG, 4809);
448 ASSERT_NE(nullptr, event);
449 eventHandler.ProcessEvent(event);
450 EXPECT_EQ(event->GetInnerEventId(), DINPUT_CLIENT_CHECK_SINK_CALLBACK_REGISTER_MSG);
451 }
452
453 HWTEST_F(DistributedInputClientTest, ProcessEvent03, testing::ext::TestSize.Level0)
454 {
455 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
456 DistributedInputClient::DInputClientEventHandler eventHandler(runner);
457 AppExecFwk::InnerEvent::Pointer event =
458 AppExecFwk::InnerEvent::Get(DINPUT_CLIENT_CLEAR_SOURCE_CALLBACK_REGISTER_MSG, 4809);
459 ASSERT_NE(nullptr, event);
460 eventHandler.ProcessEvent(event);
461 EXPECT_EQ(event->GetInnerEventId(), DINPUT_CLIENT_CLEAR_SOURCE_CALLBACK_REGISTER_MSG);
462 }
463
464 HWTEST_F(DistributedInputClientTest, ProcessEvent04, testing::ext::TestSize.Level0)
465 {
466 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
467 DistributedInputClient::DInputClientEventHandler eventHandler(runner);
468 AppExecFwk::InnerEvent::Pointer event =
469 AppExecFwk::InnerEvent::Get(DINPUT_CLIENT_CLEAR_SINK_CALLBACK_REGISTER_MSG, 4809);
470 ASSERT_NE(nullptr, event);
471 eventHandler.ProcessEvent(event);
472 EXPECT_EQ(event->GetInnerEventId(), DINPUT_CLIENT_CLEAR_SINK_CALLBACK_REGISTER_MSG);
473 }
474 } // namespace DistributedInput
475 } // namespace DistributedHardware
476 } // namespace OHOS