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 "iremote_object_mocker.h"
20 #include "session_manager/include/zidl/scene_session_manager_lite_stub.h"
21 #include "session_manager/include/zidl/session_router_stack_listener_stub.h"
22
23 using namespace testing;
24 using namespace testing::ext;
25
26 namespace OHOS {
27 namespace Rosen {
28 class MockSceneSessionManagerLiteStub : public SceneSessionManagerLiteStub {
SetSessionLabel(const sptr<IRemoteObject> & token,const std::string & label)29 WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) override
30 {
31 return WSError::WS_OK;
32 }
SetSessionIcon(const sptr<IRemoteObject> & token,const std::shared_ptr<Media::PixelMap> & icon)33 WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) override
34 {
35 return WSError::WS_OK;
36 }
IsValidSessionIds(const std::vector<int32_t> & sessionIds,std::vector<bool> & results)37 WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) override
38 {
39 return WSError::WS_OK;
40 }
PendingSessionToForeground(const sptr<IRemoteObject> & token)41 WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) override
42 {
43 return WSError::WS_OK;
44 }
PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject> & token,bool shouldBackToCaller)45 WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token, bool shouldBackToCaller) override
46 {
47 return WSError::WS_OK;
48 }
GetFocusSessionToken(sptr<IRemoteObject> & token,DisplayId displayId)49 WSError GetFocusSessionToken(sptr<IRemoteObject>& token, DisplayId displayId) override
50 {
51 return WSError::WS_OK;
52 }
GetFocusSessionElement(AppExecFwk::ElementName & element,DisplayId displayId)53 WSError GetFocusSessionElement(AppExecFwk::ElementName& element, DisplayId displayId) override
54 {
55 return WSError::WS_OK;
56 }
IsFocusWindowParent(const sptr<IRemoteObject> & token,bool & isParent)57 WSError IsFocusWindowParent(const sptr<IRemoteObject>& token, bool& isParent) override
58 {
59 return WSError::WS_OK;
60 }
RegisterSessionListener(const sptr<ISessionListener> & listener,bool isRecover=false)61 WSError RegisterSessionListener(const sptr<ISessionListener>& listener, bool isRecover = false) override
62 {
63 return WSError::WS_OK;
64 }
UnRegisterSessionListener(const sptr<ISessionListener> & listener)65 WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) override
66 {
67 return WSError::WS_OK;
68 }
GetSessionInfos(const std::string & deviceId,int32_t numMax,std::vector<SessionInfoBean> & sessionInfos)69 WSError GetSessionInfos(const std::string& deviceId,
70 int32_t numMax,
71 std::vector<SessionInfoBean>& sessionInfos) override
72 {
73 return WSError::WS_OK;
74 }
GetMainWindowStatesByPid(int32_t pid,std::vector<MainWindowState> & windowStates)75 WSError GetMainWindowStatesByPid(int32_t pid, std::vector<MainWindowState>& windowStates) override
76 {
77 return WSError::WS_OK;
78 }
GetSessionInfo(const std::string & deviceId,int32_t persistentId,SessionInfoBean & sessionInfo)79 WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) override
80 {
81 return WSError::WS_OK;
82 }
GetSessionInfoByContinueSessionId(const std::string & continueSessionId,SessionInfoBean & sessionInfo)83 WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId,
84 SessionInfoBean& sessionInfo) override
85 {
86 return WSError::WS_OK;
87 }
SetSessionContinueState(const sptr<IRemoteObject> & token,const ContinueState & continueState)88 WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) override
89 {
90 return WSError::WS_OK;
91 }
TerminateSessionNew(const sptr<AAFwk::SessionInfo> info,bool needStartCaller,bool isFromBroker=false)92 WSError TerminateSessionNew(const sptr<AAFwk::SessionInfo> info,
93 bool needStartCaller,
94 bool isFromBroker = false) override
95 {
96 return WSError::WS_OK;
97 }
GetSessionSnapshot(const std::string & deviceId,int32_t persistentId,SessionSnapshot & snapshot,bool isLowResolution)98 WSError GetSessionSnapshot(const std::string& deviceId,
99 int32_t persistentId,
100 SessionSnapshot& snapshot,
101 bool isLowResolution) override
102 {
103 return WSError::WS_OK;
104 }
ClearSession(int32_t persistentId)105 WSError ClearSession(int32_t persistentId) override
106 {
107 return WSError::WS_OK;
108 }
ClearAllSessions()109 WSError ClearAllSessions() override
110 {
111 return WSError::WS_OK;
112 }
LockSession(int32_t sessionId)113 WSError LockSession(int32_t sessionId) override
114 {
115 return WSError::WS_OK;
116 }
UnlockSession(int32_t sessionId)117 WSError UnlockSession(int32_t sessionId) override
118 {
119 return WSError::WS_OK;
120 }
MoveSessionsToForeground(const std::vector<std::int32_t> & sessionIds,int32_t topSessionId)121 WSError MoveSessionsToForeground(const std::vector<std::int32_t>& sessionIds, int32_t topSessionId) override
122 {
123 return WSError::WS_OK;
124 }
MoveSessionsToBackground(const std::vector<std::int32_t> & sessionIds,std::vector<std::int32_t> & result)125 WSError MoveSessionsToBackground(const std::vector<std::int32_t>& sessionIds,
126 std::vector<std::int32_t>& result) override
127 {
128 return WSError::WS_OK;
129 }
RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)130 WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
131 const sptr<IWindowManagerAgent>& windowManagerAgent) override
132 {
133 return WMError::WM_OK;
134 }
UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)135 WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
136 const sptr<IWindowManagerAgent>& windowManagerAgent) override
137 {
138 return WMError::WM_OK;
139 }
ListWindowInfo(const WindowInfoOption & windowInfoOption,std::vector<sptr<WindowInfo>> & infos)140 WMError ListWindowInfo(const WindowInfoOption& windowInfoOption, std::vector<sptr<WindowInfo>>& infos) override
141 {
142 return WMError::WM_OK;
143 }
GetFocusWindowInfo(FocusChangeInfo & focusInfo,DisplayId displayId)144 void GetFocusWindowInfo(FocusChangeInfo& focusInfo, DisplayId displayId) override {}
CheckWindowId(int32_t windowId,int32_t & pid)145 WMError CheckWindowId(int32_t windowId, int32_t& pid) override
146 {
147 return WMError::WM_OK;
148 }
UpdateWindowModeByIdForUITest(int32_t windowId,int32_t updateMode)149 WMError UpdateWindowModeByIdForUITest(int32_t windowId, int32_t updateMode) override
150 {
151 return WMError::WM_OK;
152 }
GetMainWindowInfos(int32_t topNum,std::vector<MainWindowInfo> & topNInfo)153 WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) override
154 {
155 MainWindowInfo mainWindowInfo;
156 topNInfo.push_back(mainWindowInfo);
157 return WMError::WM_OK;
158 }
GetAllMainWindowInfos(std::vector<MainWindowInfo> & infos)159 WMError GetAllMainWindowInfos(std::vector<MainWindowInfo>& infos) override
160 {
161 MainWindowInfo mainWindowInfo;
162 infos.push_back(mainWindowInfo);
163 return WMError::WM_OK;
164 }
GetCallingWindowInfo(CallingWindowInfo & callingWindowInfo)165 WMError GetCallingWindowInfo(CallingWindowInfo& callingWindowInfo) override
166 {
167 return WMError::WM_OK;
168 }
ClearMainSessions(const std::vector<int32_t> & persistentIds,std::vector<int32_t> & clearFailedIds)169 WMError ClearMainSessions(const std::vector<int32_t>& persistentIds, std::vector<int32_t>& clearFailedIds) override
170 {
171 clearFailedIds.push_back(1);
172 return WMError::WM_OK;
173 }
RaiseWindowToTop(int32_t persistentId)174 WSError RaiseWindowToTop(int32_t persistentId) override
175 {
176 return WSError::WS_OK;
177 }
RegisterIAbilityManagerCollaborator(int32_t type,const sptr<AAFwk::IAbilityManagerCollaborator> & impl)178 WSError RegisterIAbilityManagerCollaborator(int32_t type,
179 const sptr<AAFwk::IAbilityManagerCollaborator>& impl) override
180 {
181 return WSError::WS_OK;
182 }
UnregisterIAbilityManagerCollaborator(int32_t type)183 WSError UnregisterIAbilityManagerCollaborator(int32_t type) override
184 {
185 return WSError::WS_OK;
186 }
GetWindowStyleType(WindowStyleType & windowStyleType)187 WMError GetWindowStyleType(WindowStyleType& windowStyleType) override
188 {
189 return WMError::WM_OK;
190 }
TerminateSessionByPersistentId(int32_t persistentId)191 WMError TerminateSessionByPersistentId(int32_t persistentId) override
192 {
193 return WMError::WM_OK;
194 }
CloseTargetFloatWindow(const std::string & bundleName)195 WMError CloseTargetFloatWindow(const std::string& bundleName) override
196 {
197 return WMError::WM_OK;
198 }
CloseTargetPiPWindow(const std::string & bundleName)199 WMError CloseTargetPiPWindow(const std::string& bundleName) override
200 {
201 return WMError::WM_OK;
202 }
GetCurrentPiPWindowInfo(std::string & bundleName)203 WMError GetCurrentPiPWindowInfo(std::string& bundleName) override
204 {
205 bundleName = "test";
206 return WMError::WM_OK;
207 }
GetRootMainWindowId(int32_t persistentId,int32_t & hostWindowId)208 WMError GetRootMainWindowId(int32_t persistentId, int32_t& hostWindowId) override
209 {
210 return WMError::WM_OK;
211 }
GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)212 WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override
213 {
214 return WMError::WM_OK;
215 }
AsObject()216 sptr<IRemoteObject> AsObject() override
217 {
218 return nullptr;
219 }
CheckUIExtensionCreation(int32_t windowId,uint32_t tokenId,const AppExecFwk::ElementName & element,AppExecFwk::ExtensionAbilityType extensionAbilityType,int32_t & pid)220 WMError CheckUIExtensionCreation(int32_t windowId,
221 uint32_t tokenId,
222 const AppExecFwk::ElementName& element,
223 AppExecFwk::ExtensionAbilityType extensionAbilityType,
224 int32_t& pid) override
225 {
226 return WMError::WM_OK;
227 }
NotifyAppUseControlList(ControlAppType type,int32_t userId,const std::vector<AppUseControlInfo> & controlList)228 WSError NotifyAppUseControlList(ControlAppType type,
229 int32_t userId,
230 const std::vector<AppUseControlInfo>& controlList) override
231 {
232 return WSError::WS_OK;
233 }
MinimizeMainSession(const std::string & bundleName,int32_t appIndex,int32_t userId)234 WMError MinimizeMainSession(const std::string& bundleName, int32_t appIndex, int32_t userId) override
235 {
236 return WMError::WM_OK;
237 }
HasFloatingWindowForeground(const sptr<IRemoteObject> & abilityToken,bool & hasFloatingShowing)238 WMError HasFloatingWindowForeground(const sptr<IRemoteObject>& abilityToken, bool& hasFloatingShowing) override
239 {
240 return WMError::WM_OK;
241 }
LockSessionByAbilityInfo(const AbilityInfoBase & abilityInfo,bool isLock)242 WMError LockSessionByAbilityInfo(const AbilityInfoBase& abilityInfo, bool isLock) override
243 {
244 return WMError::WM_OK;
245 }
RegisterSessionLifecycleListenerByIds(const sptr<ISessionLifecycleListener> & listener,const std::vector<int32_t> & persistentIdList)246 WMError RegisterSessionLifecycleListenerByIds(const sptr<ISessionLifecycleListener>& listener,
247 const std::vector<int32_t>& persistentIdList) override
248 {
249 return WMError::WM_OK;
250 }
RegisterSessionLifecycleListenerByBundles(const sptr<ISessionLifecycleListener> & listener,const std::vector<std::string> & bundleNameList)251 WMError RegisterSessionLifecycleListenerByBundles(const sptr<ISessionLifecycleListener>& listener,
252 const std::vector<std::string>& bundleNameList) override
253 {
254 return WMError::WM_OK;
255 }
UnregisterSessionLifecycleListener(const sptr<ISessionLifecycleListener> & listener)256 WMError UnregisterSessionLifecycleListener(const sptr<ISessionLifecycleListener>& listener) override
257 {
258 return WMError::WM_OK;
259 }
GetRecentMainSessionInfoList(std::vector<RecentSessionInfo> & recentSessionInfoList)260 WSError GetRecentMainSessionInfoList(std::vector<RecentSessionInfo>& recentSessionInfoList) override
261 {
262 return WSError::WS_OK;
263 }
GetRouterStackInfo(int32_t persistentId,const sptr<ISessionRouterStackListener> & listener)264 WMError GetRouterStackInfo(int32_t persistentId, const sptr<ISessionRouterStackListener>& listener)
265 override { return WMError::WM_OK; }
PendingSessionToBackgroundByPersistentId(const int32_t persistentId,bool shouldBackToCaller)266 WSError PendingSessionToBackgroundByPersistentId(const int32_t persistentId,
267 bool shouldBackToCaller) override
268 {
269 return WSError::WS_OK;
270 }
CreateNewInstanceKey(const std::string & bundleName,std::string & instanceKey)271 WMError CreateNewInstanceKey(const std::string& bundleName, std::string& instanceKey) override
272 {
273 return WMError::WM_OK;
274 }
275
RemoveInstanceKey(const std::string & bundleName,const std::string & instanceKey)276 WMError RemoveInstanceKey(const std::string& bundleName, const std::string& instanceKey) override
277 {
278 return WMError::WM_OK;
279 }
TransferSessionToTargetScreen(const TransferSessionInfo & info)280 WMError TransferSessionToTargetScreen(const TransferSessionInfo& info) override
281 {
282 return WMError::WM_OK;
283 }
PendingSessionToBackground(const sptr<IRemoteObject> & token,const BackgroundParams & params)284 WSError PendingSessionToBackground(const sptr<IRemoteObject>& token, const BackgroundParams& params) override
285 {
286 return WSError::WS_OK;
287 }
UpdateKioskAppList(const std::vector<std::string> & kioskAppList)288 WMError UpdateKioskAppList(const std::vector<std::string>& kioskAppList) override
289 {
290 return WMError::WM_OK;
291 }
EnterKioskMode(const sptr<IRemoteObject> & token)292 WMError EnterKioskMode(const sptr<IRemoteObject>& token) override
293 {
294 return WMError::WM_OK;
295 }
ExitKioskMode(const sptr<IRemoteObject> & token)296 WMError ExitKioskMode(const sptr<IRemoteObject>& token) override
297 {
298 return WMError::WM_OK;
299 }
SendPointerEventForHover(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)300 WSError SendPointerEventForHover(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override
301 {
302 return WSError::WS_OK;
303 }
304 };
305
306 class SceneSessionManagerLiteStubTest : public testing::Test {
307 public:
308 static void SetUpTestCase();
309 static void TearDownTestCase();
310 void SetUp() override;
311 void TearDown() override;
312 sptr<SceneSessionManagerLiteStub> sceneSessionManagerLiteStub_ = nullptr;
313 };
314
SetUpTestCase()315 void SceneSessionManagerLiteStubTest::SetUpTestCase() {}
316
TearDownTestCase()317 void SceneSessionManagerLiteStubTest::TearDownTestCase() {}
318
SetUp()319 void SceneSessionManagerLiteStubTest::SetUp()
320 {
321 sceneSessionManagerLiteStub_ = sptr<MockSceneSessionManagerLiteStub>::MakeSptr();
322 EXPECT_NE(nullptr, sceneSessionManagerLiteStub_);
323 }
324
TearDown()325 void SceneSessionManagerLiteStubTest::TearDown()
326 {
327 sceneSessionManagerLiteStub_ = nullptr;
328 }
329
330 namespace {
331 /**
332 * @tc.name: OnRemoteRequest
333 * @tc.desc: test function : OnRemoteRequest
334 * @tc.type: FUNC
335 */
336 HWTEST_F(SceneSessionManagerLiteStubTest, OnRemoteRequest, TestSize.Level1)
337 {
338 uint32_t code =
339 static_cast<uint32_t>(SceneSessionManagerLiteStub::SceneSessionManagerLiteMessage::TRANS_ID_SET_SESSION_LABEL);
340 MessageParcel data;
341 MessageParcel reply;
342 MessageOption option;
343 data.WriteInterfaceToken(u"OpenHarmeny");
344 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::OnRemoteRequest(code, data, reply, option);
345 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
346 data.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
347 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::OnRemoteRequest(1000, data, reply, option);
348 EXPECT_EQ(IPC_STUB_UNKNOW_TRANS_ERR, res);
349 data.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
350 sptr<IRemoteObject> token = nullptr;
351 data.WriteRemoteObject(token);
352 data.WriteString("OnRemoteRequest UT Testing.");
353 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::OnRemoteRequest(code, data, reply, option);
354 EXPECT_EQ(ERR_NONE, res);
355 }
356
357 /**
358 * @tc.name: HandleSetSessionIcon
359 * @tc.desc: test function : HandleSetSessionIcon
360 * @tc.type: FUNC
361 */
362 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionIcon, TestSize.Level1)
363 {
364 MessageParcel data;
365 MessageParcel reply;
366 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSetSessionIcon(data, reply);
367 EXPECT_EQ(ERR_INVALID_DATA, res);
368 }
369
370 /**
371 * @tc.name: HandleIsValidSessionIds
372 * @tc.desc: test function : HandleIsValidSessionIds
373 * @tc.type: FUNC
374 */
375 HWTEST_F(SceneSessionManagerLiteStubTest, HandleIsValidSessionIds, TestSize.Level1)
376 {
377 MessageParcel data;
378 MessageParcel reply;
379 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleIsValidSessionIds(data, reply);
380 EXPECT_EQ(ERR_NONE, res);
381 }
382
383 /**
384 * @tc.name: HandlePendingSessionToForeground
385 * @tc.desc: test function : HandlePendingSessionToForeground
386 * @tc.type: FUNC
387 */
388 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToForeground, TestSize.Level1)
389 {
390 MessageParcel data;
391 MessageParcel reply;
392 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandlePendingSessionToForeground(data, reply);
393 EXPECT_EQ(ERR_INVALID_DATA, res);
394 }
395
396 /**
397 * @tc.name: HandlePendingSessionToBackgroundForDelegator
398 * @tc.desc: test function : HandlePendingSessionToBackgroundForDelegator
399 * @tc.type: FUNC
400 */
401 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToBackgroundForDelegator, TestSize.Level1)
402 {
403 MessageParcel data;
404 MessageParcel reply;
405 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandlePendingSessionToBackgroundForDelegator(
406 data, reply);
407 EXPECT_EQ(ERR_INVALID_DATA, res);
408 }
409
410 /**
411 * @tc.name: HandleRegisterSessionListener
412 * @tc.desc: test function : HandleRegisterSessionListener
413 * @tc.type: FUNC
414 */
415 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterSessionListener, TestSize.Level1)
416 {
417 MessageParcel data;
418 MessageParcel reply;
419 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterSessionListener(data, reply);
420 EXPECT_EQ(ERR_NONE, res);
421 }
422
423 /**
424 * @tc.name: HandleUnRegisterSessionListener
425 * @tc.desc: test function : HandleUnRegisterSessionListener
426 * @tc.type: FUNC
427 */
428 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnRegisterSessionListener, TestSize.Level1)
429 {
430 MessageParcel data;
431 MessageParcel reply;
432 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleUnRegisterSessionListener(data, reply);
433 EXPECT_EQ(ERR_NONE, res);
434 }
435
436 /**
437 * @tc.name: HandleGetSessionInfos
438 * @tc.desc: test function : HandleGetSessionInfos
439 * @tc.type: FUNC
440 */
441 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfos, TestSize.Level1)
442 {
443 MessageParcel data;
444 MessageParcel reply;
445 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleUnRegisterSessionListener(data, reply);
446 EXPECT_EQ(ERR_NONE, res);
447 }
448
449 /**
450 * @tc.name: HandleGetMainWindowStatesByPid
451 * @tc.desc: test function : HandleGetMainWindowStatesByPid
452 * @tc.type: FUNC
453 */
454 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetMainWindowStatesByPid, TestSize.Level1)
455 {
456 MessageParcel data;
457 MessageParcel reply;
458 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetMainWindowStatesByPid(data, reply);
459 EXPECT_EQ(res, ERR_INVALID_DATA);
460 }
461
462 /**
463 * @tc.name: HandleGetSessionInfo
464 * @tc.desc: test function : HandleGetSessionInfo
465 * @tc.type: FUNC
466 */
467 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfo, TestSize.Level1)
468 {
469 MessageParcel data;
470 MessageParcel reply;
471
472 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
473 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
474
475 std::u16string deviceIdU16 = u"testDeviceId";
476 data.WriteString16(deviceIdU16);
477 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
478 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
479
480 int32_t persistentId = 0;
481 data.WriteString16(deviceIdU16);
482 data.WriteInt32(persistentId);
483 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
484 EXPECT_EQ(ERR_NONE, res);
485 }
486
487 /**
488 * @tc.name: HandleGetSessionInfoByContinueSessionId
489 * @tc.desc: test function : HandleGetSessionInfoByContinueSessionId
490 * @tc.type: FUNC
491 */
492 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfoByContinueSessionId, TestSize.Level1)
493 {
494 MessageParcel data;
495 MessageParcel reply;
496
497 auto res =
498 sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(data, reply);
499 EXPECT_EQ(ERR_INVALID_DATA, res);
500
501 std::string continueSessionId = "testSessionId";
502 data.WriteString(continueSessionId);
503 res =
504 sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(data, reply);
505 EXPECT_EQ(ERR_NONE, res);
506 }
507
508 /**
509 * @tc.name: HandleTerminateSessionNew
510 * @tc.desc: test function : HandleTerminateSessionNew
511 * @tc.type: FUNC
512 */
513 HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionNew, TestSize.Level1)
514 {
515 MessageParcel data;
516 MessageParcel reply;
517 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleTerminateSessionNew(data, reply);
518 EXPECT_EQ(ERR_INVALID_DATA, res);
519 }
520
521 /**
522 * @tc.name: HandleGetFocusSessionToken
523 * @tc.desc: test function : HandleGetFocusSessionToken
524 * @tc.type: FUNC
525 */
526 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionToken, TestSize.Level1)
527 {
528 MessageParcel data;
529 MessageParcel reply;
530 data.WriteUint64(0);
531 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetFocusSessionToken(data, reply);
532 EXPECT_EQ(ERR_NONE, res);
533 }
534
535 /**
536 * @tc.name: HandleGetFocusSessionToken1
537 * @tc.desc: test function : HandleGetFocusSessionToken
538 * @tc.type: FUNC
539 */
540 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionToken1, TestSize.Level1)
541 {
542 MessageParcel data;
543 MessageParcel reply;
544 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetFocusSessionToken(data, reply);
545 EXPECT_EQ(ERR_INVALID_DATA, res);
546 }
547
548 /**
549 * @tc.name: HandleGetFocusSessionElement
550 * @tc.desc: test function : HandleGetFocusSessionElement
551 * @tc.type: FUNC
552 */
553 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionElement, TestSize.Level1)
554 {
555 MessageParcel data;
556 MessageParcel reply;
557 data.WriteUint64(0);
558 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetFocusSessionElement(data, reply);
559 EXPECT_EQ(ERR_NONE, res);
560 }
561
562 /**
563 * @tc.name: HandleGetFocusSessionElement1
564 * @tc.desc: test function : HandleGetFocusSessionElement
565 * @tc.type: FUNC
566 */
567 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionElement1, TestSize.Level1)
568 {
569 MessageParcel data;
570 MessageParcel reply;
571 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetFocusSessionElement(data, reply);
572 EXPECT_EQ(ERR_INVALID_DATA, res);
573 }
574
575 /**
576 * @tc.name: HandleIsFocusWindowParent
577 * @tc.desc: test function : HandleIsFocusWindowParent
578 * @tc.type: FUNC
579 */
580 HWTEST_F(SceneSessionManagerLiteStubTest, HandleIsFocusWindowParent, TestSize.Level1)
581 {
582 MessageParcel data;
583 MessageParcel reply;
584 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleIsFocusWindowParent(data, reply);
585 EXPECT_EQ(ERR_INVALID_DATA, res);
586 const sptr<IRemoteObject> token = sptr<MockIRemoteObject>::MakeSptr();
587 data.WriteRemoteObject(token);
588 EXPECT_EQ(ERR_NONE, res);
589 }
590
591 /**
592 * @tc.name: HandleSetSessionContinueState
593 * @tc.desc: test function : HandleSetSessionContinueState
594 * @tc.type: FUNC
595 */
596 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState, TestSize.Level1)
597 {
598 MessageParcel data;
599 MessageParcel reply;
600
601 sptr<IRemoteObject> token = nullptr;
602 data.WriteRemoteObject(token);
603 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
604 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
605
606 int32_t continueStateValue = -3;
607 data.WriteRemoteObject(token);
608 data.WriteInt32(continueStateValue);
609 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
610 EXPECT_EQ(ERR_INVALID_DATA, res);
611
612 continueStateValue = 1;
613 data.WriteRemoteObject(token);
614 data.WriteInt32(continueStateValue);
615 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
616 EXPECT_EQ(ERR_NONE, res);
617 }
618
619 /**
620 * @tc.name: HandleSetSessionContinueState1
621 * @tc.desc: test function : HandleSetSessionContinueState
622 * @tc.type: FUNC
623 */
624 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState1, TestSize.Level1)
625 {
626 MessageParcel data;
627 MessageParcel reply;
628 data.WriteRemoteObject(nullptr);
629 data.WriteInt32(-2);
630 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
631 EXPECT_EQ(res, ERR_INVALID_DATA);
632 }
633
634 /**
635 * @tc.name: HandleSetSessionContinueState2
636 * @tc.desc: test function : HandleSetSessionContinueState
637 * @tc.type: FUNC
638 */
639 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState2, TestSize.Level1)
640 {
641 MessageParcel data;
642 MessageParcel reply;
643 sptr<IRemoteObject> token = nullptr;
644 data.WriteRemoteObject(token);
645 data.WriteInt32(static_cast<int32_t>(ContinueState::CONTINUESTATE_MAX));
646 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
647 EXPECT_EQ(res, ERR_NONE);
648 uint32_t writtenError;
649 EXPECT_TRUE(reply.ReadUint32(writtenError));
650 EXPECT_EQ(writtenError, static_cast<uint32_t>(ERR_NONE));
651 }
652
653 /**
654 * @tc.name: HandleGetSessionSnapshot
655 * @tc.desc: test function : HandleGetSessionSnapshot
656 * @tc.type: FUNC
657 */
658 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionSnapshot, TestSize.Level1)
659 {
660 MessageParcel data;
661 MessageParcel reply;
662 const std::u16string deviceId = static_cast<std::u16string>(u"123");
663 data.WriteString16(deviceId);
664 const std::int32_t persistentId = 1;
665 data.WriteInt32(persistentId);
666 const bool isLowResolution = true;
667 data.WriteBool(isLowResolution);
668 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetSessionSnapshot(data, reply);
669 EXPECT_EQ(ERR_NONE, res);
670 }
671
672 /**
673 * @tc.name: HandleClearSession
674 * @tc.desc: test function : HandleClearSession
675 * @tc.type: FUNC
676 */
677 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearSession, TestSize.Level1)
678 {
679 MessageParcel data;
680 MessageParcel reply;
681
682 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleClearSession(data, reply);
683 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
684
685 int32_t persistentId = 0;
686 data.WriteInt32(persistentId);
687 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleClearSession(data, reply);
688 EXPECT_EQ(ERR_NONE, res);
689 }
690
691 /**
692 * @tc.name: HandleClearAllSessions
693 * @tc.desc: test function : HandleClearAllSessions
694 * @tc.type: FUNC
695 */
696 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearAllSessions, TestSize.Level1)
697 {
698 MessageParcel data;
699 MessageParcel reply;
700 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleClearAllSessions(data, reply);
701 EXPECT_EQ(ERR_NONE, res);
702 }
703
704 /**
705 * @tc.name: HandleLockSession
706 * @tc.desc: test function : HandleLockSession
707 * @tc.type: FUNC
708 */
709 HWTEST_F(SceneSessionManagerLiteStubTest, HandleLockSession, TestSize.Level1)
710 {
711 MessageParcel data;
712 MessageParcel reply;
713
714 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleLockSession(data, reply);
715 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
716
717 int32_t persistentId = 0;
718 data.WriteInt32(persistentId);
719 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleLockSession(data, reply);
720 EXPECT_EQ(ERR_NONE, res);
721 }
722
723 /**
724 * @tc.name: HandleUnlockSession
725 * @tc.desc: test function : HandleUnlockSession
726 * @tc.type: FUNC
727 */
728 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnlockSession, TestSize.Level1)
729 {
730 MessageParcel data;
731 MessageParcel reply;
732
733 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleUnlockSession(data, reply);
734 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
735
736 int32_t sessionId = 0;
737 data.WriteInt32(sessionId);
738 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleUnlockSession(data, reply);
739 EXPECT_EQ(ERR_NONE, res);
740 }
741
742 /**
743 * @tc.name: HandleMoveSessionsToForeground
744 * @tc.desc: test function : HandleMoveSessionsToForeground
745 * @tc.type: FUNC
746 */
747 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToForeground, TestSize.Level1)
748 {
749 MessageParcel data;
750 MessageParcel reply;
751
752 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
753 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
754
755 std::vector<int32_t> sessionIds;
756 sessionIds.push_back(0);
757 data.WriteInt32Vector(sessionIds);
758 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
759 EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
760
761 int32_t topSessionId = 0;
762 data.WriteInt32Vector(sessionIds);
763 data.WriteInt32(topSessionId);
764 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
765 EXPECT_EQ(ERR_NONE, res);
766 }
767
768 /**
769 * @tc.name: HandleMoveSessionsToBackground
770 * @tc.desc: test function : HandleMoveSessionsToBackground
771 * @tc.type: FUNC
772 */
773 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToBackground, TestSize.Level1)
774 {
775 MessageParcel data;
776 MessageParcel reply;
777 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleMoveSessionsToBackground(data, reply);
778 EXPECT_EQ(ERR_NONE, res);
779 }
780
781 /**
782 * @tc.name: HandleGetFocusSessionInfo
783 * @tc.desc: test function : HandleGetFocusSessionInfo
784 * @tc.type: FUNC
785 */
786 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionInfo, TestSize.Level1)
787 {
788 MessageParcel data;
789 MessageParcel reply;
790 data.WriteUint64(0);
791 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetFocusSessionInfo(data, reply);
792 EXPECT_EQ(ERR_NONE, res);
793 }
794
795 /**
796 * @tc.name: HandleGetFocusSessionInfo1
797 * @tc.desc: test function : HandleGetFocusSessionInfo
798 * @tc.type: FUNC
799 */
800 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetFocusSessionInfo1, TestSize.Level1)
801 {
802 MessageParcel data;
803 MessageParcel reply;
804 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetFocusSessionInfo(data, reply);
805 EXPECT_EQ(ERR_INVALID_DATA, res);
806 }
807
808 /**
809 * @tc.name: HandleCheckWindowId
810 * @tc.desc: test function : HandleCheckWindowId
811 * @tc.type: FUNC
812 */
813 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCheckWindowId, TestSize.Level1)
814 {
815 MessageParcel data;
816 MessageParcel reply;
817 int32_t numMax = 100;
818 data.WriteInt32(numMax);
819 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleCheckWindowId(data, reply);
820 EXPECT_EQ(ERR_NONE, res);
821 }
822
823 /**
824 * @tc.name: HandleUpdateWindowModeByIdForUITest01
825 * @tc.desc: test function : HandleUpdateWindowModeByIdForUITest
826 * @tc.type: FUNC
827 */
828 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUpdateWindowModeByIdForUITest01, TestSize.Level1)
829 {
830 MessageParcel data;
831 MessageParcel reply;
832 auto res = sceneSessionManagerLiteStub_->
833 SceneSessionManagerLiteStub::HandleUpdateWindowModeByIdForUITest(data, reply);
834 EXPECT_EQ(ERR_INVALID_DATA, res);
835
836 data.WriteInt32(1);
837 res = sceneSessionManagerLiteStub_->
838 SceneSessionManagerLiteStub::HandleUpdateWindowModeByIdForUITest(data, reply);
839 EXPECT_EQ(ERR_INVALID_DATA, res);
840
841 MessageParcel data2;
842 data2.WriteInt32(1);
843 data2.WriteInt32(2);
844 res = sceneSessionManagerLiteStub_->
845 SceneSessionManagerLiteStub::HandleUpdateWindowModeByIdForUITest(data2, reply);
846 EXPECT_EQ(ERR_NONE, res);
847 }
848
849 /**
850 * @tc.name: HandleRegisterWindowManagerAgent
851 * @tc.desc: test function : HandleRegisterWindowManagerAgent
852 * @tc.type: FUNC
853 */
854 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterWindowManagerAgent, TestSize.Level1)
855 {
856 MessageParcel data;
857 MessageParcel reply;
858 data.WriteUint32(static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS));
859 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
860 EXPECT_EQ(ERR_NONE, res);
861
862 data.WriteUint32(-100);
863 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
864 EXPECT_EQ(ERR_INVALID_DATA, res);
865
866 data.WriteUint32(100);
867 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
868 EXPECT_EQ(ERR_INVALID_DATA, res);
869
870 data.WriteUint32(5);
871 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
872 EXPECT_EQ(ERR_NONE, res);
873 }
874
875 /**
876 * @tc.name: HandleUnregisterWindowManagerAgent
877 * @tc.desc: test function : HandleUnregisterWindowManagerAgent
878 * @tc.type: FUNC
879 */
880 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnregisterWindowManagerAgent, TestSize.Level1)
881 {
882 MessageParcel data;
883 MessageParcel reply;
884 data.WriteUint32(static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS));
885 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
886 EXPECT_EQ(ERR_NONE, res);
887
888 data.WriteUint32(-100);
889 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
890 EXPECT_EQ(ERR_INVALID_DATA, res);
891
892 data.WriteUint32(100);
893 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
894 EXPECT_EQ(ERR_INVALID_DATA, res);
895
896 data.WriteUint32(5);
897 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
898 EXPECT_EQ(ERR_NONE, res);
899 }
900
901 /**
902 * @tc.name: HandleListWindowInfo
903 * @tc.desc: test function : HandleListWindowInfo
904 * @tc.type: FUNC
905 */
906 HWTEST_F(SceneSessionManagerLiteStubTest, HandleListWindowInfo, TestSize.Level1)
907 {
908 MessageParcel data;
909 MessageParcel reply;
910 DisplayId displayId = 0;
911 int32_t windowId = 0;
912 data.WriteUint8(static_cast<WindowInfoFilterOptionDataType>(WindowInfoFilterOption::ALL));
913 data.WriteUint8(static_cast<WindowInfoTypeOptionDataType>(WindowInfoTypeOption::ALL));
914 data.WriteUint64(displayId);
915 data.WriteInt32(windowId);
916 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleListWindowInfo(data, reply);
917 EXPECT_EQ(ERR_NONE, res);
918 }
919
920 /**
921 * @tc.name: HandleGetVisibilityWindowInfo
922 * @tc.desc: test function : HandleGetVisibilityWindowInfo
923 * @tc.type: FUNC
924 */
925 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetVisibilityWindowInfo, TestSize.Level1)
926 {
927 MessageParcel data;
928 MessageParcel reply;
929 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetVisibilityWindowInfo(data, reply);
930 EXPECT_EQ(ERR_NONE, res);
931 }
932
933 /**
934 * @tc.name: HandleGetMainWinodowInfo
935 * @tc.desc: test function : HandleGetMainWinodowInfo
936 * @tc.type: FUNC
937 */
938 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetMainWinodowInfo, TestSize.Level1)
939 {
940 MessageParcel data;
941 MessageParcel reply;
942 int32_t numMax = 100;
943 data.WriteInt32(numMax);
944 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetMainWinodowInfo(data, reply);
945 EXPECT_EQ(ERR_NONE, res);
946 }
947
948 /**
949 * @tc.name: HandleGetAllMainWindowInfos
950 * @tc.desc: test function : HandleGetAllMainWindowInfos
951 * @tc.type: FUNC
952 */
953 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetAllMainWindowInfos, TestSize.Level1)
954 {
955 MessageParcel data;
956 MessageParcel reply;
957 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetAllMainWindowInfos(data, reply);
958 EXPECT_EQ(ERR_NONE, res);
959 }
960
961 /**
962 * @tc.name: HandleClearMainSessions
963 * @tc.desc: test function : HandleClearMainSessions
964 * @tc.type: FUNC
965 */
966 HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearMainSessions, TestSize.Level1)
967 {
968 MessageParcel data;
969 MessageParcel reply;
970 std::vector<int32_t> persistentIds = { 1, 2, 3 };
971 data.WriteInt32Vector(persistentIds);
972 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleClearMainSessions(data, reply);
973 EXPECT_EQ(ERR_NONE, res);
974 }
975
976 /**
977 * @tc.name: HandleRaiseWindowToTop
978 * @tc.desc: test function : HandleRaiseWindowToTop
979 * @tc.type: FUNC
980 */
981 HWTEST_F(SceneSessionManagerLiteStubTest, HandleRaiseWindowToTop, TestSize.Level1)
982 {
983 MessageParcel data;
984 MessageParcel reply;
985 int32_t persistentId = 65535;
986 data.WriteInt32(persistentId);
987 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleRaiseWindowToTop(data, reply);
988 EXPECT_EQ(ERR_NONE, res);
989 }
990
991 /**
992 * @tc.name: HandleTerminateSessionByPersistentId
993 * @tc.desc: test function : HandleTerminateSessionByPersistentId
994 * @tc.type: FUNC
995 */
996 HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionByPersistentId, TestSize.Level1)
997 {
998 MessageParcel data;
999 MessageParcel reply;
1000
1001 auto res =
1002 sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(data, reply);
1003 EXPECT_EQ(ERR_INVALID_DATA, res);
1004
1005 int32_t persistentId = 1;
1006 data.WriteInt32(persistentId);
1007 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(data, reply);
1008 EXPECT_EQ(ERR_NONE, res);
1009 }
1010
1011 /**
1012 * @tc.name: HandleGetWindowStyleType
1013 * @tc.desc: test function : HandleGetWindowStyleType
1014 * @tc.type: FUNC
1015 */
1016 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetWindowStyleType, TestSize.Level1)
1017 {
1018 MessageParcel data;
1019 MessageParcel reply;
1020 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetWindowStyleType(data, reply);
1021 EXPECT_EQ(ERR_NONE, res);
1022 }
1023
1024 /**
1025 * @tc.name: HandleCloseTargetFloatWindow
1026 * @tc.desc: test function : HandleCloseTargetFloatWindow
1027 * @tc.type: FUNC
1028 */
1029 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCloseTargetFloatWindow, TestSize.Level1)
1030 {
1031 MessageParcel data;
1032 MessageParcel reply;
1033 data.WriteString("test");
1034 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleCloseTargetFloatWindow(data, reply);
1035 EXPECT_EQ(ERR_NONE, res);
1036 }
1037
1038 /**
1039 * @tc.name: HandleCloseTargetPiPWindow
1040 * @tc.desc: test function : HandleCloseTargetPiPWindow
1041 * @tc.type: FUNC
1042 */
1043 HWTEST_F(SceneSessionManagerLiteStubTest, HandleCloseTargetPiPWindow, TestSize.Level1)
1044 {
1045 MessageParcel data;
1046 MessageParcel reply;
1047 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleCloseTargetPiPWindow(data, reply);
1048 EXPECT_EQ(ERR_NONE, res);
1049 }
1050
1051 /**
1052 * @tc.name: HandleGetCurrentPiPWindowInfo
1053 * @tc.desc: test function : HandleGetCurrentPiPWindowInfo
1054 * @tc.type: FUNC
1055 */
1056 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetCurrentPiPWindowInfo, TestSize.Level1)
1057 {
1058 MessageParcel data;
1059 MessageParcel reply;
1060 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetCurrentPiPWindowInfo(data, reply);
1061 EXPECT_EQ(ERR_NONE, res);
1062 }
1063
1064 /**
1065 * @tc.name: HandleGetRouterStackInfo
1066 * @tc.desc: test function : HandleGetRouterStackInfo
1067 * @tc.type: FUNC
1068 */
1069 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetRouterStackInfo, TestSize.Level1)
1070 {
1071 MessageParcel data;
1072 MessageParcel reply;
1073 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetRouterStackInfo(data, reply);
1074 EXPECT_EQ(ERR_INVALID_DATA, res);
1075
1076 data.WriteInt32(1);
1077 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetRouterStackInfo(data, reply);
1078 EXPECT_EQ(ERR_INVALID_DATA, res);
1079 }
1080
1081 /**
1082 * @tc.name: HandleGetRootMainWindowId
1083 * @tc.desc: test function : HandleGetRootMainWindowId
1084 * @tc.type: FUNC
1085 */
1086 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetRootMainWindowId, TestSize.Level1)
1087 {
1088 MessageParcel data;
1089 MessageParcel reply;
1090 int32_t persistentId = 1;
1091 data.WriteInt32(persistentId);
1092 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleGetRootMainWindowId(data, reply);
1093 EXPECT_EQ(ERR_NONE, res);
1094 }
1095
1096 /**
1097 * @tc.name: HandleNotifyAppUseControlList
1098 * @tc.desc: test function : HandleNotifyAppUseControlList
1099 * @tc.type: FUNC
1100 */
1101 HWTEST_F(SceneSessionManagerLiteStubTest, HandleNotifyAppUseControlList, TestSize.Level1)
1102 {
1103 MessageParcel data;
1104 MessageParcel reply;
1105 uint8_t typeId = 1;
1106 int32_t userId = 1;
1107 int32_t size = 1;
1108 std::string bundleName = "appbundleName";
1109 int32_t appIndex = 1;
1110 bool isControl = true;
1111
1112 data.WriteUint8(typeId);
1113 data.WriteInt32(userId);
1114 data.WriteInt32(size);
1115 data.WriteString(bundleName);
1116 data.WriteInt32(appIndex);
1117 data.WriteBool(isControl);
1118
1119 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleNotifyAppUseControlList(data, reply);
1120 EXPECT_EQ(ERR_NONE, res);
1121 }
1122
1123 /**
1124 * @tc.name: HandleMinimizeMainSession
1125 * @tc.desc: test function : HandleMinimizeMainSession
1126 * @tc.type: FUNC
1127 */
1128 HWTEST_F(SceneSessionManagerLiteStubTest, HandleMinimizeMainSession, TestSize.Level1)
1129 {
1130 MessageParcel data;
1131 MessageParcel reply;
1132 std::string bundleName = "appbundleName";
1133 int32_t appIndex = 1;
1134 int32_t userId = 1;
1135
1136 data.WriteString(bundleName);
1137 data.WriteInt32(appIndex);
1138 data.WriteInt32(userId);
1139
1140 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleMinimizeMainSession(data, reply);
1141 EXPECT_EQ(ERR_NONE, res);
1142 }
1143
1144 /**
1145 * @tc.name: HandleLockSessionByAbilityInfo
1146 * @tc.desc: test function : HandleLockSessionByAbilityInfo
1147 * @tc.type: FUNC
1148 */
1149 HWTEST_F(SceneSessionManagerLiteStubTest, HandleLockSessionByAbilityInfo, TestSize.Level1)
1150 {
1151 MessageParcel data;
1152 MessageParcel reply;
1153 std::string bundleName = "appbundleName";
1154 std::string moduleName = "moduleName";
1155 std::string abilityName = "abilityName";
1156 int32_t appIndex = 0;
1157 bool isLock = true;
1158
1159 data.WriteString(bundleName);
1160 data.WriteString(moduleName);
1161 data.WriteString(abilityName);
1162 data.WriteInt32(appIndex);
1163 data.WriteBool(isLock);
1164
1165 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleLockSessionByAbilityInfo(data, reply);
1166 EXPECT_EQ(ERR_NONE, res);
1167 }
1168
1169 /**
1170 * @tc.name: HandleGetRecentMainSessionInfoList
1171 * @tc.desc: test function : HandleGetRecentMainSessionInfoList
1172 * @tc.type: FUNC
1173 */
1174 HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetRecentMainSessionInfoList, Function | SmallTest | Level1)
1175 {
1176 MessageParcel data;
1177 MessageParcel reply;
1178 auto res = sceneSessionManagerLiteStub_->
1179 SceneSessionManagerLiteStub::HandleGetRecentMainSessionInfoList(data, reply);
1180 EXPECT_EQ(ERR_NONE, res);
1181 }
1182
1183 /**
1184 * @tc.name: HandlePendingSessionToBackgroundByPersistentId
1185 * @tc.desc: test function : HandlePendingSessionToBackgroundByPersistentId
1186 * @tc.type: FUNC
1187 */
1188 HWTEST_F(SceneSessionManagerLiteStubTest, HandlePendingSessionToBackgroundByPersistentId, TestSize.Level1)
1189 {
1190 MessageParcel data;
1191 MessageParcel reply;
1192 auto res = sceneSessionManagerLiteStub_->
1193 SceneSessionManagerLiteStub::HandlePendingSessionToBackgroundByPersistentId(data, reply);
1194 EXPECT_EQ(ERR_INVALID_DATA, res);
1195
1196 data.WriteInt32(1);
1197 res = sceneSessionManagerLiteStub_->
1198 SceneSessionManagerLiteStub::HandlePendingSessionToBackgroundByPersistentId(data, reply);
1199 EXPECT_EQ(ERR_INVALID_DATA, res);
1200
1201 MessageParcel data2;
1202 data2.WriteInt32(1);
1203 data2.WriteBool(true);
1204 res = sceneSessionManagerLiteStub_->
1205 SceneSessionManagerLiteStub::HandlePendingSessionToBackgroundByPersistentId(data2, reply);
1206 EXPECT_EQ(ERR_NONE, res);
1207 }
1208
1209 /**
1210 * @tc.name: HandleUpdateKioskAppList
1211 * @tc.desc: test function : HandleUpdateKioskAppList
1212 * @tc.type: FUNC
1213 */
1214 HWTEST_F(SceneSessionManagerLiteStubTest, HandleUpdateKioskAppList, Function | SmallTest | Level1)
1215 {
1216 MessageParcel data;
1217 MessageParcel reply;
1218 auto res = sceneSessionManagerLiteStub_->
1219 SceneSessionManagerLiteStub::HandleUpdateKioskAppList(data, reply);
1220 EXPECT_EQ(ERR_NONE, res);
1221 }
1222
1223 /**
1224 * @tc.name: HandleEnterKioskMode
1225 * @tc.desc: test function : HandleEnterKioskMode
1226 * @tc.type: FUNC
1227 */
1228 HWTEST_F(SceneSessionManagerLiteStubTest, HandleEnterKioskMode, Function | SmallTest | Level1)
1229 {
1230 MessageParcel data;
1231 MessageParcel reply;
1232 const sptr<IRemoteObject> token = sptr<MockIRemoteObject>::MakeSptr();
1233 data.WriteRemoteObject(token);
1234 auto res = sceneSessionManagerLiteStub_->
1235 SceneSessionManagerLiteStub::HandleEnterKioskMode(data, reply);
1236 EXPECT_EQ(ERR_NONE, res);
1237 }
1238
1239 /**
1240 * @tc.name: HandleExitKioskMode
1241 * @tc.desc: test function : HandleExitKioskMode
1242 * @tc.type: FUNC
1243 */
1244 HWTEST_F(SceneSessionManagerLiteStubTest, HandleExitKioskMode, Function | SmallTest | Level1)
1245 {
1246 MessageParcel data;
1247 MessageParcel reply;
1248 const sptr<IRemoteObject> token = sptr<MockIRemoteObject>::MakeSptr();
1249 data.WriteRemoteObject(token);
1250 auto res = sceneSessionManagerLiteStub_->
1251 SceneSessionManagerLiteStub::HandleExitKioskMode(data, reply);
1252 EXPECT_EQ(ERR_NONE, res);
1253 }
1254
1255 /**
1256 * @tc.name: ProcessRemoteRequest
1257 * @tc.desc: ProcessRemoteRequest TRANS_ID_SEND_POINTER_EVENT_FOR_HOVER
1258 * @tc.type: FUNC
1259 */
1260 HWTEST_F(SceneSessionManagerLiteStubTest, ProcessRemoteRequest_Hover, Function | SmallTest | Level1)
1261 {
1262 MessageParcel data;
1263 MessageParcel reply;
1264 MessageOption option = { MessageOption::TF_SYNC };
1265 const sptr<IRemoteObject> token = sptr<MockIRemoteObject>::MakeSptr();
1266 data.WriteRemoteObject(token);
1267 uint32_t code = static_cast<uint32_t>(
1268 ISceneSessionManagerLite::SceneSessionManagerLiteMessage::TRANS_ID_SEND_POINTER_EVENT_FOR_HOVER);
1269 auto res = sceneSessionManagerLiteStub_->
1270 SceneSessionManagerLiteStub::ProcessRemoteRequest(code, data, reply, option);
1271 EXPECT_EQ(ERR_INVALID_DATA, res);
1272 }
1273
1274 /**
1275 * @tc.name: HandleSendPointerEventForHover
1276 * @tc.desc: HandleSendPointerEventForHover
1277 * @tc.type: FUNC
1278 */
1279 HWTEST_F(SceneSessionManagerLiteStubTest, HandleSendPointerEventForHover, Function | SmallTest | Level1)
1280 {
1281 MessageParcel data;
1282 MessageParcel reply;
1283 sptr<IRemoteObject> token = sptr<MockIRemoteObject>::MakeSptr();
1284 data.WriteRemoteObject(token);
1285 auto res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSendPointerEventForHover(data, reply);
1286 EXPECT_EQ(ERR_INVALID_DATA, res);
1287
1288 std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
1289 pointerEvent->WriteToParcel(data);
1290 res = sceneSessionManagerLiteStub_->SceneSessionManagerLiteStub::HandleSendPointerEventForHover(data, reply);
1291 EXPECT_EQ(ERR_NONE, res);
1292 }
1293 } // namespace
1294 } // namespace Rosen
1295 } // namespace OHOS