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,bool isRecover=false)55 WSError RegisterSessionListener(const sptr<ISessionListener>& listener, bool isRecover = false) 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 }
MinimizeMainSession(const std::string & bundleName,int32_t appIndex,int32_t userId)209 WMError MinimizeMainSession(const std::string& bundleName,
210 int32_t appIndex, int32_t userId) override { return WMError::WM_OK; }
HasFloatingWindowForeground(const sptr<IRemoteObject> & abilityToken,bool & hasFloatingShowing)211 WMError HasFloatingWindowForeground(const sptr<IRemoteObject>& abilityToken,
212 bool& hasFloatingShowing) override { return WMError::WM_OK; }
LockSessionByAbilityInfo(const AbilityInfoBase & abilityInfo,bool isLock)213 WMError LockSessionByAbilityInfo(const AbilityInfoBase& abilityInfo,
214 bool isLock) override { return WMError::WM_OK; }
215 };
216
217 class SceneSessionManagerLiteStubTest : public testing::Test {
218 public:
219 static void SetUpTestCase();
220 static void TearDownTestCase();
221 void SetUp() override;
222 void TearDown() override;
223 sptr<SceneSessionManagerLiteStub> sceneSessionManagerLiteStub_ = nullptr;
224 };
225
SetUpTestCase()226 void SceneSessionManagerLiteStubTest::SetUpTestCase()
227 {
228 }
229
TearDownTestCase()230 void SceneSessionManagerLiteStubTest::TearDownTestCase()
231 {
232 }
233
SetUp()234 void SceneSessionManagerLiteStubTest::SetUp()
235 {
236 sceneSessionManagerLiteStub_ = new MockSceneSessionManagerLiteStub();
237 EXPECT_NE(nullptr, sceneSessionManagerLiteStub_);
238 }
239
TearDown()240 void SceneSessionManagerLiteStubTest::TearDown()
241 {
242 sceneSessionManagerLiteStub_ = nullptr;
243 }
244
245 namespace {
246 /**
247 * @tc.name: OnRemoteRequest
248 * @tc.desc: test function : OnRemoteRequest
249 * @tc.type: FUNC
250 */
251 HWTEST_F(SceneSessionManagerLiteStubTest, OnRemoteRequest, Function | SmallTest | Level1)
252 {
253 uint32_t code = static_cast<uint32_t>(SceneSessionManagerLiteStub::
254 SceneSessionManagerLiteMessage::TRANS_ID_SET_SESSION_LABEL);
255 MessageParcel data;
256 MessageParcel reply;
257 MessageOption option;
258 data.WriteInterfaceToken(u"OpenHarmeny");
259 auto res = sceneSessionManagerLiteStub_->
260 SceneSessionManagerLiteStub::OnRemoteRequest(code, data, reply, option);
261 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
262 data.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
263 res = sceneSessionManagerLiteStub_->
264 SceneSessionManagerLiteStub::OnRemoteRequest(1000, data, reply, option);
265 EXPECT_EQ(IPC_STUB_UNKNOW_TRANS_ERR, res);
266 data.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
267 res = sceneSessionManagerLiteStub_->
268 SceneSessionManagerLiteStub::OnRemoteRequest(code, data, reply, option);
269 EXPECT_EQ(ERR_NONE, res);
270 }
271
272 /**
273 * @tc.name: HandleSetSessionIcon
274 * @tc.desc: test function : HandleSetSessionIcon
275 * @tc.type: FUNC
276 */
277 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionIcon, Function | SmallTest | Level1)
278 {
279 MessageParcel data;
280 MessageParcel reply;
281 auto res = sceneSessionManagerLiteStub_->
282 SceneSessionManagerLiteStub::HandleSetSessionIcon(data, reply);
283 EXPECT_EQ(ERR_INVALID_DATA, res);
284 }
285
286 /**
287 * @tc.name: HandleIsValidSessionIds
288 * @tc.desc: test function : HandleIsValidSessionIds
289 * @tc.type: FUNC
290 */
291 HWTEST_F(SceneSessionManagerLiteStubTest, HandleIsValidSessionIds, Function | SmallTest | Level1)
292 {
293 MessageParcel data;
294 MessageParcel reply;
295 auto res = sceneSessionManagerLiteStub_->
296 SceneSessionManagerLiteStub::HandleIsValidSessionIds(data, reply);
297 EXPECT_EQ(ERR_NONE, res);
298 }
299
300 /**
301 * @tc.name: HandlePendingSessionToForeground
302 * @tc.desc: test function : HandlePendingSessionToForeground
303 * @tc.type: FUNC
304 */
305 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToForeground, Function | SmallTest | Level1)
306 {
307 MessageParcel data;
308 MessageParcel reply;
309 auto res = sceneSessionManagerLiteStub_->
310 SceneSessionManagerLiteStub::HandlePendingSessionToForeground(data, reply);
311 EXPECT_EQ(ERR_INVALID_DATA, res);
312 }
313
314 /**
315 * @tc.name: HandlePendingSessionToBackgroundForDelegator
316 * @tc.desc: test function : HandlePendingSessionToBackgroundForDelegator
317 * @tc.type: FUNC
318 */
319 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToBackgroundForDelegator, Function | SmallTest | Level1)
320 {
321 MessageParcel data;
322 MessageParcel reply;
323 auto res = sceneSessionManagerLiteStub_->
324 SceneSessionManagerLiteStub::HandlePendingSessionToBackgroundForDelegator(data, reply);
325 EXPECT_EQ(ERR_INVALID_DATA, res);
326 }
327
328 /**
329 * @tc.name: HandleRegisterSessionListener
330 * @tc.desc: test function : HandleRegisterSessionListener
331 * @tc.type: FUNC
332 */
333 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterSessionListener, Function | SmallTest | Level1)
334 {
335 MessageParcel data;
336 MessageParcel reply;
337 auto res = sceneSessionManagerLiteStub_->
338 SceneSessionManagerLiteStub::HandleRegisterSessionListener(data, reply);
339 EXPECT_EQ(ERR_NONE, res);
340 }
341
342 /**
343 * @tc.name: HandleUnRegisterSessionListener
344 * @tc.desc: test function : HandleUnRegisterSessionListener
345 * @tc.type: FUNC
346 */
347 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnRegisterSessionListener, Function | SmallTest | Level1)
348 {
349 MessageParcel data;
350 MessageParcel reply;
351 auto res = sceneSessionManagerLiteStub_->
352 SceneSessionManagerLiteStub::HandleUnRegisterSessionListener(data, reply);
353 EXPECT_EQ(ERR_NONE, res);
354 }
355
356 /**
357 * @tc.name: HandleGetSessionInfos
358 * @tc.desc: test function : HandleGetSessionInfos
359 * @tc.type: FUNC
360 */
361 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfos, Function | SmallTest | Level1)
362 {
363 MessageParcel data;
364 MessageParcel reply;
365 auto res = sceneSessionManagerLiteStub_->
366 SceneSessionManagerLiteStub::HandleUnRegisterSessionListener(data, reply);
367 EXPECT_EQ(ERR_NONE, res);
368 }
369
370 /**
371 * @tc.name: HandleGetMainWindowStatesByPid
372 * @tc.desc: test function : HandleGetMainWindowStatesByPid
373 * @tc.type: FUNC
374 */
375 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetMainWindowStatesByPid, Function | SmallTest | Level1)
376 {
377 MessageParcel data;
378 MessageParcel reply;
379 auto res = sceneSessionManagerLiteStub_->
380 SceneSessionManagerLiteStub::HandleGetMainWindowStatesByPid(data, reply);
381 EXPECT_EQ(res, ERR_INVALID_DATA);
382 }
383
384 /**
385 * @tc.name: HandleGetSessionInfo
386 * @tc.desc: test function : HandleGetSessionInfo
387 * @tc.type: FUNC
388 */
389 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfo, Function | SmallTest | Level1)
390 {
391 MessageParcel data;
392 MessageParcel reply;
393 auto res = sceneSessionManagerLiteStub_->
394 SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
395 EXPECT_EQ(ERR_NONE, res);
396 }
397
398 /**
399 * @tc.name: HandleGetSessionInfoByContinueSessionId
400 * @tc.desc: test function : HandleGetSessionInfoByContinueSessionId
401 * @tc.type: FUNC
402 */
403 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfoByContinueSessionId, Function | SmallTest | Level1)
404 {
405 MessageParcel data;
406 MessageParcel reply;
407 auto res = sceneSessionManagerLiteStub_->
408 SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(data, reply);
409 EXPECT_EQ(ERR_NONE, res);
410 }
411
412 /**
413 * @tc.name: HandleTerminateSessionNew
414 * @tc.desc: test function : HandleTerminateSessionNew
415 * @tc.type: FUNC
416 */
417 HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionNew, Function | SmallTest | Level1)
418 {
419 MessageParcel data;
420 MessageParcel reply;
421 auto res = sceneSessionManagerLiteStub_->
422 SceneSessionManagerLiteStub::HandleTerminateSessionNew(data, reply);
423 EXPECT_EQ(ERR_INVALID_DATA, res);
424 }
425
426 /**
427 * @tc.name: HandleGetFocusSessionToken
428 * @tc.desc: test function : HandleGetFocusSessionToken
429 * @tc.type: FUNC
430 */
431 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionToken, Function | SmallTest | Level1)
432 {
433 MessageParcel data;
434 MessageParcel reply;
435 auto res = sceneSessionManagerLiteStub_->
436 SceneSessionManagerLiteStub::HandleGetFocusSessionToken(data, reply);
437 EXPECT_EQ(ERR_NONE, res);
438 }
439
440 /**
441 * @tc.name: HandleGetFocusSessionElement
442 * @tc.desc: test function : HandleGetFocusSessionElement
443 * @tc.type: FUNC
444 */
445 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionElement, Function | SmallTest | Level1)
446 {
447 MessageParcel data;
448 MessageParcel reply;
449 auto res = sceneSessionManagerLiteStub_->
450 SceneSessionManagerLiteStub::HandleGetFocusSessionElement(data, reply);
451 EXPECT_EQ(ERR_NONE, res);
452 }
453
454 /**
455 * @tc.name: HandleSetSessionContinueState
456 * @tc.desc: test function : HandleSetSessionContinueState
457 * @tc.type: FUNC
458 */
459 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState, Function | SmallTest | Level1)
460 {
461 MessageParcel data;
462 MessageParcel reply;
463 auto res = sceneSessionManagerLiteStub_->
464 SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
465 EXPECT_EQ(ERR_NONE, res);
466 }
467
468 /**
469 * @tc.name: HandleGetSessionSnapshot
470 * @tc.desc: test function : HandleGetSessionSnapshot
471 * @tc.type: FUNC
472 */
473 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionSnapshot, Function | SmallTest | Level1)
474 {
475 MessageParcel data;
476 MessageParcel reply;
477 auto res = sceneSessionManagerLiteStub_->
478 SceneSessionManagerLiteStub::HandleGetSessionSnapshot(data, reply);
479 EXPECT_EQ(ERR_NONE, res);
480 }
481
482 /**
483 * @tc.name: HandleClearSession
484 * @tc.desc: test function : HandleClearSession
485 * @tc.type: FUNC
486 */
487 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearSession, Function | SmallTest | Level1)
488 {
489 MessageParcel data;
490 MessageParcel reply;
491 auto res = sceneSessionManagerLiteStub_->
492 SceneSessionManagerLiteStub::HandleClearSession(data, reply);
493 EXPECT_EQ(ERR_NONE, res);
494 }
495
496 /**
497 * @tc.name: HandleClearAllSessions
498 * @tc.desc: test function : HandleClearAllSessions
499 * @tc.type: FUNC
500 */
501 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearAllSessions, Function | SmallTest | Level1)
502 {
503 MessageParcel data;
504 MessageParcel reply;
505 auto res = sceneSessionManagerLiteStub_->
506 SceneSessionManagerLiteStub::HandleClearAllSessions(data, reply);
507 EXPECT_EQ(ERR_NONE, res);
508 }
509
510 /**
511 * @tc.name: HandleLockSession
512 * @tc.desc: test function : HandleLockSession
513 * @tc.type: FUNC
514 */
515 HWTEST_F(SceneSessionManagerLiteStubTest, HandleLockSession, Function | SmallTest | Level1)
516 {
517 MessageParcel data;
518 MessageParcel reply;
519 auto res = sceneSessionManagerLiteStub_->
520 SceneSessionManagerLiteStub::HandleLockSession(data, reply);
521 EXPECT_EQ(ERR_NONE, res);
522 }
523
524 /**
525 * @tc.name: HandleUnlockSession
526 * @tc.desc: test function : HandleUnlockSession
527 * @tc.type: FUNC
528 */
529 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnlockSession, Function | SmallTest | Level1)
530 {
531 MessageParcel data;
532 MessageParcel reply;
533 auto res = sceneSessionManagerLiteStub_->
534 SceneSessionManagerLiteStub::HandleUnlockSession(data, reply);
535 EXPECT_EQ(ERR_NONE, res);
536 }
537
538 /**
539 * @tc.name: HandleMoveSessionsToForeground
540 * @tc.desc: test function : HandleMoveSessionsToForeground
541 * @tc.type: FUNC
542 */
543 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToForeground, Function | SmallTest | Level1)
544 {
545 MessageParcel data;
546 MessageParcel reply;
547 auto res = sceneSessionManagerLiteStub_->
548 SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
549 EXPECT_EQ(ERR_NONE, res);
550 }
551
552 /**
553 * @tc.name: HandleMoveSessionsToBackground
554 * @tc.desc: test function : HandleMoveSessionsToBackground
555 * @tc.type: FUNC
556 */
557 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToBackground, Function | SmallTest | Level1)
558 {
559 MessageParcel data;
560 MessageParcel reply;
561 auto res = sceneSessionManagerLiteStub_->
562 SceneSessionManagerLiteStub::HandleMoveSessionsToBackground(data, reply);
563 EXPECT_EQ(ERR_NONE, res);
564 }
565
566 /**
567 * @tc.name: HandleGetFocusSessionInfo
568 * @tc.desc: test function : HandleGetFocusSessionInfo
569 * @tc.type: FUNC
570 */
571 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionInfo, Function | SmallTest | Level1)
572 {
573 MessageParcel data;
574 MessageParcel reply;
575 auto res = sceneSessionManagerLiteStub_->
576 SceneSessionManagerLiteStub::HandleGetFocusSessionInfo(data, reply);
577 EXPECT_EQ(ERR_NONE, res);
578 }
579
580 /**
581 * @tc.name: HandleCheckWindowId
582 * @tc.desc: test function : HandleCheckWindowId
583 * @tc.type: FUNC
584 */
585 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCheckWindowId, Function | SmallTest | Level1)
586 {
587 MessageParcel data;
588 MessageParcel reply;
589 int32_t numMax = 100;
590 data.WriteInt32(numMax);
591 auto res = sceneSessionManagerLiteStub_->
592 SceneSessionManagerLiteStub::HandleCheckWindowId(data, reply);
593 EXPECT_EQ(ERR_NONE, res);
594 }
595
596 /**
597 * @tc.name: HandleRegisterWindowManagerAgent
598 * @tc.desc: test function : HandleRegisterWindowManagerAgent
599 * @tc.type: FUNC
600 */
601 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterWindowManagerAgent, Function | SmallTest | Level1)
602 {
603 MessageParcel data;
604 MessageParcel reply;
605 auto res = sceneSessionManagerLiteStub_->
606 SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
607 EXPECT_EQ(ERR_NONE, res);
608 }
609
610 /**
611 * @tc.name: HandleUnregisterWindowManagerAgent
612 * @tc.desc: test function : HandleUnregisterWindowManagerAgent
613 * @tc.type: FUNC
614 */
615 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnregisterWindowManagerAgent, Function | SmallTest | Level1)
616 {
617 MessageParcel data;
618 MessageParcel reply;
619 auto res = sceneSessionManagerLiteStub_->
620 SceneSessionManagerLiteStub::HandleUnregisterWindowManagerAgent(data, reply);
621 EXPECT_EQ(ERR_NONE, res);
622 }
623
624 /**
625 * @tc.name: HandleGetVisibilityWindowInfo
626 * @tc.desc: test function : HandleGetVisibilityWindowInfo
627 * @tc.type: FUNC
628 */
629 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetVisibilityWindowInfo, Function | SmallTest | Level1)
630 {
631 MessageParcel data;
632 MessageParcel reply;
633 auto res = sceneSessionManagerLiteStub_->
634 SceneSessionManagerLiteStub::HandleGetVisibilityWindowInfo(data, reply);
635 EXPECT_EQ(ERR_NONE, res);
636 }
637
638 /**
639 * @tc.name: HandleGetMainWinodowInfo
640 * @tc.desc: test function : HandleGetMainWinodowInfo
641 * @tc.type: FUNC
642 */
643 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetMainWinodowInfo, Function | SmallTest | Level1)
644 {
645 MessageParcel data;
646 MessageParcel reply;
647 int32_t numMax = 100;
648 data.WriteInt32(numMax);
649 auto res = sceneSessionManagerLiteStub_->
650 SceneSessionManagerLiteStub::HandleGetMainWinodowInfo(data, reply);
651 EXPECT_EQ(ERR_NONE, res);
652 }
653
654 /**
655 * @tc.name: HandleRaiseWindowToTop
656 * @tc.desc: test function : HandleRaiseWindowToTop
657 * @tc.type: FUNC
658 */
659 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRaiseWindowToTop, Function | SmallTest | Level1)
660 {
661 MessageParcel data;
662 MessageParcel reply;
663 int32_t persistentId = 65535;
664 data.WriteInt32(persistentId);
665 auto res = sceneSessionManagerLiteStub_->
666 SceneSessionManagerLiteStub::HandleRaiseWindowToTop(data, reply);
667 EXPECT_EQ(ERR_NONE, res);
668 }
669
670 /**
671 * @tc.name: HandleGetAllMainWindowInfos
672 * @tc.desc: test function : HandleGetAllMainWindowInfos
673 * @tc.type: FUNC
674 */
675 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetAllMainWindowInfos, Function | SmallTest | Level1)
676 {
677 MessageParcel data;
678 MessageParcel reply;
679 auto res = sceneSessionManagerLiteStub_->
680 SceneSessionManagerLiteStub::HandleGetAllMainWindowInfos(data, reply);
681 EXPECT_EQ(ERR_NONE, res);
682 }
683
684 /**
685 * @tc.name: HandleClearMainSessions
686 * @tc.desc: test function : HandleClearMainSessions
687 * @tc.type: FUNC
688 */
689 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearMainSessions, Function | SmallTest | Level1)
690 {
691 MessageParcel data;
692 MessageParcel reply;
693 std::vector<int32_t> persistentIds = {1, 2, 3};
694 data.WriteInt32Vector(persistentIds);
695 auto res = sceneSessionManagerLiteStub_->
696 SceneSessionManagerLiteStub::HandleClearMainSessions(data, reply);
697 EXPECT_EQ(ERR_NONE, res);
698 }
699
700 /**
701 * @tc.name: HandleGetWindowStyleType
702 * @tc.desc: test function : HandleGetWindowStyleType
703 * @tc.type: FUNC
704 */
705 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetWindowStyleType, Function | SmallTest | Level1)
706 {
707 MessageParcel data;
708 MessageParcel reply;
709 auto res = sceneSessionManagerLiteStub_->
710 SceneSessionManagerLiteStub::HandleGetWindowStyleType(data, reply);
711 EXPECT_EQ(ERR_NONE, res);
712 }
713
714 /**
715 * @tc.name: HandleTerminateSessionByPersistentId
716 * @tc.desc: test function : HandleTerminateSessionByPersistentId
717 * @tc.type: FUNC
718 */
719 HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionByPersistentId, Function | SmallTest | Level1)
720 {
721 MessageParcel data;
722 MessageParcel reply;
723 int32_t persistentId = 1;
724 data.WriteInt32(persistentId);
725 auto res = sceneSessionManagerLiteStub_->
726 SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(data, reply);
727 EXPECT_EQ(ERR_NONE, res);
728 }
729
730 /**
731 * @tc.name: HandleCloseTargetFloatWindow
732 * @tc.desc: test function : HandleCloseTargetFloatWindow
733 * @tc.type: FUNC
734 */
735 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCloseTargetFloatWindow, Function | SmallTest | Level1)
736 {
737 MessageParcel data;
738 MessageParcel reply;
739 data.WriteString("test");
740 auto res = sceneSessionManagerLiteStub_->
741 SceneSessionManagerLiteStub::HandleCloseTargetFloatWindow(data, reply);
742 EXPECT_EQ(ERR_NONE, res);
743 }
744
745 /**
746 * @tc.name: HandleCloseTargetPiPWindow
747 * @tc.desc: test function : HandleCloseTargetPiPWindow
748 * @tc.type: FUNC
749 */
750 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCloseTargetPiPWindow, Function | SmallTest | Level1)
751 {
752 MessageParcel data;
753 MessageParcel reply;
754 auto res = sceneSessionManagerLiteStub_->
755 SceneSessionManagerLiteStub::HandleCloseTargetPiPWindow(data, reply);
756 EXPECT_EQ(ERR_NONE, res);
757 }
758
759 /**
760 * @tc.name: HandleGetCurrentPiPWindowInfo
761 * @tc.desc: test function : HandleGetCurrentPiPWindowInfo
762 * @tc.type: FUNC
763 */
764 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetCurrentPiPWindowInfo, Function | SmallTest | Level1)
765 {
766 MessageParcel data;
767 MessageParcel reply;
768 auto res = sceneSessionManagerLiteStub_->
769 SceneSessionManagerLiteStub::HandleGetCurrentPiPWindowInfo(data, reply);
770 EXPECT_EQ(ERR_NONE, res);
771 }
772
773 /**
774 * @tc.name: HandleNotifyAppUseControlList
775 * @tc.desc: test function : HandleNotifyAppUseControlList
776 * @tc.type: FUNC
777 */
778 HWTEST_F(SceneSessionManagerLiteStubTest, HandleNotifyAppUseControlList, Function | SmallTest | Level1)
779 {
780 MessageParcel data;
781 MessageParcel reply;
782 uint8_t typeId = 1;
783 int32_t userId = 1;
784 int32_t size = 1;
785 std::string bundleName = "appbundleName";
786 int32_t appIndex = 1;
787 bool isControl = true;
788
789 data.WriteUint8(typeId);
790 data.WriteInt32(userId);
791 data.WriteInt32(size);
792 data.WriteString(bundleName);
793 data.WriteInt32(appIndex);
794 data.WriteBool(isControl);
795
796 auto res = sceneSessionManagerLiteStub_->
797 SceneSessionManagerLiteStub::HandleNotifyAppUseControlList(data, reply);
798 EXPECT_EQ(ERR_NONE, res);
799 }
800
801 /**
802 * @tc.name: HandleGetRootMainWindowId
803 * @tc.desc: test function : HandleGetRootMainWindowId
804 * @tc.type: FUNC
805 */
806 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetRootMainWindowId, Function | SmallTest | Level1)
807 {
808 MessageParcel data;
809 MessageParcel reply;
810 int32_t persistentId = 1;
811 data.WriteInt32(persistentId);
812 auto res = sceneSessionManagerLiteStub_->
813 SceneSessionManagerLiteStub::HandleGetRootMainWindowId(data, reply);
814 EXPECT_EQ(ERR_NONE, res);
815 }
816
817 /**
818 * @tc.name: HandleMinimizeMainSession
819 * @tc.desc: test function : HandleMinimizeMainSession
820 * @tc.type: FUNC
821 */
822 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMinimizeMainSession, Function | SmallTest | Level1)
823 {
824 MessageParcel data;
825 MessageParcel reply;
826 std::string bundleName = "appbundleName";
827 int32_t appIndex = 1;
828 int32_t userId = 1;
829
830 data.WriteString(bundleName);
831 data.WriteInt32(appIndex);
832 data.WriteInt32(userId);
833
834 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleMinimizeMainSession(data, reply);
835 EXPECT_EQ(ERR_NONE, res);
836 }
837
838 /**
839 * @tc.name: HandleLockSessionByAbilityInfo
840 * @tc.desc: test function : HandleLockSessionByAbilityInfo
841 * @tc.type: FUNC
842 */
843 HWTEST_F(SceneSessionManagerLiteStubTest, HandleLockSessionByAbilityInfo, Function | SmallTest | Level1)
844 {
845 MessageParcel data;
846 MessageParcel reply;
847 std::string bundleName = "appbundleName";
848 std::string moduleName = "moduleName";
849 std::string abilityName = "abilityName";
850 int32_t appIndex = 0;
851 bool isLock = true;
852
853 data.WriteString(bundleName);
854 data.WriteString(moduleName);
855 data.WriteString(abilityName);
856 data.WriteInt32(appIndex);
857 data.WriteBool(isLock);
858
859 auto res =
860 sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleLockSessionByAbilityInfo(data, reply);
861 EXPECT_EQ(ERR_NONE, res);
862 }
863 }
864 }
865 }