• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #include "distributed_input_sourcetrans_test.h"
17 
18 #include <cstdlib>
19 
20 #include "dinput_errcode.h"
21 #include "dinput_softbus_define.h"
22 #include "distributed_input_source_manager.h"
23 #include "distributed_input_transport_base.h"
24 #include "softbus_permission_check.h"
25 
26 using namespace testing::ext;
27 using namespace OHOS::DistributedHardware::DistributedInput;
28 using namespace std;
29 namespace OHOS {
30 namespace DistributedHardware {
31 namespace DistributedInput {
CheckSrcPermission(const std::string & sinkNetworkId)32 bool SoftBusPermissionCheck::CheckSrcPermission(const std::string &sinkNetworkId)
33 {
34     return true;
35 }
36 
CheckSinkPermission(const AccountInfo & callerAccountInfo)37 bool SoftBusPermissionCheck::CheckSinkPermission(const AccountInfo &callerAccountInfo)
38 {
39     return true;
40 }
41 
SetAccessInfoToSocket(const int32_t sessionId)42 bool SoftBusPermissionCheck::SetAccessInfoToSocket(const int32_t sessionId)
43 {
44     return true;
45 }
TransCallerInfo(SocketAccessInfo * callerInfo,AccountInfo & callerAccountInfo,const std::string & networkId)46 bool SoftBusPermissionCheck::TransCallerInfo(SocketAccessInfo *callerInfo,
47     AccountInfo &callerAccountInfo, const std::string &networkId)
48 {
49     return true;
50 }
51 
FillLocalInfo(SocketAccessInfo * localInfo)52 bool SoftBusPermissionCheck::FillLocalInfo(SocketAccessInfo *localInfo)
53 {
54     return true;
55 }
56 
SetUp()57 void DistributedInputSourceTransTest::SetUp()
58 {
59 }
60 
TearDown()61 void DistributedInputSourceTransTest::TearDown()
62 {
63 }
64 
SetUpTestCase()65 void DistributedInputSourceTransTest::SetUpTestCase()
66 {
67 }
68 
TearDownTestCase()69 void DistributedInputSourceTransTest::TearDownTestCase()
70 {
71 }
72 
73 HWTEST_F(DistributedInputSourceTransTest, Init01, testing::ext::TestSize.Level1)
74 {
75     int32_t ret = DistributedInputSourceTransport::GetInstance().Init();
76     EXPECT_EQ(DH_SUCCESS, ret);
77 }
78 
79 HWTEST_F(DistributedInputSourceTransTest, OpenInputSoftbus01, testing::ext::TestSize.Level1)
80 {
81     std::string remoteDevId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
82     int32_t ret = DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(remoteDevId, false);
83     EXPECT_EQ(DH_SUCCESS, ret);
84     DistributedInputSourceTransport::GetInstance().Release();
85 }
86 
87 HWTEST_F(DistributedInputSourceTransTest, OpenInputSoftbus02, testing::ext::TestSize.Level1)
88 {
89     std::string remoteDevId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
90     int32_t ret = DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(remoteDevId, true);
91     EXPECT_EQ(DH_SUCCESS, ret);
92 }
93 
94 HWTEST_F(DistributedInputSourceTransTest, OpenInputSoftbus03, testing::ext::TestSize.Level1)
95 {
96     std::string remoteDevId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
97     DistributedInputSourceTransport::GetInstance().latencyThreadNum = 1;
98     DistributedInputSourceTransport::GetInstance().injectThreadNum = 1;
99     int32_t ret = DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(remoteDevId, false);
100     EXPECT_EQ(DH_SUCCESS, ret);
101 }
102 
103 HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput_01, testing::ext::TestSize.Level1)
104 {
105     std::string deviceId = "";
106     int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(deviceId);
107     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
108 }
109 
110 HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput_02, testing::ext::TestSize.Level1)
111 {
112     int32_t sessionId = 1;
113     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
114     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
115     int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(deviceId);
116     EXPECT_EQ(DH_SUCCESS, ret);
117 }
118 
119 HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput_03, testing::ext::TestSize.Level1)
120 {
121     std::string deviceId = "";
122     int32_t srcTsrcSeId = 1;
123     int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(srcTsrcSeId, deviceId);
124     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
125 }
126 
127 HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput_04, testing::ext::TestSize.Level1)
128 {
129     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
130     int32_t srcTsrcSeId = 1;
131     int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(srcTsrcSeId, deviceId);
132     EXPECT_EQ(DH_SUCCESS, ret);
133 }
134 
135 HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput_01, testing::ext::TestSize.Level1)
136 {
137     std::string deviceId = "";
138     int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(deviceId);
139     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL, ret);
140 }
141 
142 HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput_02, testing::ext::TestSize.Level1)
143 {
144     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
145     int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(deviceId);
146     EXPECT_EQ(DH_SUCCESS, ret);
147 }
148 
149 HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput_03, testing::ext::TestSize.Level1)
150 {
151     std::string deviceId = "";
152     int32_t srcTsrcSeId = 1;
153     int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(srcTsrcSeId, deviceId);
154     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL, ret);
155 }
156 
157 HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput_04, testing::ext::TestSize.Level1)
158 {
159     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
160     int32_t srcTsrcSeId = 1;
161     int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(srcTsrcSeId, deviceId);
162     EXPECT_EQ(DH_SUCCESS, ret);
163 }
164 
165 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput01, testing::ext::TestSize.Level1)
166 {
167     std::string deviceId = "";
168     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(
169         deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
170     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
171 }
172 
173 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput02, testing::ext::TestSize.Level1)
174 {
175     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
176     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(
177         deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
178     EXPECT_EQ(DH_SUCCESS, ret);
179 }
180 
181 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput03, testing::ext::TestSize.Level1)
182 {
183     std::string deviceId = "";
184     std::string dhid = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
185     std::vector<std::string> dhids;
186     dhids.push_back(dhid);
187     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId, dhids);
188     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
189 }
190 
191 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput04, testing::ext::TestSize.Level1)
192 {
193     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
194     std::string dhid = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
195     std::vector<std::string> dhids;
196     dhids.push_back(dhid);
197     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId, dhids);
198     EXPECT_EQ(DH_SUCCESS, ret);
199 }
200 
201 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInputDhids_01, testing::ext::TestSize.Level1)
202 {
203     int32_t srcTsrcSeId = 1;
204     const std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
205     const std::string dhids = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
206     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInputDhids(srcTsrcSeId, deviceId, dhids);
207     EXPECT_EQ(DH_SUCCESS, ret);
208 }
209 
210 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInputDhids_02, testing::ext::TestSize.Level1)
211 {
212     int32_t srcTsrcSeId = 1;
213     const std::string deviceId = "";
214     const std::string dhids = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
215     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInputDhids(srcTsrcSeId, deviceId, dhids);
216     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
217 }
218 
219 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInputType_01, testing::ext::TestSize.Level1)
220 {
221     int32_t srcTsrcSeId = 1;
222     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
223     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInputType(srcTsrcSeId, deviceId,
224         static_cast<uint32_t>(DInputDeviceType::ALL));
225     EXPECT_EQ(DH_SUCCESS, ret);
226 }
227 
228 HWTEST_F(DistributedInputSourceTransTest, StartRemoteInputType_02, testing::ext::TestSize.Level1)
229 {
230     int32_t srcTsrcSeId = 1;
231     std::string deviceId = "";
232     int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInputType(srcTsrcSeId, deviceId,
233         static_cast<uint32_t>(DInputDeviceType::ALL));
234     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
235 }
236 
237 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput01, testing::ext::TestSize.Level1)
238 {
239     std::string deviceId = "";
240     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(
241         deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
242     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
243 }
244 
245 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput02, testing::ext::TestSize.Level1)
246 {
247     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
248     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(
249         deviceId, static_cast<uint32_t>(DInputDeviceType::ALL));
250     EXPECT_EQ(DH_SUCCESS, ret);
251 }
252 
253 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput03, testing::ext::TestSize.Level1)
254 {
255     std::string deviceId = "";
256     std::vector<std::string> dhids;
257     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
258     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, dhids);
259     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
260 }
261 
262 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput04, testing::ext::TestSize.Level1)
263 {
264     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
265     std::vector<std::string> dhids;
266     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
267     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, dhids);
268     EXPECT_EQ(DH_SUCCESS, ret);
269 }
270 
271 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInputDhids_01, testing::ext::TestSize.Level1)
272 {
273     int32_t srcTsrcSeId = 1;
274     const std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
275     const std::string dhids = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
276     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInputDhids(srcTsrcSeId, deviceId, dhids);
277     EXPECT_EQ(DH_SUCCESS, ret);
278 }
279 
280 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInputDhids_02, testing::ext::TestSize.Level1)
281 {
282     int32_t srcTsrcSeId = 1;
283     const std::string deviceId = "";
284     const std::string dhids = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
285     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInputDhids(srcTsrcSeId, deviceId, dhids);
286     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
287 }
288 
289 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInputType_01, testing::ext::TestSize.Level1)
290 {
291     int32_t srcTsrcSeId = 1;
292     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
293     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInputType(srcTsrcSeId, deviceId,
294         static_cast<uint32_t>(DInputDeviceType::ALL));
295     EXPECT_EQ(DH_SUCCESS, ret);
296 }
297 
298 HWTEST_F(DistributedInputSourceTransTest, StopRemoteInputType_02, testing::ext::TestSize.Level1)
299 {
300     int32_t srcTsrcSeId = 1;
301     std::string deviceId = "";
302     int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInputType(srcTsrcSeId, deviceId,
303         static_cast<uint32_t>(DInputDeviceType::ALL));
304     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
305 }
306 
307 HWTEST_F(DistributedInputSourceTransTest, NotifyOriginPrepareResult01, testing::ext::TestSize.Level1)
308 {
309     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
310     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
311     int32_t sessionId = 2;
312     int32_t ret = DistributedInputSourceTransport::GetInstance().NotifyOriginPrepareResult(
313         sessionId, srcId, sinkId, DH_SUCCESS);
314     EXPECT_EQ(DH_SUCCESS, ret);
315 }
316 
317 HWTEST_F(DistributedInputSourceTransTest, NotifyOriginUnprepareResult01, testing::ext::TestSize.Level1)
318 {
319     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
320     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
321     int32_t sessionId = 2;
322     int32_t ret = DistributedInputSourceTransport::GetInstance().NotifyOriginUnprepareResult(
323         sessionId, srcId, sinkId, DH_SUCCESS);
324     EXPECT_EQ(DH_SUCCESS, ret);
325 }
326 
327 HWTEST_F(DistributedInputSourceTransTest, NotifyOriginStartDhidResult01, testing::ext::TestSize.Level1)
328 {
329     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
330     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
331     int32_t sessionId = 2;
332     std::string dhIds = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
333     int32_t ret = DistributedInputSourceTransport::GetInstance().NotifyOriginStartDhidResult(
334         sessionId, srcId, sinkId, DH_SUCCESS, dhIds);
335     EXPECT_EQ(DH_SUCCESS, ret);
336 }
337 
338 HWTEST_F(DistributedInputSourceTransTest, NotifyOriginStopDhidResult01, testing::ext::TestSize.Level1)
339 {
340     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
341     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
342     int32_t sessionId = 2;
343     std::string dhIds = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
344     int32_t ret = DistributedInputSourceTransport::GetInstance().NotifyOriginStopDhidResult(
345         sessionId, srcId, sinkId, DH_SUCCESS, dhIds);
346     EXPECT_EQ(DH_SUCCESS, ret);
347 }
348 
349 HWTEST_F(DistributedInputSourceTransTest, NotifyOriginStartTypeResult_01, testing::ext::TestSize.Level1)
350 {
351     int32_t srcTsrcSeId = 2;
352     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
353     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
354     int32_t ret = DistributedInputSourceTransport::GetInstance().NotifyOriginStartTypeResult(srcTsrcSeId, srcId,
355         sinkId, DH_SUCCESS, static_cast<uint32_t>(DInputDeviceType::ALL));
356     EXPECT_EQ(DH_SUCCESS, ret);
357 }
358 
359 HWTEST_F(DistributedInputSourceTransTest, NotifyOriginStopTypeResult_01, testing::ext::TestSize.Level1)
360 {
361     int32_t srcTsrcSeId = 2;
362     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
363     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
364     int32_t ret = DistributedInputSourceTransport::GetInstance().NotifyOriginStopTypeResult(srcTsrcSeId, srcId,
365         sinkId, DH_SUCCESS, static_cast<uint32_t>(DInputDeviceType::ALL));
366     EXPECT_EQ(DH_SUCCESS, ret);
367 }
368 
369 HWTEST_F(DistributedInputSourceTransTest, SendRelayPrepareRequest_01, testing::ext::TestSize.Level1)
370 {
371     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
372     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
373     DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(srcId, true);
374     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayPrepareRequest(srcId, sinkId);
375     EXPECT_EQ(DH_SUCCESS, ret);
376 }
377 
378 HWTEST_F(DistributedInputSourceTransTest, SendRelayPrepareRequest_02, testing::ext::TestSize.Level1)
379 {
380     std::string srcId = "";
381     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
382     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayPrepareRequest(srcId, sinkId);
383     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
384 }
385 
386 HWTEST_F(DistributedInputSourceTransTest, SendRelayUnprepareRequest_01, testing::ext::TestSize.Level1)
387 {
388     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
389     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
390     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayUnprepareRequest(srcId, sinkId);
391     EXPECT_EQ(DH_SUCCESS, ret);
392 }
393 
394 HWTEST_F(DistributedInputSourceTransTest, SendRelayUnprepareRequest_02, testing::ext::TestSize.Level1)
395 {
396     std::string srcId = "";
397     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
398     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayUnprepareRequest(srcId, sinkId);
399     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
400 }
401 
402 HWTEST_F(DistributedInputSourceTransTest, SendRelayStartDhidRequest_01, testing::ext::TestSize.Level1)
403 {
404     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
405     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
406     std::vector<std::string> dhids;
407     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
408     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStartDhidRequest(srcId, sinkId, dhids);
409     EXPECT_EQ(DH_SUCCESS, ret);
410 }
411 
412 HWTEST_F(DistributedInputSourceTransTest, SendRelayStartTypeRequest_01, testing::ext::TestSize.Level1)
413 {
414     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
415     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
416     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStartTypeRequest(srcId, sinkId,
417         static_cast<uint32_t>(DInputDeviceType::ALL));
418     EXPECT_EQ(DH_SUCCESS, ret);
419 }
420 
421 HWTEST_F(DistributedInputSourceTransTest, SendRelayStopDhidRequest_01, testing::ext::TestSize.Level1)
422 {
423     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
424     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
425     std::vector<std::string> dhids;
426     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
427     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStopDhidRequest(srcId, sinkId, dhids);
428     EXPECT_EQ(DH_SUCCESS, ret);
429 }
430 
431 HWTEST_F(DistributedInputSourceTransTest, SendRelayStopTypeRequest_01, testing::ext::TestSize.Level1)
432 {
433     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
434     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
435     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStopTypeRequest(srcId, sinkId,
436         static_cast<uint32_t>(DInputDeviceType::ALL));
437     EXPECT_EQ(DH_SUCCESS, ret);
438 }
439 
440 HWTEST_F(DistributedInputSourceTransTest, LatencyCount01, testing::ext::TestSize.Level1)
441 {
442     std::string deviceId = "deviceId";
443     int32_t ret = DistributedInputSourceTransport::GetInstance().LatencyCount(deviceId);
444     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_LATENCY_FAIL, ret);
445 }
446 
447 HWTEST_F(DistributedInputSourceTransTest, LatencyCount02, testing::ext::TestSize.Level1)
448 {
449     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
450     int32_t sessionId = 2;
451     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
452     int32_t ret = DistributedInputSourceTransport::GetInstance().LatencyCount(deviceId);
453     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
454     DistributedInputSourceTransport::GetInstance().StopLatencyThread();
455     EXPECT_EQ(DH_SUCCESS, ret);
456 }
457 
458 HWTEST_F(DistributedInputSourceTransTest, SendRelayStartDhidRequest_02, testing::ext::TestSize.Level1)
459 {
460     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
461     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
462     std::vector<std::string> dhids;
463     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
464     int32_t sessionId = -1;
465     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId;
466     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStartDhidRequest(srcId, sinkId, dhids);
467     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
468     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
469 }
470 
471 HWTEST_F(DistributedInputSourceTransTest, SendRelayStopDhidRequest_02, testing::ext::TestSize.Level1)
472 {
473     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
474     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
475     std::vector<std::string> dhids;
476     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
477     int32_t sessionId = -1;
478     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId;
479     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStopDhidRequest(srcId, sinkId, dhids);
480     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
481     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
482 }
483 
484 HWTEST_F(DistributedInputSourceTransTest, SendRelayStartTypeRequest_02, testing::ext::TestSize.Level1)
485 {
486     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
487     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
488     std::vector<std::string> dhids;
489     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
490     int32_t sessionId = -1;
491     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId;
492     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStartTypeRequest(srcId, sinkId,
493         static_cast<uint32_t>(DInputDeviceType::ALL));
494     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
495     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
496 }
497 
498 HWTEST_F(DistributedInputSourceTransTest, SendRelayStopTypeRequest_02, testing::ext::TestSize.Level1)
499 {
500     std::string srcId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
501     std::string sinkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
502     std::vector<std::string> dhids;
503     dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
504     int32_t sessionId = -1;
505     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId;
506     int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayStopTypeRequest(srcId, sinkId,
507         static_cast<uint32_t>(DInputDeviceType::ALL));
508     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
509     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
510 }
511 
512 HWTEST_F(DistributedInputSourceTransTest, NotifyResponsePrepareRemoteInput01, testing::ext::TestSize.Level1)
513 {
514     int32_t sessionId = 0;
515     nlohmann::json recMsg;
516     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
517     recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = false;
518     DistributedInputSourceTransport::GetInstance().NotifyResponsePrepareRemoteInput(sessionId, recMsg);
519     std::string message(MSG_MAX_SIZE + 1, 'a');
520     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
521     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
522 }
523 
524 HWTEST_F(DistributedInputSourceTransTest, NotifyResponsePrepareRemoteInput02, testing::ext::TestSize.Level1)
525 {
526     int32_t sessionId = 0;
527     nlohmann::json recMsg;
528     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
529     recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = "false";
530     DistributedInputSourceTransport::GetInstance().NotifyResponsePrepareRemoteInput(sessionId, recMsg);
531     std::string message(MSG_MAX_SIZE + 1, 'a');
532     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
533     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
534 }
535 
536 HWTEST_F(DistributedInputSourceTransTest, NotifyResponsePrepareRemoteInput03, testing::ext::TestSize.Level1)
537 {
538     int32_t sessionId = 0;
539     nlohmann::json recMsg;
540     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
541     recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = "false";
542     std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
543     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[remoteId] = sessionId;
544     DistributedInputSourceManager srcMgr(4810, false);
545     std::shared_ptr<DInputSourceListener> srcListener =
546         std::make_shared<DInputSourceListener>(&srcMgr);
547     DistributedInputSourceTransport::GetInstance().callback_ = srcListener;
548     DistributedInputSourceTransport::GetInstance().NotifyResponsePrepareRemoteInput(sessionId, recMsg);
549     std::string message(MSG_MAX_SIZE + 1, 'a');
550     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
551     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
552     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
553 }
554 
555 HWTEST_F(DistributedInputSourceTransTest, NotifyResponsePrepareRemoteInput04, testing::ext::TestSize.Level1)
556 {
557     int32_t sessionId = 0;
558     nlohmann::json recMsg;
559     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
560     recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = false;
561     DistributedInputSourceTransport::GetInstance().NotifyResponsePrepareRemoteInput(sessionId, recMsg);
562     std::string message(MSG_MAX_SIZE + 1, 'a');
563     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
564     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
565 }
566 
567 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseUnprepareRemoteInput01, testing::ext::TestSize.Level1)
568 {
569     int32_t sessionId = 0;
570     nlohmann::json recMsg;
571     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
572     DistributedInputSourceTransport::GetInstance().NotifyResponseUnprepareRemoteInput(sessionId, recMsg);
573 
574     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
575     DistributedInputSourceTransport::GetInstance().NotifyResponseUnprepareRemoteInput(sessionId, recMsg);
576     std::string message(MSG_MAX_SIZE + 1, 'a');
577     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
578     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
579 }
580 
581 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseStartRemoteInput01, testing::ext::TestSize.Level1)
582 {
583     int32_t sessionId = 0;
584     nlohmann::json recMsg;
585     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
586     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = "input_type";
587     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInput(sessionId, recMsg);
588 
589     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
590     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInput(sessionId, recMsg);
591 
592     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = 1;
593     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInput(sessionId, recMsg);
594     std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
595     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[remoteId] = sessionId;
596     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInput(sessionId, recMsg);
597     std::string message(MSG_MAX_SIZE + 1, 'a');
598     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
599     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
600     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
601 }
602 
603 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseStopRemoteInput01, testing::ext::TestSize.Level1)
604 {
605     int32_t sessionId = 0;
606     nlohmann::json recMsg;
607     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
608     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = "input_type";
609     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInput(sessionId, recMsg);
610 
611     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
612     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInput(sessionId, recMsg);
613 
614     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = 1;
615     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInput(sessionId, recMsg);
616     std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
617     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[remoteId] = sessionId;
618     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInput(sessionId, recMsg);
619     std::string message(MSG_MAX_SIZE + 1, 'a');
620     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
621     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
622     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
623 }
624 
625 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseStartRemoteInputDhid01, testing::ext::TestSize.Level1)
626 {
627     int32_t sessionId = 0;
628     nlohmann::json recMsg;
629     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
630     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 1;
631     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInputDhid(sessionId, recMsg);
632 
633     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
634     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInputDhid(sessionId, recMsg);
635 
636     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
637     DistributedInputSourceTransport::GetInstance().NotifyResponseStartRemoteInputDhid(sessionId, recMsg);
638     std::string message(MSG_MAX_SIZE + 1, 'a');
639     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
640     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
641 }
642 
643 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseStopRemoteInputDhid01, testing::ext::TestSize.Level1)
644 {
645     int32_t sessionId = 0;
646     nlohmann::json recMsg;
647     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
648     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 1;
649     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInputDhid(sessionId, recMsg);
650 
651     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
652     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInputDhid(sessionId, recMsg);
653 
654     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
655     DistributedInputSourceTransport::GetInstance().NotifyResponseStopRemoteInputDhid(sessionId, recMsg);
656     std::string message(MSG_MAX_SIZE + 1, 'a');
657     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
658     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
659 }
660 
661 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseKeyState01, testing::ext::TestSize.Level1)
662 {
663     int32_t sessionId = 0;
664     nlohmann::json recMsg;
665     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID] = 1;
666     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_TYPE] = "false";
667     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_CODE] = "false";
668     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_VALUE] = "false";
669     DistributedInputSourceTransport::GetInstance().NotifyResponseKeyState(sessionId, recMsg);
670 
671     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID] = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
672     DistributedInputSourceTransport::GetInstance().NotifyResponseKeyState(sessionId, recMsg);
673 
674     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_TYPE] = 1;
675     DistributedInputSourceTransport::GetInstance().NotifyResponseKeyState(sessionId, recMsg);
676 
677     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_CODE] = 1;
678 
679     DistributedInputSourceTransport::GetInstance().NotifyResponseKeyState(sessionId, recMsg);
680 
681     recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_VALUE] = 1;
682     DistributedInputSourceTransport::GetInstance().NotifyResponseKeyState(sessionId, recMsg);
683     std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
684     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[remoteId] = sessionId;
685     DistributedInputSourceTransport::GetInstance().NotifyResponseKeyState(sessionId, recMsg);
686     std::string message(MSG_MAX_SIZE + 1, 'a');
687     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
688     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
689 }
690 
691 HWTEST_F(DistributedInputSourceTransTest, NotifyReceivedEventRemoteInput01, testing::ext::TestSize.Level1)
692 {
693     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
694     int32_t sessionId = 1;
695     nlohmann::json recMsg;
696     int32_t inputData = 100;
697     recMsg[DINPUT_SOFTBUS_KEY_INPUT_DATA] = inputData;
698     DistributedInputSourceTransport::GetInstance().NotifyReceivedEventRemoteInput(sessionId, recMsg);
699     std::string inputDatas = "inputDatas_test";
700     recMsg[DINPUT_SOFTBUS_KEY_INPUT_DATA] = inputDatas;
701     DistributedInputSourceTransport::GetInstance().NotifyReceivedEventRemoteInput(sessionId, recMsg);
702     DistributedInputSourceTransport::GetInstance().CalculateLatency(sessionId, recMsg);
703     std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
704     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[remoteId] = sessionId;
705     DistributedInputSourceTransport::GetInstance().NotifyReceivedEventRemoteInput(sessionId, recMsg);
706     DistributedInputSourceTransport::GetInstance().CalculateLatency(sessionId, recMsg);
707     std::string message(MSG_MAX_SIZE + 1, 'a');
708     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
709     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
710 }
711 
712 HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayUnprepare01, testing::ext::TestSize.Level1)
713 {
714     int32_t sessionId = 1;
715     int32_t devId = 100;
716     nlohmann::json recMsg;
717     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = devId;
718     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayPrepare(sessionId, recMsg);
719     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayUnprepare(sessionId, recMsg);
720     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
721     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
722     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayUnprepare(sessionId, recMsg);
723     std::string message(MSG_MAX_SIZE + 1, 'a');
724     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
725     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
726 }
727 
728 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayPrepareRemoteInput01, testing::ext::TestSize.Level1)
729 {
730     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
731     int32_t sessionId = 1;
732     nlohmann::json recMsg;
733     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
734     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "sessionId";
735     recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = 1;
736     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayPrepareRemoteInput(sessionId, recMsg);
737     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
738     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayPrepareRemoteInput(sessionId, recMsg);
739     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
740     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayPrepareRemoteInput(sessionId, recMsg);
741     recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = "white_list_test";
742     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayPrepareRemoteInput(sessionId, recMsg);
743     std::string message(MSG_MAX_SIZE + 1, 'a');
744     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
745     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
746 }
747 
748 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayUnprepareRemoteInput01, testing::ext::TestSize.Level1)
749 {
750     int32_t sessionId = 1;
751     std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
752     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[remoteId] = sessionId;
753     nlohmann::json recMsg;
754     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
755     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "sessionId";
756     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayUnprepareRemoteInput(sessionId, recMsg);
757     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
758     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayUnprepareRemoteInput(sessionId, recMsg);
759     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
760     sessionId = 2;
761     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayUnprepareRemoteInput(sessionId, recMsg);
762     std::string message(MSG_MAX_SIZE + 1, 'a');
763     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
764     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
765     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
766 }
767 
768 HWTEST_F(DistributedInputSourceTransTest, ReceiveRelayPrepareResult01, testing::ext::TestSize.Level1)
769 {
770     int32_t sessionId = 1;
771     nlohmann::json recMsg;
772     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = 100;
773     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = 100;
774     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "resp_value_test";
775     DistributedInputSourceTransport::GetInstance().ReceiveRelayPrepareResult(sessionId, recMsg);
776     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = "src_devid_test";
777     DistributedInputSourceTransport::GetInstance().ReceiveRelayPrepareResult(sessionId, recMsg);
778     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = "sink_devid_test";
779     DistributedInputSourceTransport::GetInstance().ReceiveRelayPrepareResult(sessionId, recMsg);
780     std::string message(MSG_MAX_SIZE + 1, 'a');
781     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
782     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
783 }
784 
785 HWTEST_F(DistributedInputSourceTransTest, ReceiveRelayUnprepareResult01, testing::ext::TestSize.Level1)
786 {
787     int32_t sessionId = 1;
788     nlohmann::json recMsg;
789     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = 100;
790     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = 100;
791     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "resp_value_test";
792     DistributedInputSourceTransport::GetInstance().ReceiveRelayUnprepareResult(sessionId, recMsg);
793     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = "src_devid_test";
794     DistributedInputSourceTransport::GetInstance().ReceiveRelayUnprepareResult(sessionId, recMsg);
795     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = "sink_devid_test";
796     DistributedInputSourceTransport::GetInstance().ReceiveRelayUnprepareResult(sessionId, recMsg);
797     std::string message(MSG_MAX_SIZE + 1, 'a');
798     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
799     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
800 }
801 
802 HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayStartDhid01, testing::ext::TestSize.Level1)
803 {
804     int32_t sessionId = 1;
805     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
806     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
807     nlohmann::json recMsg;
808     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = 100;
809     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 200;
810     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartDhid(sessionId, recMsg);
811     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
812     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartDhid(sessionId, recMsg);
813     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = "vector_dhId_test";
814     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartDhid(sessionId, recMsg);
815     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
816     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartDhid(sessionId, recMsg);
817     std::string message(MSG_MAX_SIZE + 1, 'a');
818     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
819     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
820 }
821 
822 HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayStopDhid01, testing::ext::TestSize.Level1)
823 {
824     int32_t sessionId = 1;
825     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
826     nlohmann::json recMsg;
827     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = 100;
828     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 200;
829     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopDhid(sessionId, recMsg);
830     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
831     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopDhid(sessionId, recMsg);
832     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = "vector_dhId_test";
833     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopDhid(sessionId, recMsg);
834     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
835     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopDhid(sessionId, recMsg);
836     std::string message(MSG_MAX_SIZE + 1, 'a');
837     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
838     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
839 }
840 
841 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayStartDhidRemoteInput01, testing::ext::TestSize.Level1)
842 {
843     int32_t sessionId = 1;
844     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
845     nlohmann::json recMsg;
846     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
847     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "1";
848     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 1;
849     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartDhidRemoteInput(sessionId, recMsg);
850     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
851     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartDhidRemoteInput(sessionId, recMsg);
852     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
853     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartDhidRemoteInput(sessionId, recMsg);
854     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = "vector_dhId_test";
855     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartDhidRemoteInput(sessionId, recMsg);
856     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
857     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartDhidRemoteInput(sessionId, recMsg);
858     std::string message(MSG_MAX_SIZE + 1, 'a');
859     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
860     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
861 }
862 
863 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayStopDhidRemoteInput01, testing::ext::TestSize.Level1)
864 {
865     int32_t sessionId = 1;
866     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
867     nlohmann::json recMsg;
868     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
869     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "1";
870     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 1;
871     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopDhidRemoteInput(sessionId, recMsg);
872     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
873     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopDhidRemoteInput(sessionId, recMsg);
874     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
875     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopDhidRemoteInput(sessionId, recMsg);
876     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = "vector_dhId_test";
877     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopDhidRemoteInput(sessionId, recMsg);
878     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
879     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopDhidRemoteInput(sessionId, recMsg);
880     std::string message(MSG_MAX_SIZE + 1, 'a');
881     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
882     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
883 }
884 
885 HWTEST_F(DistributedInputSourceTransTest, ReceiveRelayStartDhidResult01, testing::ext::TestSize.Level1)
886 {
887     int32_t sessionId = 1;
888     nlohmann::json recMsg;
889     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = 100;
890     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = 200;
891     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "value";
892     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 300;
893     DistributedInputSourceTransport::GetInstance().ReceiveRelayStartDhidResult(sessionId, recMsg);
894     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = "src_devId_test";
895     DistributedInputSourceTransport::GetInstance().ReceiveRelayStartDhidResult(sessionId, recMsg);
896     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = "sink_devId_test";
897     DistributedInputSourceTransport::GetInstance().ReceiveRelayStartDhidResult(sessionId, recMsg);
898     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = 1;
899     DistributedInputSourceTransport::GetInstance().ReceiveRelayStartDhidResult(sessionId, recMsg);
900     std::string message(MSG_MAX_SIZE + 1, 'a');
901     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
902     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
903 }
904 
905 HWTEST_F(DistributedInputSourceTransTest, ReceiveRelayStopDhidResult01, testing::ext::TestSize.Level1)
906 {
907     int32_t sessionId = 1;
908     nlohmann::json recMsg;
909     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = 100;
910     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = 200;
911     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "value";
912     recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = 300;
913     DistributedInputSourceTransport::GetInstance().ReceiveRelayStopDhidResult(sessionId, recMsg);
914     recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] ="src_devId_test";
915     DistributedInputSourceTransport::GetInstance().ReceiveRelayStopDhidResult(sessionId, recMsg);
916     recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = "sink_devId_test";
917     DistributedInputSourceTransport::GetInstance().ReceiveRelayStopDhidResult(sessionId, recMsg);
918     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = 1;
919     DistributedInputSourceTransport::GetInstance().ReceiveRelayStopDhidResult(sessionId, recMsg);
920     std::string message(MSG_MAX_SIZE + 1, 'a');
921     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
922     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
923 }
924 
925 HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayStartType01, testing::ext::TestSize.Level1)
926 {
927     int32_t sessionId = 1;
928     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
929     nlohmann::json recMsg;
930     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = 1;
931     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = "input_type_test";
932     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartType(sessionId, recMsg);
933     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
934     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartType(sessionId, recMsg);
935     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = 1;
936     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartType(sessionId, recMsg);
937     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
938     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStartType(sessionId, recMsg);
939     std::string message(MSG_MAX_SIZE + 1, 'a');
940     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
941     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
942 }
943 
944 HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayStopType01, testing::ext::TestSize.Level1)
945 {
946     int32_t sessionId = 1;
947     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
948     nlohmann::json recMsg;
949     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = 1;
950     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = "input_type_test";
951     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopType(sessionId, recMsg);
952     recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
953     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopType(sessionId, recMsg);
954     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = 1;
955     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopType(sessionId, recMsg);
956     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
957     DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayStopType(sessionId, recMsg);
958     std::string message(MSG_MAX_SIZE + 1, 'a');
959     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
960     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
961 }
962 
963 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayStartTypeRemoteInput01, testing::ext::TestSize.Level1)
964 {
965     int32_t sessionId = 1;
966     nlohmann::json recMsg;
967     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
968     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "1";
969     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = "input_type_test";
970     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartTypeRemoteInput(sessionId, recMsg);
971     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
972     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartTypeRemoteInput(sessionId, recMsg);
973     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
974     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartTypeRemoteInput(sessionId, recMsg);
975     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = 1;
976     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartTypeRemoteInput(sessionId, recMsg);
977     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear();
978     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStartTypeRemoteInput(sessionId, recMsg);
979     std::string message(MSG_MAX_SIZE + 1, 'a');
980     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
981     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
982 }
983 
984 HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayStopTypeRemoteInput01, testing::ext::TestSize.Level1)
985 {
986     int32_t sessionId = 1;
987     std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
988     nlohmann::json recMsg;
989     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
990     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "1";
991     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = "input_type_test";
992     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopTypeRemoteInput(sessionId, recMsg);
993     recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
994     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopTypeRemoteInput(sessionId, recMsg);
995     recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
996     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopTypeRemoteInput(sessionId, recMsg);
997     recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = 1;
998     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopTypeRemoteInput(sessionId, recMsg);
999     DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[deviceId] = sessionId;
1000     DistributedInputSourceTransport::GetInstance().NotifyResponseRelayStopTypeRemoteInput(sessionId, recMsg);
1001     std::string message(MSG_MAX_SIZE + 1, 'a');
1002     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
1003     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
1004 }
1005 
1006 HWTEST_F(DistributedInputSourceTransTest, HandleData01, testing::ext::TestSize.Level1)
1007 {
1008     int32_t sessionId = 1;
1009     nlohmann::json recMsg;
1010     recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_PREPARE;
1011     DistributedInputSourceTransport::GetInstance().HandleData(sessionId, recMsg.dump());
1012     recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ONPREPARE;
1013     DistributedInputSourceTransport::GetInstance().HandleData(sessionId, recMsg.dump());
1014     DistributedInputSourceTransport::GetInstance().callback_ = nullptr;
1015     DistributedInputSourceTransport::GetInstance().HandleData(sessionId, recMsg.dump());
1016     std::string message(MSG_MAX_SIZE + 1, 'a');
1017     int32_t ret = DistributedInputSourceTransport::GetInstance().SendMessage(sessionId, message);
1018     EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE, ret);
1019 }
1020 } // namespace DistributedInput
1021 } // namespace DistributedHardware
1022 } // namespace OHOS
1023