1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 #include <ipc_types.h>
18 
19 #include "session_manager/include/zidl/scene_session_manager_lite_stub.h"
20 
21 using namespace testing;
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace Rosen {
26 class MockSceneSessionManagerLiteStub : public SceneSessionManagerLiteStub {
SetSessionLabel(const sptr<IRemoteObject> & token,const std::string & label)27     WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) override
28     {
29         return WSError::WS_OK;
30     }
SetSessionIcon(const sptr<IRemoteObject> & token,const std::shared_ptr<Media::PixelMap> & icon)31     WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) override
32     {
33         return WSError::WS_OK;
34     }
IsValidSessionIds(const std::vector<int32_t> & sessionIds,std::vector<bool> & results)35     WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) override
36     {
37         return WSError::WS_OK;
38     }
PendingSessionToForeground(const sptr<IRemoteObject> & token)39     WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) override
40     {
41         return WSError::WS_OK;
42     }
PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject> & token,bool shouldBackToCaller)43     WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token, bool shouldBackToCaller) override
44     {
45         return WSError::WS_OK;
46     }
GetFocusSessionToken(sptr<IRemoteObject> & token)47     WSError GetFocusSessionToken(sptr<IRemoteObject>& token) override
48     {
49         return WSError::WS_OK;
50     }
GetFocusSessionElement(AppExecFwk::ElementName & element)51     WSError GetFocusSessionElement(AppExecFwk::ElementName& element) override
52     {
53         return WSError::WS_OK;
54     }
RegisterSessionListener(const sptr<ISessionListener> & listener)55     WSError RegisterSessionListener(const sptr<ISessionListener>& listener) override
56     {
57         return WSError::WS_OK;
58     }
UnRegisterSessionListener(const sptr<ISessionListener> & listener)59     WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) override
60     {
61         return WSError::WS_OK;
62     }
GetSessionInfos(const std::string & deviceId,int32_t numMax,std::vector<SessionInfoBean> & sessionInfos)63     WSError GetSessionInfos(const std::string& deviceId,
64         int32_t numMax, std::vector<SessionInfoBean>& sessionInfos) override
65     {
66         return WSError::WS_OK;
67     }
GetMainWindowStatesByPid(int32_t pid,std::vector<MainWindowState> & windowStates)68     WSError GetMainWindowStatesByPid(int32_t pid, std::vector<MainWindowState>& windowStates) override
69     {
70         return WSError::WS_OK;
71     }
GetSessionInfo(const std::string & deviceId,int32_t persistentId,SessionInfoBean & sessionInfo)72     WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) override
73     {
74         return WSError::WS_OK;
75     }
GetSessionInfoByContinueSessionId(const std::string & continueSessionId,SessionInfoBean & sessionInfo)76     WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId,
77         SessionInfoBean& sessionInfo) override
78     {
79         return WSError::WS_OK;
80     }
SetSessionContinueState(const sptr<IRemoteObject> & token,const ContinueState & continueState)81     WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) override
82     {
83         return WSError::WS_OK;
84     }
TerminateSessionNew(const sptr<AAFwk::SessionInfo> info,bool needStartCaller,bool isFromBroker=false)85     WSError TerminateSessionNew(
86         const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) override
87     {
88         return WSError::WS_OK;
89     }
GetSessionSnapshot(const std::string & deviceId,int32_t persistentId,SessionSnapshot & snapshot,bool isLowResolution)90     WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId,
91         SessionSnapshot& snapshot, bool isLowResolution) override
92     {
93         return WSError::WS_OK;
94     }
ClearSession(int32_t persistentId)95     WSError ClearSession(int32_t persistentId) override
96     {
97         return WSError::WS_OK;
98     }
ClearAllSessions()99     WSError ClearAllSessions() override
100     {
101         return WSError::WS_OK;
102     }
LockSession(int32_t sessionId)103     WSError LockSession(int32_t sessionId) override
104     {
105         return WSError::WS_OK;
106     }
UnlockSession(int32_t sessionId)107     WSError UnlockSession(int32_t sessionId) override
108     {
109         return WSError::WS_OK;
110     }
MoveSessionsToForeground(const std::vector<std::int32_t> & sessionIds,int32_t topSessionId)111     WSError MoveSessionsToForeground(const std::vector<std::int32_t>& sessionIds, int32_t topSessionId) override
112     {
113         return WSError::WS_OK;
114     }
MoveSessionsToBackground(const std::vector<std::int32_t> & sessionIds,std::vector<std::int32_t> & result)115     WSError MoveSessionsToBackground(const std::vector<std::int32_t>& sessionIds,
116         std::vector<std::int32_t>& result) override
117     {
118         return WSError::WS_OK;
119     }
RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)120     WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
121         const sptr<IWindowManagerAgent>& windowManagerAgent) override
122     {
123         return WMError::WM_OK;
124     }
UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)125     WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
126         const sptr<IWindowManagerAgent>& windowManagerAgent) override
127     {
128         return WMError::WM_OK;
129     }
GetFocusWindowInfo(FocusChangeInfo & focusInfo)130     void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override
131     {
132     }
CheckWindowId(int32_t windowId,int32_t & pid)133     WMError CheckWindowId(int32_t windowId, int32_t& pid) override
134     {
135         return WMError::WM_OK;
136     }
GetMainWindowInfos(int32_t topNum,std::vector<MainWindowInfo> & topNInfo)137     WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) override
138     {
139         MainWindowInfo mainWindowInfo;
140         topNInfo.push_back(mainWindowInfo);
141         return WMError::WM_OK;
142     }
RaiseWindowToTop(int32_t persistentId)143     WSError RaiseWindowToTop(int32_t persistentId) override
144     {
145         return WSError::WS_OK;
146     }
RegisterIAbilityManagerCollaborator(int32_t type,const sptr<AAFwk::IAbilityManagerCollaborator> & impl)147     WSError RegisterIAbilityManagerCollaborator(int32_t type,
148         const sptr<AAFwk::IAbilityManagerCollaborator>& impl) override
149     {
150         return WSError::WS_OK;
151     }
UnregisterIAbilityManagerCollaborator(int32_t type)152     WSError UnregisterIAbilityManagerCollaborator(int32_t type) override
153     {
154         return WSError::WS_OK;
155     }
156 
GetAllMainWindowInfos(std::vector<MainWindowInfo> & infos)157     WMError GetAllMainWindowInfos(std::vector<MainWindowInfo>& infos) override
158     {
159         MainWindowInfo mainWindowInfo;
160         infos.push_back(mainWindowInfo);
161         return WMError::WM_OK;
162     }
ClearMainSessions(const std::vector<int32_t> & persistentIds,std::vector<int32_t> & clearFailedIds)163     WMError ClearMainSessions(const std::vector<int32_t>& persistentIds,
164         std::vector<int32_t>& clearFailedIds) override
165     {
166         clearFailedIds.push_back(1);
167         return WMError::WM_OK;
168     }
GetWindowStyleType(WindowStyleType & windowStyleType)169     WMError GetWindowStyleType(WindowStyleType& windowStyleType) override
170     {
171         return WMError::WM_OK;
172     }
TerminateSessionByPersistentId(int32_t persistentId)173     WMError TerminateSessionByPersistentId(int32_t persistentId) override
174     {
175         return WMError::WM_OK;
176     }
GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)177     WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override
178     {
179         return WMError::WM_OK;
180     }
CloseTargetFloatWindow(const std::string & bundleName)181     WMError CloseTargetFloatWindow(const std::string& bundleName) override
182     {
183         return WMError::WM_OK;
184     }
CloseTargetPiPWindow(const std::string & bundleName)185     WMError CloseTargetPiPWindow(const std::string& bundleName) override
186     {
187         return WMError::WM_OK;
188     }
GetCurrentPiPWindowInfo(std::string & bundleName)189     WMError GetCurrentPiPWindowInfo(std::string& bundleName) override
190     {
191         bundleName = "test";
192         return WMError::WM_OK;
193     }
GetRootMainWindowId(int32_t persistentId,int32_t & hostWindowId)194     WMError GetRootMainWindowId(int32_t persistentId, int32_t& hostWindowId) override
195     {
196         return WMError::WM_OK;
197     }
AsObject()198     sptr<IRemoteObject> AsObject() override
199     {
200         return nullptr;
201     }
NotifyAppUseControlList(ControlAppType type,int32_t userId,const std::vector<AppUseControlInfo> & controlList)202     WSError NotifyAppUseControlList(ControlAppType type, int32_t userId,
203         const std::vector<AppUseControlInfo>& controlList) override { return WSError::WS_OK; }
CheckUIExtensionCreation(int32_t windowId,uint32_t tokenId,const AppExecFwk::ElementName & element,AppExecFwk::ExtensionAbilityType extensionAbilityType,int32_t & pid)204     WMError CheckUIExtensionCreation(int32_t windowId, uint32_t tokenId, const AppExecFwk::ElementName& element,
205         AppExecFwk::ExtensionAbilityType extensionAbilityType, int32_t& pid) override
206     {
207         return WMError::WM_OK;
208     }
209 };
210 
211 class SceneSessionManagerLiteStubTest : public testing::Test {
212 public:
213     static void SetUpTestCase();
214     static void TearDownTestCase();
215     void SetUp() override;
216     void TearDown() override;
217     sptr<SceneSessionManagerLiteStub> sceneSessionManagerLiteStub_ = nullptr;
218 };
219 
SetUpTestCase()220 void SceneSessionManagerLiteStubTest::SetUpTestCase()
221 {
222 }
223 
TearDownTestCase()224 void SceneSessionManagerLiteStubTest::TearDownTestCase()
225 {
226 }
227 
SetUp()228 void SceneSessionManagerLiteStubTest::SetUp()
229 {
230     sceneSessionManagerLiteStub_ = new MockSceneSessionManagerLiteStub();
231     EXPECT_NE(nullptr, sceneSessionManagerLiteStub_);
232 }
233 
TearDown()234 void SceneSessionManagerLiteStubTest::TearDown()
235 {
236     sceneSessionManagerLiteStub_ = nullptr;
237 }
238 
239 namespace {
240 /**
241  * @tc.name: OnRemoteRequest
242  * @tc.desc: test function : OnRemoteRequest
243  * @tc.type: FUNC
244  */
245 HWTEST_F(SceneSessionManagerLiteStubTest, OnRemoteRequest, Function | SmallTest | Level1)
246 {
247     uint32_t code = static_cast<uint32_t>(SceneSessionManagerLiteStub::
248         SceneSessionManagerLiteMessage::TRANS_ID_SET_SESSION_LABEL);
249     MessageParcel data;
250     MessageParcel reply;
251     MessageOption option;
252     data.WriteInterfaceToken(u"OpenHarmeny");
253     auto res = sceneSessionManagerLiteStub_->
254         SceneSessionManagerLiteStub::OnRemoteRequest(code, data, reply, option);
255     EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
256     data.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
257     res = sceneSessionManagerLiteStub_->
258         SceneSessionManagerLiteStub::OnRemoteRequest(1000, data, reply, option);
259     EXPECT_EQ(IPC_STUB_UNKNOW_TRANS_ERR, res);
260     data.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
261     res = sceneSessionManagerLiteStub_->
262         SceneSessionManagerLiteStub::OnRemoteRequest(code, data, reply, option);
263     EXPECT_EQ(ERR_NONE, res);
264 }
265 
266 /**
267  * @tc.name: HandleSetSessionIcon
268  * @tc.desc: test function : HandleSetSessionIcon
269  * @tc.type: FUNC
270  */
271 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionIcon, Function | SmallTest | Level1)
272 {
273     MessageParcel data;
274     MessageParcel reply;
275     auto res = sceneSessionManagerLiteStub_->
276         SceneSessionManagerLiteStub::HandleSetSessionIcon(data, reply);
277     EXPECT_EQ(ERR_INVALID_DATA, res);
278 }
279 
280 /**
281  * @tc.name: HandleIsValidSessionIds
282  * @tc.desc: test function : HandleIsValidSessionIds
283  * @tc.type: FUNC
284  */
285 HWTEST_F(SceneSessionManagerLiteStubTest, HandleIsValidSessionIds, Function | SmallTest | Level1)
286 {
287     MessageParcel data;
288     MessageParcel reply;
289     auto res = sceneSessionManagerLiteStub_->
290         SceneSessionManagerLiteStub::HandleIsValidSessionIds(data, reply);
291     EXPECT_EQ(ERR_NONE, res);
292 }
293 
294 /**
295  * @tc.name: HandlePendingSessionToForeground
296  * @tc.desc: test function : HandlePendingSessionToForeground
297  * @tc.type: FUNC
298  */
299 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToForeground, Function | SmallTest | Level1)
300 {
301     MessageParcel data;
302     MessageParcel reply;
303     auto res = sceneSessionManagerLiteStub_->
304         SceneSessionManagerLiteStub::HandlePendingSessionToForeground(data, reply);
305     EXPECT_EQ(ERR_INVALID_DATA, res);
306 }
307 
308 /**
309  * @tc.name: HandlePendingSessionToBackgroundForDelegator
310  * @tc.desc: test function : HandlePendingSessionToBackgroundForDelegator
311  * @tc.type: FUNC
312  */
313 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToBackgroundForDelegator, Function | SmallTest | Level1)
314 {
315     MessageParcel data;
316     MessageParcel reply;
317     auto res = sceneSessionManagerLiteStub_->
318         SceneSessionManagerLiteStub::HandlePendingSessionToBackgroundForDelegator(data, reply);
319     EXPECT_EQ(ERR_INVALID_DATA, res);
320 }
321 
322 /**
323  * @tc.name: HandleRegisterSessionListener
324  * @tc.desc: test function : HandleRegisterSessionListener
325  * @tc.type: FUNC
326  */
327 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterSessionListener, Function | SmallTest | Level1)
328 {
329     MessageParcel data;
330     MessageParcel reply;
331     auto res = sceneSessionManagerLiteStub_->
332         SceneSessionManagerLiteStub::HandleRegisterSessionListener(data, reply);
333     EXPECT_EQ(ERR_NONE, res);
334 }
335 
336 /**
337  * @tc.name: HandleUnRegisterSessionListener
338  * @tc.desc: test function : HandleUnRegisterSessionListener
339  * @tc.type: FUNC
340  */
341 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnRegisterSessionListener, Function | SmallTest | Level1)
342 {
343     MessageParcel data;
344     MessageParcel reply;
345     auto res = sceneSessionManagerLiteStub_->
346         SceneSessionManagerLiteStub::HandleUnRegisterSessionListener(data, reply);
347     EXPECT_EQ(ERR_NONE, res);
348 }
349 
350 /**
351  * @tc.name: HandleGetSessionInfos
352  * @tc.desc: test function : HandleGetSessionInfos
353  * @tc.type: FUNC
354  */
355 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfos, Function | SmallTest | Level1)
356 {
357     MessageParcel data;
358     MessageParcel reply;
359     auto res = sceneSessionManagerLiteStub_->
360         SceneSessionManagerLiteStub::HandleUnRegisterSessionListener(data, reply);
361     EXPECT_EQ(ERR_NONE, res);
362 }
363 
364 /**
365  * @tc.name: HandleGetMainWindowStatesByPid
366  * @tc.desc: test function : HandleGetMainWindowStatesByPid
367  * @tc.type: FUNC
368  */
369 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetMainWindowStatesByPid, Function | SmallTest | Level1)
370 {
371     MessageParcel data;
372     MessageParcel reply;
373     auto res = sceneSessionManagerLiteStub_->
374         SceneSessionManagerLiteStub::HandleGetMainWindowStatesByPid(data, reply);
375     EXPECT_EQ(res, ERR_INVALID_DATA);
376 }
377 
378 /**
379  * @tc.name: HandleGetSessionInfo
380  * @tc.desc: test function : HandleGetSessionInfo
381  * @tc.type: FUNC
382  */
383 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfo, Function | SmallTest | Level1)
384 {
385     MessageParcel data;
386     MessageParcel reply;
387     auto res = sceneSessionManagerLiteStub_->
388         SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
389     EXPECT_EQ(ERR_NONE, res);
390 }
391 
392 /**
393  * @tc.name: HandleGetSessionInfoByContinueSessionId
394  * @tc.desc: test function : HandleGetSessionInfoByContinueSessionId
395  * @tc.type: FUNC
396  */
397 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfoByContinueSessionId, Function | SmallTest | Level1)
398 {
399     MessageParcel data;
400     MessageParcel reply;
401     auto res = sceneSessionManagerLiteStub_->
402         SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(data, reply);
403     EXPECT_EQ(ERR_NONE, res);
404 }
405 
406 /**
407  * @tc.name: HandleTerminateSessionNew
408  * @tc.desc: test function : HandleTerminateSessionNew
409  * @tc.type: FUNC
410  */
411 HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionNew, Function | SmallTest | Level1)
412 {
413     MessageParcel data;
414     MessageParcel reply;
415     auto res = sceneSessionManagerLiteStub_->
416         SceneSessionManagerLiteStub::HandleTerminateSessionNew(data, reply);
417     EXPECT_EQ(ERR_INVALID_DATA, res);
418 }
419 
420 /**
421  * @tc.name: HandleGetFocusSessionToken
422  * @tc.desc: test function : HandleGetFocusSessionToken
423  * @tc.type: FUNC
424  */
425 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionToken, Function | SmallTest | Level1)
426 {
427     MessageParcel data;
428     MessageParcel reply;
429     auto res = sceneSessionManagerLiteStub_->
430         SceneSessionManagerLiteStub::HandleGetFocusSessionToken(data, reply);
431     EXPECT_EQ(ERR_NONE, res);
432 }
433 
434 /**
435  * @tc.name: HandleGetFocusSessionElement
436  * @tc.desc: test function : HandleGetFocusSessionElement
437  * @tc.type: FUNC
438  */
439 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionElement, Function | SmallTest | Level1)
440 {
441     MessageParcel data;
442     MessageParcel reply;
443     auto res = sceneSessionManagerLiteStub_->
444         SceneSessionManagerLiteStub::HandleGetFocusSessionElement(data, reply);
445     EXPECT_EQ(ERR_NONE, res);
446 }
447 
448 /**
449  * @tc.name: HandleSetSessionContinueState
450  * @tc.desc: test function : HandleSetSessionContinueState
451  * @tc.type: FUNC
452  */
453 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState, Function | SmallTest | Level1)
454 {
455     MessageParcel data;
456     MessageParcel reply;
457     auto res = sceneSessionManagerLiteStub_->
458         SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
459     EXPECT_EQ(ERR_NONE, res);
460 }
461 
462 /**
463  * @tc.name: HandleGetSessionSnapshot
464  * @tc.desc: test function : HandleGetSessionSnapshot
465  * @tc.type: FUNC
466  */
467 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionSnapshot, Function | SmallTest | Level1)
468 {
469     MessageParcel data;
470     MessageParcel reply;
471     auto res = sceneSessionManagerLiteStub_->
472         SceneSessionManagerLiteStub::HandleGetSessionSnapshot(data, reply);
473     EXPECT_EQ(ERR_NONE, res);
474 }
475 
476 /**
477  * @tc.name: HandleClearSession
478  * @tc.desc: test function : HandleClearSession
479  * @tc.type: FUNC
480  */
481 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearSession, Function | SmallTest | Level1)
482 {
483     MessageParcel data;
484     MessageParcel reply;
485     auto res = sceneSessionManagerLiteStub_->
486         SceneSessionManagerLiteStub::HandleClearSession(data, reply);
487     EXPECT_EQ(ERR_NONE, res);
488 }
489 
490 /**
491  * @tc.name: HandleClearAllSessions
492  * @tc.desc: test function : HandleClearAllSessions
493  * @tc.type: FUNC
494  */
495 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearAllSessions, Function | SmallTest | Level1)
496 {
497     MessageParcel data;
498     MessageParcel reply;
499     auto res = sceneSessionManagerLiteStub_->
500         SceneSessionManagerLiteStub::HandleClearAllSessions(data, reply);
501     EXPECT_EQ(ERR_NONE, res);
502 }
503 
504 /**
505  * @tc.name: HandleLockSession
506  * @tc.desc: test function : HandleLockSession
507  * @tc.type: FUNC
508  */
509 HWTEST_F(SceneSessionManagerLiteStubTest, HandleLockSession, Function | SmallTest | Level1)
510 {
511     MessageParcel data;
512     MessageParcel reply;
513     auto res = sceneSessionManagerLiteStub_->
514         SceneSessionManagerLiteStub::HandleLockSession(data, reply);
515     EXPECT_EQ(ERR_NONE, res);
516 }
517 
518 /**
519  * @tc.name: HandleUnlockSession
520  * @tc.desc: test function : HandleUnlockSession
521  * @tc.type: FUNC
522  */
523 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnlockSession, Function | SmallTest | Level1)
524 {
525     MessageParcel data;
526     MessageParcel reply;
527     auto res = sceneSessionManagerLiteStub_->
528         SceneSessionManagerLiteStub::HandleUnlockSession(data, reply);
529     EXPECT_EQ(ERR_NONE, res);
530 }
531 
532 /**
533  * @tc.name: HandleMoveSessionsToForeground
534  * @tc.desc: test function : HandleMoveSessionsToForeground
535  * @tc.type: FUNC
536  */
537 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToForeground, Function | SmallTest | Level1)
538 {
539     MessageParcel data;
540     MessageParcel reply;
541     auto res = sceneSessionManagerLiteStub_->
542         SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
543     EXPECT_EQ(ERR_NONE, res);
544 }
545 
546 /**
547  * @tc.name: HandleMoveSessionsToBackground
548  * @tc.desc: test function : HandleMoveSessionsToBackground
549  * @tc.type: FUNC
550  */
551 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToBackground, Function | SmallTest | Level1)
552 {
553     MessageParcel data;
554     MessageParcel reply;
555     auto res = sceneSessionManagerLiteStub_->
556         SceneSessionManagerLiteStub::HandleMoveSessionsToBackground(data, reply);
557     EXPECT_EQ(ERR_NONE, res);
558 }
559 
560 /**
561  * @tc.name: HandleGetFocusSessionInfo
562  * @tc.desc: test function : HandleGetFocusSessionInfo
563  * @tc.type: FUNC
564  */
565 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionInfo, Function | SmallTest | Level1)
566 {
567     MessageParcel data;
568     MessageParcel reply;
569     auto res = sceneSessionManagerLiteStub_->
570         SceneSessionManagerLiteStub::HandleGetFocusSessionInfo(data, reply);
571     EXPECT_EQ(ERR_NONE, res);
572 }
573 
574 /**
575  * @tc.name: HandleCheckWindowId
576  * @tc.desc: test function : HandleCheckWindowId
577  * @tc.type: FUNC
578  */
579 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCheckWindowId, Function | SmallTest | Level1)
580 {
581     MessageParcel data;
582     MessageParcel reply;
583     int32_t numMax = 100;
584     data.WriteInt32(numMax);
585     auto res = sceneSessionManagerLiteStub_->
586         SceneSessionManagerLiteStub::HandleCheckWindowId(data, reply);
587     EXPECT_EQ(ERR_NONE, res);
588 }
589 
590 /**
591  * @tc.name: HandleRegisterWindowManagerAgent
592  * @tc.desc: test function : HandleRegisterWindowManagerAgent
593  * @tc.type: FUNC
594  */
595 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterWindowManagerAgent, Function | SmallTest | Level1)
596 {
597     MessageParcel data;
598     MessageParcel reply;
599     auto res = sceneSessionManagerLiteStub_->
600         SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
601     EXPECT_EQ(ERR_NONE, res);
602 }
603 
604 /**
605  * @tc.name: HandleUnregisterWindowManagerAgent
606  * @tc.desc: test function : HandleUnregisterWindowManagerAgent
607  * @tc.type: FUNC
608  */
609 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnregisterWindowManagerAgent, Function | SmallTest | Level1)
610 {
611     MessageParcel data;
612     MessageParcel reply;
613     auto res = sceneSessionManagerLiteStub_->
614         SceneSessionManagerLiteStub::HandleUnregisterWindowManagerAgent(data, reply);
615     EXPECT_EQ(ERR_NONE, res);
616 }
617 
618 /**
619  * @tc.name: HandleGetVisibilityWindowInfo
620  * @tc.desc: test function : HandleGetVisibilityWindowInfo
621  * @tc.type: FUNC
622  */
623 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetVisibilityWindowInfo, Function | SmallTest | Level1)
624 {
625     MessageParcel data;
626     MessageParcel reply;
627     auto res = sceneSessionManagerLiteStub_->
628         SceneSessionManagerLiteStub::HandleGetVisibilityWindowInfo(data, reply);
629     EXPECT_EQ(ERR_NONE, res);
630 }
631 
632 /**
633  * @tc.name: HandleGetMainWinodowInfo
634  * @tc.desc: test function : HandleGetMainWinodowInfo
635  * @tc.type: FUNC
636  */
637 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetMainWinodowInfo, Function | SmallTest | Level1)
638 {
639     MessageParcel data;
640     MessageParcel reply;
641     int32_t numMax = 100;
642     data.WriteInt32(numMax);
643     auto res = sceneSessionManagerLiteStub_->
644         SceneSessionManagerLiteStub::HandleGetMainWinodowInfo(data, reply);
645     EXPECT_EQ(ERR_NONE, res);
646 }
647 
648 /**
649  * @tc.name: HandleRaiseWindowToTop
650  * @tc.desc: test function : HandleRaiseWindowToTop
651  * @tc.type: FUNC
652  */
653 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRaiseWindowToTop, Function | SmallTest | Level1)
654 {
655     MessageParcel data;
656     MessageParcel reply;
657     int32_t persistentId = 65535;
658     data.WriteInt32(persistentId);
659     auto res = sceneSessionManagerLiteStub_->
660         SceneSessionManagerLiteStub::HandleRaiseWindowToTop(data, reply);
661     EXPECT_EQ(ERR_NONE, res);
662 }
663 
664 /**
665  * @tc.name: HandleGetAllMainWindowInfos
666  * @tc.desc: test function : HandleGetAllMainWindowInfos
667  * @tc.type: FUNC
668  */
669 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetAllMainWindowInfos, Function | SmallTest | Level1)
670 {
671     MessageParcel data;
672     MessageParcel reply;
673     auto res = sceneSessionManagerLiteStub_->
674         SceneSessionManagerLiteStub::HandleGetAllMainWindowInfos(data, reply);
675     EXPECT_EQ(ERR_NONE, res);
676 }
677 
678 /**
679  * @tc.name: HandleClearMainSessions
680  * @tc.desc: test function : HandleClearMainSessions
681  * @tc.type: FUNC
682  */
683 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearMainSessions, Function | SmallTest | Level1)
684 {
685     MessageParcel data;
686     MessageParcel reply;
687     std::vector<int32_t> persistentIds = {1, 2, 3};
688     data.WriteInt32Vector(persistentIds);
689     auto res = sceneSessionManagerLiteStub_->
690         SceneSessionManagerLiteStub::HandleClearMainSessions(data, reply);
691     EXPECT_EQ(ERR_NONE, res);
692 }
693 
694 /**
695  * @tc.name: HandleGetWindowStyleType
696  * @tc.desc: test function : HandleGetWindowStyleType
697  * @tc.type: FUNC
698  */
699 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetWindowStyleType, Function | SmallTest | Level1)
700 {
701     MessageParcel data;
702     MessageParcel reply;
703     auto res = sceneSessionManagerLiteStub_->
704         SceneSessionManagerLiteStub::HandleGetWindowStyleType(data, reply);
705     EXPECT_EQ(ERR_NONE, res);
706 }
707 
708 /**
709  * @tc.name: HandleTerminateSessionByPersistentId
710  * @tc.desc: test function : HandleTerminateSessionByPersistentId
711  * @tc.type: FUNC
712  */
713 HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionByPersistentId, Function | SmallTest | Level1)
714 {
715     MessageParcel data;
716     MessageParcel reply;
717     int32_t persistentId = 1;
718     data.WriteInt32(persistentId);
719     auto res = sceneSessionManagerLiteStub_->
720         SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(data, reply);
721     EXPECT_EQ(ERR_NONE, res);
722 }
723 
724 /**
725  * @tc.name: HandleCloseTargetFloatWindow
726  * @tc.desc: test function : HandleCloseTargetFloatWindow
727  * @tc.type: FUNC
728  */
729 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCloseTargetFloatWindow, Function | SmallTest | Level1)
730 {
731     MessageParcel data;
732     MessageParcel reply;
733     data.WriteString("test");
734     auto res = sceneSessionManagerLiteStub_->
735         SceneSessionManagerLiteStub::HandleCloseTargetFloatWindow(data, reply);
736     EXPECT_EQ(ERR_NONE, res);
737 }
738 
739 /**
740  * @tc.name: HandleCloseTargetPiPWindow
741  * @tc.desc: test function : HandleCloseTargetPiPWindow
742  * @tc.type: FUNC
743  */
744 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCloseTargetPiPWindow, Function | SmallTest | Level1)
745 {
746     MessageParcel data;
747     MessageParcel reply;
748     auto res = sceneSessionManagerLiteStub_->
749         SceneSessionManagerLiteStub::HandleCloseTargetPiPWindow(data, reply);
750     EXPECT_EQ(ERR_NONE, res);
751 }
752 
753 /**
754  * @tc.name: HandleGetCurrentPiPWindowInfo
755  * @tc.desc: test function : HandleGetCurrentPiPWindowInfo
756  * @tc.type: FUNC
757  */
758 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetCurrentPiPWindowInfo, Function | SmallTest | Level1)
759 {
760     MessageParcel data;
761     MessageParcel reply;
762     auto res = sceneSessionManagerLiteStub_->
763         SceneSessionManagerLiteStub::HandleGetCurrentPiPWindowInfo(data, reply);
764     EXPECT_EQ(ERR_NONE, res);
765 }
766 
767 /**
768  * @tc.name: HandleNotifyAppUseControlList
769  * @tc.desc: test function : HandleNotifyAppUseControlList
770  * @tc.type: FUNC
771  */
772 HWTEST_F(SceneSessionManagerLiteStubTest, HandleNotifyAppUseControlList, Function | SmallTest | Level1)
773 {
774     MessageParcel data;
775     MessageParcel reply;
776     uint8_t typeId = 1;
777     int32_t userId = 1;
778     int32_t size = 1;
779     std::string bundleName = "appbundleName";
780     int32_t appIndex = 1;
781     bool isControl = true;
782 
783     data.WriteUint8(typeId);
784     data.WriteInt32(userId);
785     data.WriteInt32(size);
786     data.WriteString(bundleName);
787     data.WriteInt32(appIndex);
788     data.WriteBool(isControl);
789 
790     auto res = sceneSessionManagerLiteStub_->
791         SceneSessionManagerLiteStub::HandleNotifyAppUseControlList(data, reply);
792     EXPECT_EQ(ERR_NONE, res);
793 }
794 
795 /**
796  * @tc.name: HandleGetRootMainWindowId
797  * @tc.desc: test function : HandleGetRootMainWindowId
798  * @tc.type: FUNC
799  */
800 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetRootMainWindowId, Function | SmallTest | Level1)
801 {
802     MessageParcel data;
803     MessageParcel reply;
804     int32_t persistentId = 1;
805     data.WriteInt32(persistentId);
806     auto res = sceneSessionManagerLiteStub_->
807         SceneSessionManagerLiteStub::HandleGetRootMainWindowId(data, reply);
808     EXPECT_EQ(ERR_NONE, res);
809 }
810 }
811 }
812 }