• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 "wfd_sink_scene_test.h"
17 #include "common/sharing_log.h"
18 #include "wfd_session_def.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 using namespace OHOS::Sharing;
23 
24 namespace OHOS {
25 namespace Sharing {
26 
SetUpTestCase(void)27 void WfdSinkSceneTest::SetUpTestCase(void)
28 {
29     sinkScene_ = std::make_shared<MockWfdSinkScene>();
30 }
31 
TearDownTestCase(void)32 void WfdSinkSceneTest::TearDownTestCase(void)
33 {
34     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroup()).Times(1)
35         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
36     sinkScene_ = nullptr;
37 }
38 
SetUp(void)39 void WfdSinkSceneTest::SetUp(void)
40 {
41 }
42 
TearDown(void)43 void WfdSinkSceneTest::TearDown(void)
44 {
45 }
46 
RestoreConnMap(void)47 void WfdSinkSceneTest::RestoreConnMap(void)
48 {
49     ConnectionInfo connectionInfo;
50     sinkScene_->devConnectionMap_.clear();
51     connectionInfo.contextId = 1;
52     connectionInfo.agentId = 1;
53     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
54     std::shared_ptr<ConnectionInfo> connectionInfoPtr = std::make_shared<ConnectionInfo>(connectionInfo);
55     sinkScene_->devConnectionMap_.emplace(connectionInfo.mac, connectionInfoPtr);
56 }
57 
RestoreSurfaceMap(void)58 void WfdSinkSceneTest::RestoreSurfaceMap(void)
59 {
60     DevSurfaceItem surface;
61     surface.contextId = 1;
62     surface.agentId = 1;
63     surface.deviceId = "AA:BB:CC:DD:EE:FF";
64     auto surfaceItemPtr = std::make_shared<DevSurfaceItem>(surface);
65     sinkScene_->devSurfaceItemMap_.emplace(0, surfaceItemPtr);
66 }
67 
68 HWTEST_F(WfdSinkSceneTest, Initialize_001, TestSize.Level1)
69 {
70     ASSERT_TRUE(sinkScene_ != nullptr);
71 
72     sinkScene_->Initialize();
73     sinkScene_->MockInitialize();
74 }
75 
76 HWTEST_F(WfdSinkSceneTest, OnP2pStateChanged_001, TestSize.Level1)
77 {
78     ASSERT_TRUE(sinkScene_ != nullptr);
79     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
80 
81     sinkScene_->wfdP2pCallback_->OnP2pStateChanged(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_NONE));
82 }
83 
84 HWTEST_F(WfdSinkSceneTest, OnP2pStateChanged_002, TestSize.Level1)
85 {
86     ASSERT_TRUE(sinkScene_ != nullptr);
87     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
88 
89     sinkScene_->wfdP2pCallback_->OnP2pStateChanged(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_IDLE));
90 }
91 
92 HWTEST_F(WfdSinkSceneTest, OnP2pStateChanged_003, TestSize.Level1)
93 {
94     ASSERT_TRUE(sinkScene_ != nullptr);
95     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
96 
97     sinkScene_->wfdP2pCallback_->OnP2pStateChanged(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_STARTING));
98 }
99 
100 HWTEST_F(WfdSinkSceneTest, OnP2pStateChanged_004, TestSize.Level1)
101 {
102     ASSERT_TRUE(sinkScene_ != nullptr);
103     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
104 
105     sinkScene_->isSinkRunning_ = true;
106     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroup())
107         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
108     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), SetP2pWfdInfo(_))
109         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
110     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pGroups(_))
111         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
112     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pLocalDevice(_))
113         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
114     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), CreateGroup(_))
115         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
116 
117     sinkScene_->wfdP2pCallback_->OnP2pStateChanged(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_STARTED));
118 }
119 
120 HWTEST_F(WfdSinkSceneTest, OnP2pStateChanged_005, TestSize.Level1)
121 {
122     ASSERT_TRUE(sinkScene_ != nullptr);
123     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
124 
125     sinkScene_->wfdP2pCallback_->OnP2pStateChanged(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_CLOSING));
126 }
127 
128 HWTEST_F(WfdSinkSceneTest, OnP2pStateChanged_006, TestSize.Level1)
129 {
130     ASSERT_TRUE(sinkScene_ != nullptr);
131     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
132 
133     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ForwardEvent(_, _, _, _))
134         .WillOnce(Return(0));
135     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
136         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
137     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
138         .WillOnce(Return(0));
139     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), StopDiscoverDevices())
140         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
141     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroup())
142         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
143     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
144         .WillOnce(Return(0));
145 
146     RestoreConnMap();
147     sinkScene_->wfdP2pCallback_->OnP2pStateChanged(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_CLOSED));
148 }
149 
150 HWTEST_F(WfdSinkSceneTest, HandleStart_001, TestSize.Level1)
151 {
152     ASSERT_TRUE(sinkScene_ != nullptr);
153 
154     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), GetP2pEnableStatus(_)).Times(1)
155         .WillOnce(DoAll(SetArgReferee<0>(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_NONE)),
156         Return(Wifi::ErrCode::WIFI_OPT_SUCCESS)));
157     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
158         .WillOnce(Return(0));
159 
160     auto msg = std::make_shared<WfdSinkStartReq>();
161     auto reply = std::make_shared<WfdCommonRsp>();
162     int32_t ret = sinkScene_->HandleStart(msg, reply);
163     EXPECT_EQ(ret, -1);
164 }
165 
166 HWTEST_F(WfdSinkSceneTest, HandleStart_002, TestSize.Level1)
167 {
168     ASSERT_TRUE(sinkScene_ != nullptr);
169 
170     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), GetP2pEnableStatus(_)).Times(1)
171         .WillOnce(DoAll(SetArgReferee<0>(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_IDLE)),
172         Return(Wifi::ErrCode::WIFI_OPT_SUCCESS)));
173     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
174         .WillOnce(Return(0));
175 
176     auto msg = std::make_shared<WfdSinkStartReq>();
177     auto reply = std::make_shared<WfdCommonRsp>();
178     int32_t ret = sinkScene_->HandleStart(msg, reply);
179     EXPECT_EQ(ret, -1);
180 }
181 
182 HWTEST_F(WfdSinkSceneTest, HandleStart_003, TestSize.Level1)
183 {
184     ASSERT_TRUE(sinkScene_ != nullptr);
185 
186     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), GetP2pEnableStatus(_)).Times(1)
187         .WillOnce(DoAll(SetArgReferee<0>(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_STARTING)),
188         Return(Wifi::ErrCode::WIFI_OPT_SUCCESS)));
189     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
190         .WillOnce(Return(0));
191 
192     auto msg = std::make_shared<WfdSinkStartReq>();
193     auto reply = std::make_shared<WfdCommonRsp>();
194     int32_t ret = sinkScene_->HandleStart(msg, reply);
195     EXPECT_EQ(ret, -1);
196 }
197 
198 HWTEST_F(WfdSinkSceneTest, HandleStart_004, TestSize.Level1)
199 {
200     ASSERT_TRUE(sinkScene_ != nullptr);
201 
202     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), GetP2pEnableStatus(_)).Times(1)
203         .WillOnce(DoAll(SetArgReferee<0>(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_CLOSING)),
204         Return(Wifi::ErrCode::WIFI_OPT_SUCCESS)));
205     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
206         .WillOnce(Return(0));
207 
208     auto msg = std::make_shared<WfdSinkStartReq>();
209     auto reply = std::make_shared<WfdCommonRsp>();
210     int32_t ret = sinkScene_->HandleStart(msg, reply);
211     EXPECT_EQ(ret, -1);
212 }
213 
214 HWTEST_F(WfdSinkSceneTest, HandleStart_005, TestSize.Level1)
215 {
216     ASSERT_TRUE(sinkScene_ != nullptr);
217 
218     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), GetP2pEnableStatus(_)).Times(1)
219         .WillOnce(DoAll(SetArgReferee<0>(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_STARTED)),
220         Return(Wifi::ErrCode::WIFI_OPT_SUCCESS)));
221     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroup())
222         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
223     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), SetP2pWfdInfo(_))
224         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
225     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pGroups(_))
226         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
227     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pLocalDevice(_))
228         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
229     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), CreateGroup(_))
230         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
231 
232     auto msg = std::make_shared<WfdSinkStartReq>();
233     auto reply = std::make_shared<WfdCommonRsp>();
234     int32_t ret = sinkScene_->HandleStart(msg, reply);
235     EXPECT_EQ(ret, 0);
236 }
237 
238 HWTEST_F(WfdSinkSceneTest, HandleStart_006, TestSize.Level1)
239 {
240     ASSERT_TRUE(sinkScene_ != nullptr);
241 
242     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), GetP2pEnableStatus(_)).Times(1)
243         .WillOnce(DoAll(SetArgReferee<0>(static_cast<int32_t>(Wifi::P2pState::P2P_STATE_CLOSED)),
244         Return(Wifi::ErrCode::WIFI_OPT_SUCCESS)));
245     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), EnableP2p())
246         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
247 
248     auto msg = std::make_shared<WfdSinkStartReq>();
249     auto reply = std::make_shared<WfdCommonRsp>();
250     sinkScene_->isSinkRunning_ = false;
251     int32_t ret = sinkScene_->HandleStart(msg, reply);
252     EXPECT_EQ(ret, 0);
253 }
254 
255 HWTEST_F(WfdSinkSceneTest, HandleStop_001, TestSize.Level1)
256 {
257     ASSERT_TRUE(sinkScene_ != nullptr);
258 
259     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ForwardEvent(_, _, _, _))
260         .WillOnce(Return(0));
261     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
262         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
263     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
264         .WillOnce(Return(0));
265     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), StopDiscoverDevices())
266         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
267     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroup())
268         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
269 
270     auto msg = std::make_shared<WfdSinkStopReq>();
271     auto reply = std::make_shared<WfdCommonRsp>();
272     RestoreConnMap();
273     int32_t ret = sinkScene_->HandleStop(msg, reply);
274     EXPECT_EQ(ret, 0);
275 }
276 
277 HWTEST_F(WfdSinkSceneTest, OnP2pPeersChanged_001, TestSize.Level1)
278 {
279     ASSERT_TRUE(sinkScene_ != nullptr);
280     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
281 
282     std::vector<Wifi::WifiP2pDevice> devices;
283     Wifi::WifiP2pDevice device;
284     device.SetP2pDeviceStatus(Wifi::P2pDeviceStatus::PDS_UNAVAILABLE);
285     devices.emplace_back(device);
286     sinkScene_->wfdP2pCallback_->OnP2pPeersChanged(devices);
287 }
288 
289 HWTEST_F(WfdSinkSceneTest, OnP2pPeersChanged_002, TestSize.Level1)
290 {
291     ASSERT_TRUE(sinkScene_ != nullptr);
292     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
293 
294     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
295         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
296     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
297         .WillOnce(Return(0));
298     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ForwardEvent(_, _, _, _))
299         .WillOnce(Return(0));
300     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
301         .WillOnce(Return(0));
302 
303     std::vector<Wifi::WifiP2pDevice> devices;
304     Wifi::WifiP2pDevice device;
305     device.SetDeviceAddress("AA:BB:CC:DD:EE:FF");
306     device.SetP2pDeviceStatus(Wifi::P2pDeviceStatus::PDS_AVAILABLE);
307     devices.emplace_back(device);
308     RestoreConnMap();
309     sinkScene_->wfdP2pCallback_->OnP2pPeersChanged(devices);
310 }
311 
312 HWTEST_F(WfdSinkSceneTest, OnP2pGcJoinGroup_001, TestSize.Level1)
313 {
314     ASSERT_TRUE(sinkScene_ != nullptr);
315     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
316 
317     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pDevices(_))
318         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_FAILED));
319 
320     OHOS::Wifi::GcInfo info;
321     sinkScene_->wfdP2pCallback_->OnP2pGcJoinGroup(info);
322 }
323 
324 HWTEST_F(WfdSinkSceneTest, OnP2pGcJoinGroup_002, TestSize.Level1)
325 {
326     ASSERT_TRUE(sinkScene_ != nullptr);
327     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
328 
329     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pDevices(_))
330         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
331     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
332         .WillOnce(Return(0));
333 
334     OHOS::Wifi::GcInfo info;
335     info.ip = "";
336     sinkScene_->wfdP2pCallback_->OnP2pGcJoinGroup(info);
337 }
338 
339 HWTEST_F(WfdSinkSceneTest, OnP2pGcJoinGroup_003, TestSize.Level1)
340 {
341     ASSERT_TRUE(sinkScene_ != nullptr);
342     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
343 
344     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), QueryP2pDevices(_))
345         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
346 
347     OHOS::Wifi::GcInfo info;
348     info.ip = "AA:BB:CC:DD:EE:FF";
349     sinkScene_->wfdP2pCallback_->OnP2pGcJoinGroup(info);
350 }
351 
352 HWTEST_F(WfdSinkSceneTest, OnP2pGcJoinGroup_004, TestSize.Level1)
353 {
354     ASSERT_TRUE(sinkScene_ != nullptr);
355     ASSERT_TRUE(sinkScene_->wfdP2pCallback_ != nullptr);
356 }
357 
358 HWTEST_F(WfdSinkSceneTest, OnP2pPeerConnected_001, TestSize.Level1)
359 {
360     ASSERT_TRUE(sinkScene_ != nullptr);
361 
362     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
363         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
364     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
365         .WillOnce(Return(0));
366 
367     ConnectionInfo connectionInfo;
368     sinkScene_->devConnectionMap_.clear();
369     connectionInfo.mac = "AA:BB:CC:DD:EE:F1";
370     sinkScene_->devConnectionMap_.emplace(connectionInfo.mac, std::make_shared<ConnectionInfo>(connectionInfo));
371     connectionInfo.mac = "AA:BB:CC:DD:EE:F2";
372     sinkScene_->devConnectionMap_.emplace(connectionInfo.mac, std::make_shared<ConnectionInfo>(connectionInfo));
373     connectionInfo.mac = "AA:BB:CC:DD:EE:F3";
374     sinkScene_->devConnectionMap_.emplace(connectionInfo.mac, std::make_shared<ConnectionInfo>(connectionInfo));
375     connectionInfo.mac = "AA:BB:CC:DD:EE:F4";
376     sinkScene_->devConnectionMap_.emplace(connectionInfo.mac, std::make_shared<ConnectionInfo>(connectionInfo));
377     sinkScene_->isSinkRunning_ = true;
378     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
379     sinkScene_->OnP2pPeerConnected(connectionInfo);
380 }
381 
382 HWTEST_F(WfdSinkSceneTest, OnP2pPeerConnected_002, TestSize.Level1)
383 {
384     ASSERT_TRUE(sinkScene_ != nullptr);
385 
386     ConnectionInfo connectionInfo;
387     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
388     sinkScene_->isSinkRunning_ = true;
389     RestoreConnMap();
390     sinkScene_->OnP2pPeerConnected(connectionInfo);
391 }
392 
393 HWTEST_F(WfdSinkSceneTest, OnP2pPeerConnected_003, TestSize.Level1)
394 {
395     ASSERT_TRUE(sinkScene_ != nullptr);
396 
397     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), CreateAgent(_, _, _, _))
398         .WillOnce(DoAll(SetArgReferee<0>(INVALID_ID), SetArgReferee<1>(INVALID_ID), Return(0)));
399     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
400         .WillOnce(Return(0));
401 
402     ConnectionInfo connectionInfo;
403     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
404     sinkScene_->isSinkRunning_ = true;
405     sinkScene_->devConnectionMap_.clear();
406     sinkScene_->OnP2pPeerConnected(connectionInfo);
407 }
408 
409 HWTEST_F(WfdSinkSceneTest, OnP2pPeerConnected_004, TestSize.Level1)
410 {
411     ASSERT_TRUE(sinkScene_ != nullptr);
412 
413     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), CreateAgent(_, _, _, _))
414         .WillOnce(DoAll(SetArgReferee<0>(1), SetArgReferee<1>(1), Return(0)));
415 
416     ConnectionInfo connectionInfo;
417     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
418     sinkScene_->isSinkRunning_ = true;
419     sinkScene_->devConnectionMap_.clear();
420     sinkScene_->OnP2pPeerConnected(connectionInfo);
421 }
422 
423 HWTEST_F(WfdSinkSceneTest, OnP2pPeerDisconnected_001, TestSize.Level1)
424 {
425     ASSERT_TRUE(sinkScene_ != nullptr);
426 
427     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
428         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
429     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
430         .WillOnce(Return(0));
431     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ForwardEvent(_, _, _, _))
432         .WillOnce(Return(0));
433     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
434         .WillOnce(Return(0));
435 
436     RestoreConnMap();
437     ConnectionInfo connectionInfo;
438     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
439     sinkScene_->OnP2pPeerDisconnected(connectionInfo);
440 }
441 
442 HWTEST_F(WfdSinkSceneTest, OnP2pPeerDisconnected_002, TestSize.Level1)
443 {
444     ASSERT_TRUE(sinkScene_ != nullptr);
445 
446     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
447         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
448     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
449         .WillOnce(Return(0));
450     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
451         .WillOnce(Return(0));
452 
453     RestoreConnMap();
454     std::string mac = "AA:BB:CC:DD:EE:FF";
455     sinkScene_->OnP2pPeerDisconnected(mac);
456 }
457 
458 HWTEST_F(WfdSinkSceneTest, HandleAppendSurface_001, TestSize.Level1)
459 {
460     ASSERT_TRUE(sinkScene_ != nullptr);
461 
462     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
463         .WillOnce(Return(0));
464 
465 
466     RestoreConnMap();
467     auto msg = std::make_shared<WfdAppendSurfaceReq>();
468     auto reply = std::make_shared<WfdCommonRsp>();
469     msg->deviceId = "";
470     int32_t ret = sinkScene_->HandleAppendSurface(msg, reply);
471     EXPECT_EQ(ret, -1);
472 }
473 
474 HWTEST_F(WfdSinkSceneTest, HandleAppendSurface_002, TestSize.Level1)
475 {
476     ASSERT_TRUE(sinkScene_ != nullptr);
477 
478     RestoreConnMap();
479     auto msg = std::make_shared<WfdAppendSurfaceReq>();
480     auto reply = std::make_shared<WfdCommonRsp>();
481     msg->deviceId = "AA:BB:CC:DD:EE:FF";
482     int32_t ret = sinkScene_->HandleAppendSurface(msg, reply);
483     EXPECT_EQ(ret, -1);
484 }
485 
486 HWTEST_F(WfdSinkSceneTest, HandleRemoveSurface_001, TestSize.Level1)
487 {
488     ASSERT_TRUE(sinkScene_ != nullptr);
489 
490     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
491         .WillOnce(Return(0));
492 
493     RestoreConnMap();
494     auto msg = std::make_shared<WfdRemoveSurfaceReq>();
495     auto reply = std::make_shared<WfdCommonRsp>();
496     msg->deviceId = "";
497     int32_t ret = sinkScene_->HandleRemoveSurface(msg, reply);
498     EXPECT_EQ(ret, -1);
499 }
500 
501 HWTEST_F(WfdSinkSceneTest, HandleRemoveSurface_002, TestSize.Level1)
502 {
503     ASSERT_TRUE(sinkScene_ != nullptr);
504 
505     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
506         .WillOnce(Return(0));
507 
508     RestoreConnMap();
509     auto msg = std::make_shared<WfdRemoveSurfaceReq>();
510     auto reply = std::make_shared<WfdCommonRsp>();
511     msg->deviceId = "AA:BB:CC:DD:EE:FF";
512     int32_t ret = sinkScene_->HandleRemoveSurface(msg, reply);
513     EXPECT_EQ(ret, -1);
514 }
515 
516 HWTEST_F(WfdSinkSceneTest, HandleSetMediaFormat_001, TestSize.Level1)
517 {
518     ASSERT_TRUE(sinkScene_ != nullptr);
519 
520     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
521         .WillOnce(Return(0));
522 
523     RestoreConnMap();
524     auto msg = std::make_shared<SetMediaFormatReq>();
525     auto reply = std::make_shared<WfdCommonRsp>();
526     msg->deviceId = "";
527     int32_t ret = sinkScene_->HandleSetMediaFormat(msg, reply);
528     EXPECT_EQ(ret, -1);
529 }
530 
531 HWTEST_F(WfdSinkSceneTest, HandleSetMediaFormat_002, TestSize.Level1)
532 {
533     ASSERT_TRUE(sinkScene_ != nullptr);
534 
535     RestoreConnMap();
536     auto msg = std::make_shared<SetMediaFormatReq>();
537     auto reply = std::make_shared<WfdCommonRsp>();
538     msg->deviceId = "AA:BB:CC:DD:EE:FF";
539     int32_t ret = sinkScene_->HandleSetMediaFormat(msg, reply);
540     EXPECT_EQ(ret, 0);
541 }
542 
543 HWTEST_F(WfdSinkSceneTest, HandleSetSceneType_001, TestSize.Level1)
544 {
545     ASSERT_TRUE(sinkScene_ != nullptr);
546 
547     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
548         .WillOnce(Return(0));
549 
550     RestoreConnMap();
551     auto msg = std::make_shared<SetSceneTypeReq>();
552     auto reply = std::make_shared<WfdCommonRsp>();
553     msg->deviceId = "";
554     int32_t ret = sinkScene_->HandleSetSceneType(msg, reply);
555     EXPECT_EQ(ret, -1);
556 }
557 
558 HWTEST_F(WfdSinkSceneTest, HandleSetSceneType_002, TestSize.Level1)
559 {
560     ASSERT_TRUE(sinkScene_ != nullptr);
561 
562     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
563         .WillOnce(Return(0));
564 
565     RestoreConnMap();
566     auto msg = std::make_shared<SetSceneTypeReq>();
567     auto reply = std::make_shared<WfdCommonRsp>();
568     msg->deviceId = "AA:BB:CC:DD:EE:FF";
569     int32_t ret = sinkScene_->HandleSetSceneType(msg, reply);
570     EXPECT_EQ(ret, -1);
571 }
572 
573 HWTEST_F(WfdSinkSceneTest, HandlePlay_001, TestSize.Level1)
574 {
575     ASSERT_TRUE(sinkScene_ != nullptr);
576 
577     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
578         .WillOnce(Return(0));
579 
580     RestoreConnMap();
581     auto msg = std::make_shared<WfdPlayReq>();
582     auto reply = std::make_shared<WfdCommonRsp>();
583     msg->deviceId = "";
584     int32_t ret = sinkScene_->HandlePlay(msg, reply);
585     EXPECT_EQ(ret, -1);
586 }
587 
588 HWTEST_F(WfdSinkSceneTest, HandlePlay_002, TestSize.Level1)
589 {
590     ASSERT_TRUE(sinkScene_ != nullptr);
591 
592     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ForwardEvent(_, _, _, _))
593         .WillOnce(Return(0));
594     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), Start(_, _))
595         .WillOnce(Return(0));
596     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), Play(_, _))
597         .WillOnce(Return(0));
598 
599     RestoreConnMap();
600     auto msg = std::make_shared<WfdPlayReq>();
601     auto reply = std::make_shared<WfdCommonRsp>();
602     msg->deviceId = "AA:BB:CC:DD:EE:FF";
603     int32_t ret = sinkScene_->HandlePlay(msg, reply);
604     EXPECT_EQ(ret, 0);
605 }
606 
607 HWTEST_F(WfdSinkSceneTest, HandlePlay_003, TestSize.Level1)
608 {
609     ASSERT_TRUE(sinkScene_ != nullptr);
610 
611     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), Resume(_, _, _))
612         .WillOnce(Return(0));
613 
614     ConnectionInfo connectionInfo;
615     sinkScene_->devConnectionMap_.clear();
616     connectionInfo.contextId = 1;
617     connectionInfo.agentId = 1;
618     connectionInfo.isRunning = true;
619     connectionInfo.mac = "AA:BB:CC:DD:EE:FF";
620     std::shared_ptr<ConnectionInfo> connectionInfoPtr = std::make_shared<ConnectionInfo>(connectionInfo);
621     sinkScene_->devConnectionMap_.emplace(connectionInfo.mac, connectionInfoPtr);
622     auto msg = std::make_shared<WfdPlayReq>();
623     auto reply = std::make_shared<WfdCommonRsp>();
624     msg->deviceId = "AA:BB:CC:DD:EE:FF";
625     int32_t ret = sinkScene_->HandlePlay(msg, reply);
626     EXPECT_EQ(ret, 0);
627 }
628 
629 HWTEST_F(WfdSinkSceneTest, HandlePause_001, TestSize.Level1)
630 {
631     ASSERT_TRUE(sinkScene_ != nullptr);
632 
633     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
634         .WillOnce(Return(0));
635 
636     RestoreConnMap();
637     auto msg = std::make_shared<WfdPauseReq>();
638     auto reply = std::make_shared<WfdCommonRsp>();
639     msg->deviceId = "";
640     int32_t ret = sinkScene_->HandlePause(msg, reply);
641     EXPECT_EQ(ret, -1);
642 }
643 
644 HWTEST_F(WfdSinkSceneTest, HandlePause_002, TestSize.Level1)
645 {
646     ASSERT_TRUE(sinkScene_ != nullptr);
647 
648     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), Pause(_, _, _))
649         .WillOnce(Return(0));
650 
651     RestoreConnMap();
652     auto msg = std::make_shared<WfdPauseReq>();
653     auto reply = std::make_shared<WfdCommonRsp>();
654     msg->deviceId = "AA:BB:CC:DD:EE:FF";
655     int32_t ret = sinkScene_->HandlePause(msg, reply);
656     EXPECT_EQ(ret, 0);
657 }
658 
659 HWTEST_F(WfdSinkSceneTest, HandleMute_001, TestSize.Level1)
660 {
661     ASSERT_TRUE(sinkScene_ != nullptr);
662 
663     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
664         .WillOnce(Return(0));
665 
666     RestoreConnMap();
667     auto msg = std::make_shared<MuteReq>();
668     auto reply = std::make_shared<WfdCommonRsp>();
669     msg->deviceId = "";
670     int32_t ret = sinkScene_->HandleMute(msg, reply);
671     EXPECT_EQ(ret, -1);
672 }
673 
674 HWTEST_F(WfdSinkSceneTest, HandleMute_002, TestSize.Level1)
675 {
676     ASSERT_TRUE(sinkScene_ != nullptr);
677 
678     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), Pause(_, _, _))
679         .WillOnce(Return(0));
680 
681     RestoreConnMap();
682     auto msg = std::make_shared<MuteReq>();
683     auto reply = std::make_shared<WfdCommonRsp>();
684     msg->deviceId = "AA:BB:CC:DD:EE:FF";
685     int32_t ret = sinkScene_->HandleMute(msg, reply);
686     EXPECT_EQ(ret, 0);
687 }
688 
689 HWTEST_F(WfdSinkSceneTest, HandleUnMute_001, TestSize.Level1)
690 {
691     ASSERT_TRUE(sinkScene_ != nullptr);
692 
693     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
694         .WillOnce(Return(0));
695 
696     RestoreConnMap();
697     auto msg = std::make_shared<UnMuteReq>();
698     auto reply = std::make_shared<WfdCommonRsp>();
699     msg->deviceId = "";
700     int32_t ret = sinkScene_->HandleUnMute(msg, reply);
701     EXPECT_EQ(ret, -1);
702 }
703 
704 HWTEST_F(WfdSinkSceneTest, HandleUnMute_002, TestSize.Level1)
705 {
706     ASSERT_TRUE(sinkScene_ != nullptr);
707 
708     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), Resume(_, _, _))
709         .WillOnce(Return(0));
710 
711     RestoreConnMap();
712     auto msg = std::make_shared<UnMuteReq>();
713     auto reply = std::make_shared<WfdCommonRsp>();
714     msg->deviceId = "AA:BB:CC:DD:EE:FF";
715     int32_t ret = sinkScene_->HandleUnMute(msg, reply);
716     EXPECT_EQ(ret, 0);
717 }
718 
719 HWTEST_F(WfdSinkSceneTest, HandleClose_001, TestSize.Level1)
720 {
721     ASSERT_TRUE(sinkScene_ != nullptr);
722 
723     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
724         .WillOnce(Return(0));
725 
726     RestoreConnMap();
727     auto msg = std::make_shared<WfdCloseReq>();
728     auto reply = std::make_shared<WfdCommonRsp>();
729     msg->deviceId = "";
730     int32_t ret = sinkScene_->HandleClose(msg, reply);
731     EXPECT_EQ(ret, -1);
732 }
733 
734 HWTEST_F(WfdSinkSceneTest, HandleClose_002, TestSize.Level1)
735 {
736     ASSERT_TRUE(sinkScene_ != nullptr);
737 
738     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
739         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
740     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
741         .WillOnce(Return(0));
742     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ForwardEvent(_, _, _, _))
743         .WillOnce(Return(0));
744     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
745         .WillOnce(Return(0));
746 
747     RestoreConnMap();
748     auto msg = std::make_shared<WfdCloseReq>();
749     auto reply = std::make_shared<WfdCommonRsp>();
750     msg->deviceId = "AA:BB:CC:DD:EE:FF";
751     int32_t ret = sinkScene_->HandleClose(msg, reply);
752     EXPECT_EQ(ret, 0);
753 }
754 
755 HWTEST_F(WfdSinkSceneTest, HandleGetConfig_001, TestSize.Level1)
756 {
757     ASSERT_TRUE(sinkScene_ != nullptr);
758 
759     auto msg = std::make_shared<GetSinkConfigReq>();
760     auto reply = std::make_shared<GetSinkConfigRsp>();
761     int32_t ret = sinkScene_->HandleGetConfig(msg, reply);
762     EXPECT_EQ(ret, 0);
763 }
764 
765 HWTEST_F(WfdSinkSceneTest, ErrorCodeFiltering_001, TestSize.Level1)
766 {
767     ASSERT_TRUE(sinkScene_ != nullptr);
768 
769     int32_t code = static_cast<int32_t>(ERR_CONTEXT_AGENT_BASE);
770     sinkScene_->ErrorCodeFiltering(code);
771 }
772 
773 HWTEST_F(WfdSinkSceneTest, ErrorCodeFiltering_002, TestSize.Level1)
774 {
775     ASSERT_TRUE(sinkScene_ != nullptr);
776 
777     int32_t code = static_cast<int32_t>(ERR_SESSION_BASE);
778     sinkScene_->ErrorCodeFiltering(code);
779 }
780 
781 HWTEST_F(WfdSinkSceneTest, ErrorCodeFiltering_003, TestSize.Level1)
782 {
783     ASSERT_TRUE(sinkScene_ != nullptr);
784 
785     int32_t code = static_cast<int32_t>(ERR_PROSUMER_START);
786     sinkScene_->ErrorCodeFiltering(code);
787 }
788 
789 HWTEST_F(WfdSinkSceneTest, ErrorCodeFiltering_004, TestSize.Level1)
790 {
791     ASSERT_TRUE(sinkScene_ != nullptr);
792 
793     int32_t code = static_cast<int32_t>(ERR_PROSUMER_TIMEOUT);
794     sinkScene_->ErrorCodeFiltering(code);
795 }
796 
797 HWTEST_F(WfdSinkSceneTest, ErrorCodeFiltering_005, TestSize.Level1)
798 {
799     ASSERT_TRUE(sinkScene_ != nullptr);
800 
801     int32_t code = static_cast<int32_t>(ERR_PROSUMER_DESTROY);
802     sinkScene_->ErrorCodeFiltering(code);
803 }
804 
805 HWTEST_F(WfdSinkSceneTest, ErrorCodeFiltering_006, TestSize.Level1)
806 {
807     ASSERT_TRUE(sinkScene_ != nullptr);
808 
809     int32_t code = static_cast<int32_t>(ERR_PROSUMER_INIT);
810     sinkScene_->ErrorCodeFiltering(code);
811 }
812 
813 HWTEST_F(WfdSinkSceneTest, OnInnerError_001, TestSize.Level1)
814 {
815     ASSERT_TRUE(sinkScene_ != nullptr);
816 
817     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
818         .WillOnce(Return(0));
819 
820     sinkScene_->OnInnerError(1, 1, SharingErrorCode::ERR_PROSUMER_TIMEOUT, "err msg");
821 }
822 
823 HWTEST_F(WfdSinkSceneTest, OnInnerError_002, TestSize.Level1)
824 {
825     ASSERT_TRUE(sinkScene_ != nullptr);
826 
827     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
828         .WillOnce(Return(0));
829 
830     sinkScene_->OnInnerError(1, 1, SharingErrorCode::ERR_PROSUMER_INIT, "err msg");
831 }
832 
833 HWTEST_F(WfdSinkSceneTest, OnInnerError_003, TestSize.Level1)
834 {
835     ASSERT_TRUE(sinkScene_ != nullptr);
836 
837     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
838         .WillOnce(Return(0));
839 
840     sinkScene_->OnInnerError("", SharingErrorCode::ERR_PROSUMER_INIT, "err msg");
841 }
842 
843 HWTEST_F(WfdSinkSceneTest, OnInnerDestroy_001, TestSize.Level1)
844 {
845     ASSERT_TRUE(sinkScene_ != nullptr);
846 
847     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
848         .WillOnce(Return(0));
849     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
850         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
851 
852     RestoreConnMap();
853     sinkScene_->OnInnerDestroy(1, 1, AgentType::SINK_AGENT);
854 }
855 
856 HWTEST_F(WfdSinkSceneTest, OnInnerEvent_001, TestSize.Level1)
857 {
858     ASSERT_TRUE(sinkScene_ != nullptr);
859 
860     SharingEvent event;
861     auto msg = std::make_shared<WfdSceneEventMsg>();
862     msg->mac = "";
863     msg->type = EventType::EVENT_WFD_NOTIFY_RTSP_PLAYED;
864     event.eventMsg = msg;
865     RestoreConnMap();
866     sinkScene_->OnInnerEvent(event);
867 }
868 
869 HWTEST_F(WfdSinkSceneTest, OnInnerEvent_002, TestSize.Level1)
870 {
871     ASSERT_TRUE(sinkScene_ != nullptr);
872 
873     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
874         .WillOnce(Return(0));
875 
876     SharingEvent event;
877     auto msg = std::make_shared<WfdSceneEventMsg>();
878     msg->mac = "AA:BB:CC:DD:EE:FF";
879     msg->type = EventType::EVENT_WFD_NOTIFY_RTSP_PLAYED;
880     event.eventMsg = msg;
881     RestoreConnMap();
882     sinkScene_->OnInnerEvent(event);
883 }
884 
885 HWTEST_F(WfdSinkSceneTest, OnInnerEvent_003, TestSize.Level1)
886 {
887     ASSERT_TRUE(sinkScene_ != nullptr);
888 
889     EXPECT_CALL(*(sinkScene_->mockWifiP2pInstance_), RemoveGroupClient(_))
890         .WillOnce(Return(Wifi::ErrCode::WIFI_OPT_SUCCESS));
891     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
892         .WillOnce(Return(0));
893     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), DestroyAgent(_, _))
894         .WillOnce(Return(0));
895 
896     SharingEvent event;
897     auto msg = std::make_shared<WfdSceneEventMsg>();
898     msg->mac = "AA:BB:CC:DD:EE:FF";;
899     msg->type = EventType::EVENT_WFD_NOTIFY_RTSP_TEARDOWN;
900     event.eventMsg = msg;
901     RestoreConnMap();
902     sinkScene_->OnInnerEvent(event);
903 }
904 
905 HWTEST_F(WfdSinkSceneTest, OnInnerEvent_004, TestSize.Level1)
906 {
907     ASSERT_TRUE(sinkScene_ != nullptr);
908 
909     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
910         .WillOnce(Return(0));
911 
912     SharingEvent event;
913     auto msg = std::make_shared<WfdSceneEventMsg>();
914     msg->mac = "AA:BB:CC:DD:EE:FF";
915     msg->type = EventType::EVENT_INTERACTION_ACCELERATION_DONE;
916     msg->contextId = 1;
917     msg->agentId = 1;
918     event.eventMsg = msg;
919     RestoreConnMap();
920     sinkScene_->OnInnerEvent(event);
921 }
922 
923 HWTEST_F(WfdSinkSceneTest, OnInnerEvent_005, TestSize.Level1)
924 {
925     ASSERT_TRUE(sinkScene_ != nullptr);
926 
927     SharingEvent event;
928     auto msg = std::make_shared<WfdSceneEventMsg>();
929     msg->mac = "AA:BB:CC:DD:EE:FF";
930     msg->type = EventType::EVENT_INTERACTION_STATE_REMOVE_SURFACE;
931     msg->contextId = 1;
932     msg->agentId = 1;
933     event.eventMsg = msg;
934     sinkScene_->OnInnerEvent(event);
935 }
936 
937 HWTEST_F(WfdSinkSceneTest, OnInnerEvent_006, TestSize.Level1)
938 {
939     ASSERT_TRUE(sinkScene_ != nullptr);
940 
941     EXPECT_CALL(*(sinkScene_->mockIpcAdapter_), SendRequest(_, _))
942         .WillOnce(Return(0));
943 
944     SharingEvent event;
945     auto msg = std::make_shared<WfdSceneEventMsg>();
946     msg->mac = "AA:BB:CC:DD:EE:FF";
947     msg->type = EventType::EVENT_INTERACTION_DECODER_DIED;
948     msg->surfaceId = 0;
949     msg->contextId = 1;
950     msg->agentId = 1;
951     event.eventMsg = msg;
952     RestoreSurfaceMap();
953     RestoreConnMap();
954     sinkScene_->OnInnerEvent(event);
955 }
956 
957 HWTEST_F(WfdSinkSceneTest, OnRemoteDied_001, TestSize.Level1)
958 {
959     ASSERT_TRUE(sinkScene_ != nullptr);
960 
961     EXPECT_CALL(*(sinkScene_->mockSharingAdapter_), ReleaseScene(_));
962     sinkScene_->OnRemoteDied();
963 }
964 
965 } // namespace Sharing
966 } // namespace OHOS
967