1 /*
2 * Copyright (c) 2021-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 "distributed_input_sourceinject_test.h"
17
18 #include <cstring>
19 #include <fcntl.h>
20 #include <iostream>
21 #include <thread>
22 #include <unistd.h>
23
24 #include <linux/input.h>
25
26 #include "event_handler.h"
27 #include "nlohmann/json.hpp"
28
29 #include "dinput_errcode.h"
30 #include "softbus_bus_center.h"
31
32 using namespace testing::ext;
33 using namespace OHOS::DistributedHardware::DistributedInput;
34 using namespace std;
35 namespace OHOS {
36 namespace DistributedHardware {
37 namespace DistributedInput {
SetUp()38 void DistributedInputSourceInjectTest::SetUp()
39 {
40 }
41
TearDown()42 void DistributedInputSourceInjectTest::TearDown()
43 {
44 }
45
SetUpTestCase()46 void DistributedInputSourceInjectTest::SetUpTestCase()
47 {
48 }
49
TearDownTestCase()50 void DistributedInputSourceInjectTest::TearDownTestCase()
51 {
52 }
53
OnNodeOnLine(const std::string srcDevId,const std::string sinkDevId,const std::string sinkNodeId,const std::string sinkNodeDesc)54 void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOnLine(const std::string srcDevId,
55 const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc)
56 {
57 (void)srcDevId;
58 (void)sinkDevId;
59 (void)sinkNodeId;
60 (void)sinkNodeDesc;
61 }
62
OnNodeOffLine(const std::string srcDevId,const std::string sinkDevId,const std::string sinkNodeId)63 void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOffLine(const std::string srcDevId,
64 const std::string sinkDevId, const std::string sinkNodeId)
65 {
66 (void)srcDevId;
67 (void)sinkDevId;
68 (void)sinkNodeId;
69 }
70
71 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedHardware01, testing::ext::TestSize.Level1)
72 {
73 InputDevice pBuffer;
74 pBuffer.name = "uinput_name_keyboard";
75 pBuffer.bus = 0x03;
76 pBuffer.vendor = 0x1234;
77 pBuffer.product = 0xfedc;
78 pBuffer.version = 1;
79 pBuffer.physicalPath = "usb-hiusb-ehci-2.1/input1";
80 pBuffer.uniqueId = "1";
81 pBuffer.classes = INPUT_DEVICE_CLASS_KEYBOARD;
82 pBuffer.descriptor = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
83
84 std::string devId = "y4umjym16tgn21m896f1nt2y1894ty61nty651m89t1m";
85 std::string dhId = pBuffer.descriptor;
86 std::string parameters;
87 DistributedInputInject::GetInstance().StructTransJson(pBuffer, parameters);
88 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedHardware(devId, dhId, parameters);
89 EXPECT_EQ(DH_SUCCESS, ret);
90 }
91
92 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedHardware02, testing::ext::TestSize.Level1)
93 {
94 InputDevice pBuffer;
95 pBuffer.name = "uinput_name_mouse";
96 pBuffer.bus = 0x03;
97 pBuffer.vendor = 0x1222;
98 pBuffer.product = 0xfeda;
99 pBuffer.version = 2;
100 pBuffer.physicalPath = "usb-hiusb-ehci-2.1/input1";
101 pBuffer.uniqueId = "2";
102 pBuffer.classes = INPUT_DEVICE_CLASS_CURSOR;
103 pBuffer.descriptor = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
104
105 std::string devId = "1sdvsd1v5w1v2d1v8d1v562sd11v5sd1";
106 std::string dhId = pBuffer.descriptor;
107 std::string parameters;
108 DistributedInputInject::GetInstance().StructTransJson(pBuffer, parameters);
109 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedHardware(devId, dhId, parameters);
110 EXPECT_EQ(DH_SUCCESS, ret);
111 }
112
113 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedHardware03, testing::ext::TestSize.Level1)
114 {
115 InputDevice pBuffer;
116 pBuffer.name = "uinput_name_touch";
117 pBuffer.bus = 0x03;
118 pBuffer.vendor = 0x1233;
119 pBuffer.product = 0xfedb;
120 pBuffer.version = 3;
121 pBuffer.physicalPath = "usb-hiusb-ehci-2.1/input1";
122 pBuffer.uniqueId = "3";
123 pBuffer.classes = INPUT_DEVICE_CLASS_TOUCH;
124 pBuffer.descriptor = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
125
126 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
127 std::string dhId = pBuffer.descriptor;
128 std::string parameters;
129 DistributedInputInject::GetInstance().StructTransJson(pBuffer, parameters);
130 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedHardware(devId, dhId, parameters);
131 EXPECT_EQ(DH_SUCCESS, ret);
132 }
133
134 HWTEST_F(DistributedInputSourceInjectTest, UnregisterDistributedHardware_001, testing::ext::TestSize.Level1)
135 {
136 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
137 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
138 int32_t ret = DistributedInputInject::GetInstance().UnregisterDistributedHardware(devId, dhId);
139 EXPECT_EQ(DH_SUCCESS, ret);
140 }
141
142 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedHardware04, testing::ext::TestSize.Level1)
143 {
144 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
145 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
146 std::string parameters;
147 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
148 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedHardware(devId, dhId, parameters);
149 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
150 }
151
152 HWTEST_F(DistributedInputSourceInjectTest, UnregisterDistributedHardware_002, testing::ext::TestSize.Level1)
153 {
154 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
155 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
156 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
157 int32_t ret = DistributedInputInject::GetInstance().UnregisterDistributedHardware(devId, dhId);
158 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
159 }
160
161 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent01, testing::ext::TestSize.Level1)
162 {
163 struct RawEvent writeBuffer[4];
164 RawEvent* event = writeBuffer;
165
166 event->when = 0;
167 event->type = EV_KEY;
168 event->code = KEY_D;
169 event->value = 1;
170 event->descriptor = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
171 event += 1;
172
173 event->when = 1;
174 event->type = EV_KEY;
175 event->code = KEY_D;
176 event->value = 0;
177 event->descriptor = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
178 event += 1;
179
180 event->when = 2;
181 event->type = EV_KEY;
182 event->code = KEY_D;
183 event->value = 1;
184 event->descriptor = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
185 event += 1;
186
187 event->when = 3;
188 event->type = EV_KEY;
189 event->code = KEY_D;
190 event->value = 0;
191 event->descriptor = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
192
193 size_t count = (size_t)(sizeof(writeBuffer) / sizeof(RawEvent));
194 DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
195 DistributedInputInject::GetInstance().StartInjectThread();
196 DistributedInputInject::GetInstance().StopInjectThread();
197 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedEvent(writeBuffer, count);
198 EXPECT_EQ(DH_SUCCESS, ret);
199 }
200
201 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent02, testing::ext::TestSize.Level1)
202 {
203 struct RawEvent writeBuffer[4];
204 RawEvent* event = writeBuffer;
205
206 event->when = 0;
207 event->type = EV_REL;
208 event->code = REL_X;
209 event->value = 2;
210 event->descriptor = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
211 event += 1;
212
213 event->when = 1;
214 event->type = EV_REL;
215 event->code = REL_Y;
216 event->value = 2;
217 event->descriptor = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
218 event += 1;
219
220 event->when = 2;
221 event->type = EV_REL;
222 event->code = REL_X;
223 event->value = 2;
224 event->descriptor = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
225 event += 1;
226
227 event->when = 3;
228 event->type = EV_REL;
229 event->code = REL_Y;
230 event->value = 2;
231 event->descriptor = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
232
233 event->when = 4;
234 event->type = EV_SYN;
235 event->code = SYN_REPORT;
236 event->value = 0;
237 event->descriptor = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
238
239 size_t count = (size_t)(sizeof(writeBuffer) / sizeof(RawEvent));
240 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedEvent(writeBuffer, count);
241 EXPECT_EQ(DH_SUCCESS, ret);
242 }
243
244 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent03, testing::ext::TestSize.Level1)
245 {
246 struct RawEvent writeBuffer[4];
247 RawEvent* event = writeBuffer;
248
249 event->when = 0;
250 event->type = EV_ABS;
251 event->code = ABS_X;
252 event->value = 1;
253 event->descriptor = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
254 event += 1;
255
256 event->when = 1;
257 event->type = EV_ABS;
258 event->code = ABS_X;
259 event->value = 2;
260 event->descriptor = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
261 event += 1;
262
263 event->when = 2;
264 event->type = EV_ABS;
265 event->code = ABS_X;
266 event->value = 3;
267 event->descriptor = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
268 event += 1;
269
270 event->when = 3;
271 event->type = EV_ABS;
272 event->code = ABS_X;
273 event->value = 4;
274 event->descriptor = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
275
276 size_t count = (size_t)(sizeof(writeBuffer) / sizeof(RawEvent));
277 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedEvent(writeBuffer, count);
278 EXPECT_EQ(DH_SUCCESS, ret);
279 }
280
281 HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent04, testing::ext::TestSize.Level1)
282 {
283 struct RawEvent writeBuffer[4];
284 size_t count = (size_t)(sizeof(writeBuffer) / sizeof(RawEvent));
285 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
286 int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedEvent(writeBuffer, count);
287 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
288 }
289
290 HWTEST_F(DistributedInputSourceInjectTest, RegisterInputNodeListener, testing::ext::TestSize.Level1)
291 {
292 inputNodelistener_ = (std::make_unique<TestInputNodeListener>()).release();
293 int32_t ret = DistributedInputInject::GetInstance().RegisterInputNodeListener(inputNodelistener_);
294 EXPECT_EQ(DH_SUCCESS, ret);
295 }
296
297 HWTEST_F(DistributedInputSourceInjectTest, UnRegisterInputNodeListener, testing::ext::TestSize.Level1)
298 {
299 int32_t ret = DistributedInputInject::GetInstance().UnregisterInputNodeListener(inputNodelistener_);
300 EXPECT_EQ(DH_SUCCESS, ret);
301 }
302
303 HWTEST_F(DistributedInputSourceInjectTest, GetDhIdsByInputType_001, testing::ext::TestSize.Level1)
304 {
305 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
306 std::vector<std::string> dhIds;
307 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
308 dhIds.push_back(dhId);
309 std::shared_ptr<RawEvent> rawEvent = nullptr;
310 DistributedInputInject::GetInstance().InputDeviceEventInject(rawEvent);
311 DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
312 int32_t ret = DistributedInputInject::GetInstance().GetDhIdsByInputType(devId,
313 static_cast<uint32_t>(DInputDeviceType::ALL), dhIds);
314 EXPECT_EQ(DH_SUCCESS, ret);
315 }
316
317 HWTEST_F(DistributedInputSourceInjectTest, GetDhIdsByInputType_002, testing::ext::TestSize.Level1)
318 {
319 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
320 std::shared_ptr<RawEvent> rawEvent = std::make_shared<RawEvent>();
321 DistributedInputInject::GetInstance().InputDeviceEventInject(rawEvent);
322
323 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
324 std::vector<std::string> dhIds;
325 int32_t ret = DistributedInputInject::GetInstance().GetDhIdsByInputType(devId,
326 static_cast<uint32_t>(DInputDeviceType::ALL), dhIds);
327 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
328 }
329
330 HWTEST_F(DistributedInputSourceInjectTest, GenerateVirtualTouchScreenDHId_001, testing::ext::TestSize.Level1)
331 {
332 std::string ret = DistributedInputInject::GetInstance().GenerateVirtualTouchScreenDHId(1, 1860, 980);
333 EXPECT_NE(0, ret.size());
334 }
335
336 HWTEST_F(DistributedInputSourceInjectTest, CreateVirtualTouchScreenNode_001, testing::ext::TestSize.Level1)
337 {
338 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
339 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
340 DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
341 int32_t ret = DistributedInputInject::GetInstance().CreateVirtualTouchScreenNode(devId, dhId, 1, 1860, 980);
342 EXPECT_EQ(DH_SUCCESS, ret);
343 }
344
345 HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_001, testing::ext::TestSize.Level1)
346 {
347 int32_t ret = DistributedInputInject::GetInstance().GetVirtualTouchScreenFd();
348 EXPECT_NE(-1, ret);
349 }
350
351 HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_001, testing::ext::TestSize.Level1)
352 {
353 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
354 int32_t ret = DistributedInputInject::GetInstance().RemoveVirtualTouchScreenNode(dhId);
355 EXPECT_EQ(DH_SUCCESS, ret);
356 }
357
358 HWTEST_F(DistributedInputSourceInjectTest, CreateVirtualTouchScreenNode_002, testing::ext::TestSize.Level1)
359 {
360 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
361 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
362 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
363 int32_t ret = DistributedInputInject::GetInstance().CreateVirtualTouchScreenNode(devId, dhId, 1, 1860, 980);
364 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
365 }
366
367 HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_002, testing::ext::TestSize.Level1)
368 {
369 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
370 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
371 int32_t ret = DistributedInputInject::GetInstance().RemoveVirtualTouchScreenNode(dhId);
372 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
373 }
374
375 HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_002, testing::ext::TestSize.Level1)
376 {
377 DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
378 int32_t ret = DistributedInputInject::GetInstance().GetVirtualTouchScreenFd();
379 EXPECT_EQ(-1, ret);
380 }
381
382 HWTEST_F(DistributedInputSourceInjectTest, CreateVirtualTouchScreenNode_003, testing::ext::TestSize.Level1)
383 {
384 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
385 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
386 const uint64_t srcWinId = 1;
387 DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
388 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->
389 CreateVirtualTouchScreenNode(devId, dhId, srcWinId, 1860, 980);
390 EXPECT_EQ(DH_SUCCESS, ret);
391 }
392
393 HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_003, testing::ext::TestSize.Level1)
394 {
395 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
396 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->RemoveVirtualTouchScreenNode(dhId);
397 EXPECT_EQ(DH_SUCCESS, ret);
398 }
399
400 HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_003, testing::ext::TestSize.Level1)
401 {
402 std::string networkId = "umkyu1b165e1be98151891erbe8r91ev";
403 uint32_t inputTypes = 1;
404 std::map<int32_t, std::string> datas;
405 DistributedInputInject::GetInstance().inputNodeManager_->GetDevicesInfoByType(networkId, inputTypes, datas);
406
407 inputTypes = 2;
408 DistributedInputInject::GetInstance().inputNodeManager_->GetDevicesInfoByType(networkId, inputTypes, datas);
409
410 std::vector<std::string> dhidsVec;
411 DistributedInputInject::GetInstance().inputNodeManager_->GetDevicesInfoByDhId(dhidsVec, datas);
412 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->GetVirtualTouchScreenFd();
413 EXPECT_NE(-1, ret);
414 }
415
416 HWTEST_F(DistributedInputSourceInjectTest, GetDevice_001, testing::ext::TestSize.Level1)
417 {
418 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
419 VirtualDevice* device = nullptr;
420 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->GetDevice(dhId, device);
421 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_GET_DEVICE_FAIL, ret);
422 }
423
424 HWTEST_F(DistributedInputSourceInjectTest, OpenDevicesNode_001, testing::ext::TestSize.Level1)
425 {
426 std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
427 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
428 std::string parameters = "";
429 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->OpenDevicesNode(devId, dhId, parameters);
430 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
431
432 devId = "";
433 parameters = "parameters_test";
434 ret = DistributedInputInject::GetInstance().inputNodeManager_->OpenDevicesNode(devId, dhId, parameters);
435 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
436
437 devId = "umkyu1b165e1be98151891erbe8r91ev";
438 dhId = "";
439 ret = DistributedInputInject::GetInstance().inputNodeManager_->OpenDevicesNode(devId, dhId, parameters);
440 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
441 }
442
443 HWTEST_F(DistributedInputSourceInjectTest, OpenDevicesNode_002, testing::ext::TestSize.Level1)
444 {
445 std::string devId(DEV_ID_LENGTH_MAX + 1, 'a');
446 std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
447 std::string parameters = "parameters_test";
448 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->OpenDevicesNode(devId, dhId, parameters);
449 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
450
451 devId = "umkyu1b165e1be98151891erbe8r91ev";
452 std::string dhIds(DH_ID_LENGTH_MAX + 1, 'a');
453 ret = DistributedInputInject::GetInstance().inputNodeManager_->OpenDevicesNode(devId, dhIds, parameters);
454 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
455
456 std::string dhIdtest = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
457 std::string param(STRING_MAX_SIZE + 1, 'a');
458 ret = DistributedInputInject::GetInstance().inputNodeManager_->OpenDevicesNode(devId, dhIdtest, param);
459 EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
460 }
461
462 HWTEST_F(DistributedInputSourceInjectTest, GetDeviceInfo_001, testing::ext::TestSize.Level1)
463 {
464 std::string deviceId = "";
465 DistributedInputInject::GetInstance().inputNodeManager_->InjectEvent();
466 int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->GetDeviceInfo(deviceId);
467 EXPECT_EQ(DH_SUCCESS, ret);
468 }
469 } // namespace DistributedInput
470 } // namespace DistributedHardware
471 } // namespace OHOS
472