• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #define BUFF_SIZE 100
17 #include "drag_server_test.h"
18 #include "ddm_adapter.h"
19 #include "devicestatus_service.h"
20 #include "drag_data_manager.h"
21 #include "drag_data_packer.h"
22 #include "drag_data_util.h"
23 #include "drag_server.h"
24 #include "event_hub.h"
25 #include "interaction_manager.h"
26 #include "ipc_skeleton.h"
27 #include "singleton.h"
28 
29 #include "accesstoken_kit.h"
30 #include "nativetoken_kit.h"
31 #include "token_setproc.h"
32 
33 namespace OHOS {
34 namespace Msdp {
35 namespace DeviceStatus {
36 using namespace testing::ext;
37 namespace {
38 constexpr int32_t TIME_WAIT_FOR_OP_MS { 20 };
39 constexpr int32_t PIXEL_MAP_WIDTH { 3 };
40 constexpr int32_t PIXEL_MAP_HEIGHT { 3 };
41 constexpr int32_t WINDOW_ID { -1 };
42 constexpr int32_t READ_OK { 1 };
43 constexpr uint32_t DEFAULT_ICON_COLOR { 0xFF };
44 const std::string FILTER_INFO { "Undefined filter info" };
45 const std::string UD_KEY { "Unified data key" };
46 const std::string EXTRA_INFO { "Undefined extra info" };
47 const std::string CURVE_NAME { "cubic-bezier" };
48 constexpr int32_t FOREGROUND_COLOR_IN { 0x33FF0000 };
49 constexpr int32_t FOREGROUND_COLOR_OUT { 0x00000000 };
50 constexpr int32_t DISPLAY_ID { 0 };
51 constexpr int32_t DISPLAY_X { 50 };
52 constexpr int32_t DISPLAY_Y { 50 };
53 constexpr int32_t INT32_BYTE { 4 };
54 #ifdef OHOS_BUILD_INTERNAL_DROP_ANIMATION
55 constexpr int32_t MAX_ANIMATION_INFO_LENGTH { 1024 };
56 #endif // OHOS_BUILD_INTERNAL_DROP_ANIMATION
57 int32_t g_shadowinfo_x { 0 };
58 int32_t g_shadowinfo_y { 0 };
59 ContextService *g_instance = nullptr;
60 DelegateTasks g_delegateTasks;
61 DeviceManager g_devMgr;
62 TimerManager g_timerMgr;
63 DragManager g_dragMgr;
64 SocketSessionManager g_socketSessionMgr;
65 std::unique_ptr<IInputAdapter> g_input { nullptr };
66 std::unique_ptr<IPluginManager> g_pluginMgr { nullptr };
67 std::unique_ptr<IDSoftbusAdapter> g_dsoftbus { nullptr };
68 constexpr int32_t ANIMATION_DURATION { 500 };
69 constexpr int32_t MAX_PIXEL_MAP_WIDTH { 600 };
70 constexpr int32_t MAX_PIXEL_MAP_HEIGHT { 600 };
71 constexpr bool HAS_CANCELED_ANIMATION { true };
72 constexpr bool HAS_CUSTOM_ANIMATION { true };
73 Intention g_intention { Intention::UNKNOWN_INTENTION };
74 std::shared_ptr<DragServer> g_dragServer { nullptr };
75 std::shared_ptr<DragServer> g_dragServerOne { nullptr };
76 IContext *g_context { nullptr };
77 IContext *g_contextOne { nullptr };
78 Security::AccessToken::HapInfoParams g_testInfoParms = {
79     .userID = 1,
80     .bundleName = "drag_server_test",
81     .instIndex = 0,
82     .appIDDesc = "test"
83 };
84 
85 Security::AccessToken::HapPolicyParams g_testPolicyPrams = {
86     .apl = Security::AccessToken::APL_NORMAL,
87     .domain = "test.domain",
88     .permList = {},
89     .permStateList = {}
90 };
91 } // namespace
92 
ContextService()93 ContextService::ContextService()
94 {
95     ddm_ = std::make_unique<DDMAdapter>();
96 }
97 
~ContextService()98 ContextService::~ContextService()
99 {
100 }
101 
GetDelegateTasks()102 IDelegateTasks& ContextService::GetDelegateTasks()
103 {
104     return g_delegateTasks;
105 }
106 
GetDeviceManager()107 IDeviceManager& ContextService::GetDeviceManager()
108 {
109     return g_devMgr;
110 }
111 
GetTimerManager()112 ITimerManager& ContextService::GetTimerManager()
113 {
114     return g_timerMgr;
115 }
116 
GetDragManager()117 IDragManager& ContextService::GetDragManager()
118 {
119     return g_dragMgr;
120 }
121 
GetInstance()122 ContextService* ContextService::GetInstance()
123 {
124     static std::once_flag flag;
125     std::call_once(flag, [&]() {
126         ContextService *cooContext = new (std::nothrow) ContextService();
127         CHKPL(cooContext);
128         g_instance = cooContext;
129     });
130     return g_instance;
131 }
132 
GetSocketSessionManager()133 ISocketSessionManager& ContextService::GetSocketSessionManager()
134 {
135     return g_socketSessionMgr;
136 }
137 
GetDDM()138 IDDMAdapter& ContextService::GetDDM()
139 {
140     return *ddm_;
141 }
142 
GetPluginManager()143 IPluginManager& ContextService::GetPluginManager()
144 {
145     return *g_pluginMgr;
146 }
147 
GetInput()148 IInputAdapter& ContextService::GetInput()
149 {
150     return *g_input;
151 }
152 
GetDSoftbus()153 IDSoftbusAdapter& ContextService::GetDSoftbus()
154 {
155     return *g_dsoftbus;
156 }
157 
SetUpTestCase()158 void DragServerTest::SetUpTestCase() {}
159 
SetUp()160 void DragServerTest::SetUp()
161 {
162     g_context = ContextService::GetInstance();
163     g_dragServer = std::make_shared<DragServer>(g_context);
164     g_dragServerOne = std::make_shared<DragServer>(g_contextOne);
165 }
166 
TearDown()167 void DragServerTest::TearDown()
168 {
169     g_dragServer = nullptr;
170     g_context = nullptr;
171     g_dragServerOne = nullptr;
172     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP_MS));
173 }
174 
CreatePixelMap(int32_t width,int32_t height)175 std::shared_ptr<Media::PixelMap> DragServerTest::CreatePixelMap(int32_t width, int32_t height)
176 {
177     CALL_DEBUG_ENTER;
178     if (width <= 0 || width > MAX_PIXEL_MAP_WIDTH || height <= 0 || height > MAX_PIXEL_MAP_HEIGHT) {
179         FI_HILOGE("invalid, height:%{public}d, width:%{public}d", height, width);
180         return nullptr;
181     }
182     Media::InitializationOptions opts;
183     opts.size.width = width;
184     opts.size.height = height;
185     opts.pixelFormat = Media::PixelFormat::BGRA_8888;
186     opts.alphaType = Media::AlphaType::IMAGE_ALPHA_TYPE_OPAQUE;
187     opts.scaleMode = Media::ScaleMode::FIT_TARGET_SIZE;
188 
189     int32_t colorLen = width * height;
190     uint32_t *pixelColors = new (std::nothrow) uint32_t[BUFF_SIZE];
191     CHKPP(pixelColors);
192     int32_t colorByteCount = colorLen * INT32_BYTE;
193     errno_t ret = memset_s(pixelColors, BUFF_SIZE, DEFAULT_ICON_COLOR, colorByteCount);
194     if (ret != EOK) {
195         FI_HILOGE("memset_s failed");
196         delete[] pixelColors;
197         return nullptr;
198     }
199     std::shared_ptr<Media::PixelMap> pixelMap = Media::PixelMap::Create(pixelColors, colorLen, opts);
200     if (pixelMap == nullptr) {
201         FI_HILOGE("Create pixelMap failed");
202         delete[] pixelColors;
203         return nullptr;
204     }
205     delete[] pixelColors;
206     return pixelMap;
207 }
208 
CreateDragData(int32_t sourceType,int32_t pointerId,int32_t dragNum,bool hasCoordinateCorrected,int32_t shadowNum)209 std::optional<DragData> DragServerTest::CreateDragData(int32_t sourceType,
210     int32_t pointerId, int32_t dragNum, bool hasCoordinateCorrected, int32_t shadowNum)
211 {
212     CALL_DEBUG_ENTER;
213     DragData dragData;
214     for (int32_t i = 0; i < shadowNum; i++) {
215         std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(PIXEL_MAP_WIDTH, PIXEL_MAP_HEIGHT);
216         if (pixelMap == nullptr) {
217             FI_HILOGE("pixelMap nullptr");
218             return std::nullopt;
219         }
220         dragData.shadowInfos.push_back({ pixelMap, g_shadowinfo_x, g_shadowinfo_y });
221     }
222     dragData.buffer = std::vector<uint8_t>(MAX_BUFFER_SIZE, 0);
223     dragData.extraInfo = FILTER_INFO;
224     dragData.udKey = UD_KEY;
225     dragData.sourceType = sourceType;
226     dragData.extraInfo = EXTRA_INFO;
227     dragData.displayId = DISPLAY_ID;
228     dragData.pointerId = pointerId;
229     dragData.dragNum = dragNum;
230     dragData.displayX = DISPLAY_X;
231     dragData.displayY = DISPLAY_Y;
232     dragData.hasCoordinateCorrected = hasCoordinateCorrected;
233     dragData.hasCanceledAnimation = HAS_CANCELED_ANIMATION;
234     return dragData;
235 }
236 
NativeTokenGet()237 uint64_t NativeTokenGet()
238 {
239     uint64_t tokenId;
240     NativeTokenInfoParams infoInstance = {
241         .dcapsNum = 0,
242         .permsNum = 0,
243         .aclsNum = 0,
244         .dcaps = nullptr,
245         .perms = nullptr,
246         .acls = nullptr,
247         .aplStr = "system_basic",
248     };
249 
250     infoInstance.processName = " DragServerTest";
251     tokenId = GetAccessTokenId(&infoInstance);
252     SetSelfTokenID(tokenId);
253     OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
254     return tokenId;
255 }
256 class TestStartDragListener : public IStartDragListener {
257 public:
TestStartDragListener(std::function<void (const DragNotifyMsg &)> function)258     explicit TestStartDragListener(std::function<void(const DragNotifyMsg&)> function) : function_(function) { }
OnDragEndMessage(const DragNotifyMsg & msg)259     void OnDragEndMessage(const DragNotifyMsg &msg) override
260     {
261         FI_HILOGD("DisplayX:%{public}d, displayY:%{public}d, targetPid:%{public}d, result:%{public}d",
262             msg.displayX, msg.displayY, msg.targetPid, static_cast<int32_t>(msg.result));
263         if (function_ != nullptr) {
264             function_(msg);
265         }
266         FI_HILOGD("Test OnDragEndMessage");
267     }
268 
OnHideIconMessage()269     void OnHideIconMessage() override
270     {
271         FI_HILOGD("Test OnHideIconMessage");
272     }
273 private:
274     std::function<void(const DragNotifyMsg&)> function_;
275 };
276 
277 class DragListenerTest : public IDragListener {
278 public:
DragListenerTest()279     DragListenerTest() {}
DragListenerTest(const std::string & name)280     explicit DragListenerTest(const std::string& name) : moduleName_(name) {}
OnDragMessage(DragState state)281     void OnDragMessage(DragState state) override
282     {
283         if (moduleName_.empty()) {
284             moduleName_ = std::string("DragListenerTest");
285         }
286         FI_HILOGD("%{public}s, state:%{public}s", moduleName_.c_str(), PrintDragMessage(state).c_str());
287     }
288 private:
PrintDragMessage(DragState state)289     std::string PrintDragMessage(DragState state)
290     {
291         std::string type = "unknow";
292         const std::map<DragState, std::string> stateType = {
293             { DragState::ERROR, "error"},
294             { DragState::START, "start"},
295             { DragState::STOP, "stop"},
296             { DragState::CANCEL, "cancel"}
297         };
298         auto item = stateType.find(state);
299         if (item != stateType.end()) {
300             type = item->second;
301         }
302         return type;
303     }
304 private:
305     std::string moduleName_;
306 };
307 
AssignToAnimation(PreviewAnimation & animation)308 void DragServerTest::AssignToAnimation(PreviewAnimation &animation)
309 {
310     animation.duration = ANIMATION_DURATION;
311     animation.curveName = CURVE_NAME;
312     animation.curve = { 0.33, 0, 0.67, 1 };
313 }
314 
315 /**
316  * @tc.name: DragServerTest1
317  * @tc.desc: Drag Drawing
318  * @tc.type: FUNC
319  * @tc.require:
320  */
321 HWTEST_F(DragServerTest, DragServerTest1, TestSize.Level0)
322 {
323     CALL_TEST_DEBUG;
324     bool visible = false;
325     bool isForce = false;
326     const std::shared_ptr<Rosen::RSTransaction>& rsTransaction { nullptr };
327     int32_t ret = g_dragServer->SetDragWindowVisible(visible, isForce, rsTransaction);
328     EXPECT_EQ(ret, RET_ERR);
329 }
330 
331 /**
332  * @tc.name: DragServerTest2
333  * @tc.desc: Drag Drawing
334  * @tc.type: FUNC
335  * @tc.require:
336  */
337 HWTEST_F(DragServerTest, DragServerTest2, TestSize.Level0)
338 {
339     CALL_TEST_DEBUG;
340     CallingContext context {
341         .intention = g_intention,
342         .tokenId = IPCSkeleton::GetCallingTokenID(),
343         .uid = IPCSkeleton::GetCallingUid(),
344         .pid = IPCSkeleton::GetCallingPid(),
345     };
346     int32_t eventId = -1;
347     int32_t ret = g_dragServer->UpdateDragStyle(context, DragCursorStyle::DEFAULT, eventId);
348     EXPECT_EQ(ret, RET_OK);
349 }
350 
351 /**
352  * @tc.name: DragServerTest3
353  * @tc.desc: Drag Drawing
354  * @tc.type: FUNC
355  * @tc.require:
356  */
357 HWTEST_F(DragServerTest, DragServerTest3, TestSize.Level0)
358 {
359     CALL_TEST_DEBUG;
360     ShadowInfo shadowInfo {};
361     int32_t ret = g_dragServer->UpdateShadowPic(shadowInfo);
362     EXPECT_EQ(ret, RET_ERR);
363 }
364 
365 /**
366  * @tc.name: DragServerTest4
367  * @tc.desc: Drag Drawing
368  * @tc.type: FUNC
369  * @tc.require:
370  */
371 HWTEST_F(DragServerTest, DragServerTest4, TestSize.Level0)
372 {
373     CALL_TEST_DEBUG;
374     PreviewStyle previewStyleOut;
375     previewStyleOut.types = { PreviewType::FOREGROUND_COLOR };
376     previewStyleOut.foregroundColor = FOREGROUND_COLOR_OUT;
377     int32_t ret = InteractionManager::GetInstance()->UpdatePreviewStyle(previewStyleOut);
378     EXPECT_EQ(ret, RET_ERR);
379     PreviewStyle previewStyleIn;
380     previewStyleIn.types = { PreviewType::FOREGROUND_COLOR };
381     previewStyleIn.foregroundColor = FOREGROUND_COLOR_IN;
382     ret = g_dragServer->UpdatePreviewStyle(previewStyleIn);
383     EXPECT_EQ(ret, RET_ERR);
384 }
385 
386 /**
387  * @tc.name: DragServerTest5
388  * @tc.desc: Drag Drawing
389  * @tc.type: FUNC
390  * @tc.require:
391  */
392 HWTEST_F(DragServerTest, DragServerTest5, TestSize.Level0)
393 {
394     CALL_TEST_DEBUG;
395     int32_t targetPid = -1;
396     CallingContext context {
397         .intention = g_intention,
398         .tokenId = IPCSkeleton::GetCallingTokenID(),
399         .uid = IPCSkeleton::GetCallingUid(),
400         .pid = IPCSkeleton::GetCallingPid(),
401     };
402     int32_t ret = g_dragServer->GetDragTargetPid(context, targetPid);
403     EXPECT_EQ(ret, RET_OK);
404 }
405 
406 /**
407  * @tc.name: DragServerTest6
408  * @tc.desc: Drag Drawing
409  * @tc.type: FUNC
410  * @tc.require:
411  */
412 HWTEST_F(DragServerTest, DragServerTest6, TestSize.Level0)
413 {
414     CALL_TEST_DEBUG;
415     std::string udKey { "Unified data key" };
416     int32_t ret = g_dragServer->GetUdKey(udKey);
417     EXPECT_EQ(ret, RET_ERR);
418 }
419 
420 /**
421  * @tc.name: DragServerTest7
422  * @tc.desc: Drag Drawing
423  * @tc.type: FUNC
424  * @tc.require:
425  */
426 HWTEST_F(DragServerTest, DragServerTest7, TestSize.Level0)
427 {
428     CALL_TEST_DEBUG;
429     ShadowOffset defaultShadowOffset = {};
430     int32_t ret = g_dragServer->GetShadowOffset(defaultShadowOffset);
431     EXPECT_EQ(ret, RET_ERR);
432 }
433 
434 /**
435  * @tc.name: DragServerTest8
436  * @tc.desc: Drag Drawing
437  * @tc.type: FUNC
438  * @tc.require:
439  */
440 HWTEST_F(DragServerTest, DragServerTest8, TestSize.Level0)
441 {
442     CALL_TEST_DEBUG;
443     DragData datas;
444     CallingContext context {
445         .intention = g_intention,
446         .tokenId = IPCSkeleton::GetCallingTokenID(),
447         .uid = IPCSkeleton::GetCallingUid(),
448         .pid = IPCSkeleton::GetCallingPid(),
449     };
450     int32_t ret = g_dragServer->GetDragData(context, datas);
451     EXPECT_EQ(ret, RET_ERR);
452 }
453 
454 /**
455  * @tc.name: DragServerTest9
456  * @tc.desc: Drag Drawing
457  * @tc.type: FUNC
458  * @tc.require:
459  */
460 HWTEST_F(DragServerTest, DragServerTest9, TestSize.Level0)
461 {
462     CALL_TEST_DEBUG;
463     CallingContext context {
464         .intention = g_intention,
465         .tokenId = IPCSkeleton::GetCallingTokenID(),
466         .uid = IPCSkeleton::GetCallingUid(),
467         .pid = IPCSkeleton::GetCallingPid(),
468     };
469     DragState dragState;
470     int32_t ret = g_dragServer->GetDragState(context, dragState);
471     EXPECT_EQ(ret, RET_OK);
472 }
473 
474 /**
475  * @tc.name: DragServerTest_GetDragState_002
476  * @tc.desc: verify GetDragState
477  * @tc.type: FUNC
478  * @tc.require:
479  */
480 HWTEST_F(DragServerTest, DragServerTest_GetDragState_002, TestSize.Level0)
481 {
482     CALL_TEST_DEBUG;
483     CallingContext context;
484     DragState dragState;
485     int32_t ret = g_dragServer->GetDragState(context, dragState);
486     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
487 }
488 
489 /**
490  * @tc.name: DragServerTest10
491  * @tc.desc: Drag Drawing
492  * @tc.type: FUNC
493  * @tc.require:
494  */
495 HWTEST_F(DragServerTest, DragServerTest10, TestSize.Level0)
496 {
497     CALL_TEST_DEBUG;
498     CallingContext context {
499         .intention = g_intention,
500         .tokenId = IPCSkeleton::GetCallingTokenID(),
501         .uid = IPCSkeleton::GetCallingUid(),
502         .pid = IPCSkeleton::GetCallingPid(),
503     };
504     std::map<std::string, int64_t> summarys;
505     bool isJsCaller = false;
506     int32_t ret = g_dragServer->GetDragSummary(context, summarys, isJsCaller);
507     EXPECT_EQ(ret, RET_OK);
508 }
509 
510 /**
511  * @tc.name: DragServerTest11
512  * @tc.desc: Drag Drawing
513  * @tc.type: FUNC
514  * @tc.require:
515  */
516 HWTEST_F(DragServerTest, DragServerTest11, TestSize.Level0)
517 {
518     CALL_TEST_DEBUG;
519     DragAction dragAction;
520     int32_t ret = g_dragServer->GetDragAction(dragAction);
521     EXPECT_EQ(ret, RET_ERR);
522     DragAction dragAction1 { DragAction::INVALID };
523     ret = InteractionManager::GetInstance()->GetDragAction(dragAction1);
524     EXPECT_EQ(ret, RET_ERR);
525 }
526 
527 /**
528  * @tc.name: DragServerTest12
529  * @tc.desc: Drag Drawing
530  * @tc.type: FUNC
531  * @tc.require:
532  */
533 HWTEST_F(DragServerTest, DragServerTest12, TestSize.Level0)
534 {
535     CALL_TEST_DEBUG;
536     std::string extraInfo { "Undefined extra info" };
537     int32_t ret = g_dragServer->GetExtraInfo(extraInfo);
538     EXPECT_EQ(ret, RET_ERR);
539     std::string extraInfo1;
540     ret = InteractionManager::GetInstance()->GetExtraInfo(extraInfo1);
541     ASSERT_EQ(ret, RET_ERR);
542 }
543 
544 /**
545  * @tc.name: DragServerTest13
546  * @tc.desc: Drag Drawing
547  * @tc.type: FUNC
548  * @tc.require:
549  */
550 HWTEST_F(DragServerTest, DragServerTest13, TestSize.Level0)
551 {
552     CALL_TEST_DEBUG;
553     bool visible = true;
554     DRAG_DATA_MGR.SetDragWindowVisible(visible);
555     bool ret = DRAG_DATA_MGR.GetDragWindowVisible();
556     EXPECT_TRUE(ret);
557     int32_t tid = DRAG_DATA_MGR.GetTargetTid();
558     EXPECT_NE(tid, READ_OK);
559     float dragOriginDpi = DRAG_DATA_MGR.GetDragOriginDpi();
560     EXPECT_TRUE(dragOriginDpi == 0.0f);
561 }
562 
563 /**
564  * @tc.name: DragServerTest14
565  * @tc.desc: Drag Drawing
566  * @tc.type: FUNC
567  * @tc.require:
568  */
569 HWTEST_F(DragServerTest, DragServerTest14, TestSize.Level0)
570 {
571     CALL_TEST_DEBUG;
572     DRAG_DATA_MGR.SetTextEditorAreaFlag(true);
573     DRAG_DATA_MGR.SetPixelMapLocation({1, 1});
574     bool ret = DRAG_DATA_MGR.GetCoordinateCorrected();
575     EXPECT_FALSE(ret);
576 }
577 
578 /**
579  * @tc.name: DragServerTest15
580  * @tc.desc: Drag Drawing
581  * @tc.type: FUNC
582  * @tc.require:
583  */
584 HWTEST_F(DragServerTest, DragServerTest15, TestSize.Level0)
585 {
586     CALL_TEST_DEBUG;
587     DRAG_DATA_MGR.initialPixelMapLocation_ = {1, 1};
588     DRAG_DATA_MGR.SetInitialPixelMapLocation(DRAG_DATA_MGR.GetInitialPixelMapLocation());
589     DRAG_DATA_MGR.SetDragOriginDpi(1);
590     bool ret = DRAG_DATA_MGR.GetTextEditorAreaFlag();
591     EXPECT_TRUE(ret);
592 }
593 
594 /**
595  * @tc.name: DragServerTest16
596  * @tc.desc: Drag Drawing
597  * @tc.type: FUNC
598  * @tc.require:
599  */
600 HWTEST_F(DragServerTest, DragServerTest16, TestSize.Level0)
601 {
602     CALL_TEST_DEBUG;
603     CallingContext context {
604         .intention = g_intention,
605         .tokenId = IPCSkeleton::GetCallingTokenID(),
606         .uid = IPCSkeleton::GetCallingUid(),
607         .pid = IPCSkeleton::GetCallingPid(),
608     };
609     const std::shared_ptr<Rosen::RSTransaction> rsTransaction;
610     int32_t ret = g_dragServer->RotateDragWindowSync(context, rsTransaction);
611     EXPECT_EQ(ret, RET_ERR);
612 }
613 
614 /**
615  * @tc.name: DragServerTest17
616  * @tc.desc: Drag Drawing
617  * @tc.type: FUNC
618  * @tc.require:
619  */
620 HWTEST_F(DragServerTest, DragServerTest17, TestSize.Level0)
621 {
622     CALL_TEST_DEBUG;
623     uint64_t g_tokenId = NativeTokenGet();
624     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
625     CallingContext context {
626         .intention = g_intention,
627         .tokenId = IPCSkeleton::GetCallingTokenID(),
628         .uid = IPCSkeleton::GetCallingUid(),
629         .pid = IPCSkeleton::GetCallingPid(),
630     };
631     MessageParcel reply;
632     MessageParcel datas;
633     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
634     bool ret = g_dragServer->IsSystemHAPCalling(context);
635     EXPECT_TRUE(ret);
636     OHOS::Security::AccessToken::AccessTokenKit::DeleteToken(g_tokenId);
637 }
638 
639 /**
640  * @tc.name: DragServerTest18
641  * @tc.desc: Drag Drawing
642  * @tc.type: FUNC
643  * @tc.require:
644  */
645 HWTEST_F(DragServerTest, DragServerTest18, TestSize.Level0)
646 {
647     CALL_TEST_DEBUG;
648     Security::AccessToken::AccessTokenIDEx tokenIdEx = {0};
649     tokenIdEx = Security::AccessToken::AccessTokenKit::AllocHapToken(g_testInfoParms, g_testPolicyPrams);
650     EXPECT_EQ(0, SetSelfTokenID(tokenIdEx.tokenIdExStruct.tokenID));
651     auto g_tokenId1 = tokenIdEx.tokenIdExStruct.tokenID;
652     CallingContext context {
653         .intention = g_intention,
654         .tokenId = g_tokenId1,
655         .uid = IPCSkeleton::GetCallingUid(),
656         .pid = IPCSkeleton::GetCallingPid(),
657     };
658     MessageParcel reply;
659     MessageParcel datas;
660     g_dragServer->GetPackageName(g_tokenId1);
661     bool ret = g_dragServer->IsSystemHAPCalling(context);
662     EXPECT_FALSE(ret);
663 }
664 
665 /**
666  * @tc.name: DragClientTest19
667  * @tc.desc: Drag Drawing
668  * @tc.type: FUNC
669  * @tc.require:
670  */
671 HWTEST_F(DragServerTest, DragClientTest19, TestSize.Level0)
672 {
673     CALL_TEST_DEBUG;
674     CallingContext context {
675         .intention = g_intention,
676         .tokenId = IPCSkeleton::GetCallingTokenID(),
677         .uid = IPCSkeleton::GetCallingUid(),
678         .pid = IPCSkeleton::GetCallingPid(),
679     };
680     uint16_t displayId = 0;
681     uint64_t screenId = 0;
682     int32_t ret = g_dragServer->SetDragWindowScreenId(context, displayId, screenId);
683     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
684 }
685 
686 /**
687  * @tc.name: DragServerTest20
688  * @tc.desc: Drag Drawing
689  * @tc.type: FUNC
690  * @tc.require:
691  */
692 HWTEST_F(DragServerTest, DragServerTest20, TestSize.Level0)
693 {
694     CALL_TEST_DEBUG;
695     bool state = true;
696     int32_t ret = g_dragServer->SetMouseDragMonitorState(state);
697     EXPECT_EQ(ret, RET_ERR);
698     bool state1 = false;
699     ret = g_dragServer->SetMouseDragMonitorState(state1);
700     EXPECT_EQ(ret, RET_OK);
701 }
702 
703 /**
704  * @tc.name: DragServerTest21
705  * @tc.desc: Drag Drawing
706  * @tc.type: FUNC
707  * @tc.require:
708  */
709 HWTEST_F(DragServerTest, DragServerTest21, TestSize.Level0)
710 {
711     CALL_TEST_DEBUG;
712     bool state = true;
713     int32_t ret2 = g_dragServer->SetDraggableState(state);
714     EXPECT_EQ(ret2, RET_OK);
715 }
716 
717 /**
718  * @tc.name: DragServerTest22
719  * @tc.desc: Drag Drawing
720  * @tc.type: FUNC
721  * @tc.require:
722  */
723 HWTEST_F(DragServerTest, DragServerTest22, TestSize.Level0)
724 {
725     CALL_TEST_DEBUG;
726     DragData dragData;
727     CallingContext context {
728         .intention = g_intention,
729         .tokenId = IPCSkeleton::GetCallingTokenID(),
730         .uid = IPCSkeleton::GetCallingUid(),
731         .pid = IPCSkeleton::GetCallingPid(),
732     };
733     int32_t ret = g_dragServer->StartDrag(context, dragData);
734     EXPECT_EQ(ret, RET_ERR);
735 }
736 
737 /**
738  * @tc.name: DragServerTest23
739  * @tc.desc: Drag Drawing
740  * @tc.type: FUNC
741  * @tc.require:
742  */
743 HWTEST_F(DragServerTest, DragServerTest23, TestSize.Level0)
744 {
745     CALL_TEST_DEBUG;
746     CallingContext context {
747         .intention = g_intention,
748         .tokenId = IPCSkeleton::GetCallingTokenID(),
749         .uid = IPCSkeleton::GetCallingUid(),
750         .pid = IPCSkeleton::GetCallingPid(),
751     };
752     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
753     g_dragMgr.dragState_ = DragState::START;
754     int32_t ret = g_dragServer->StopDrag(context, dropResult);
755     EXPECT_EQ(ret, RET_OK);
756     g_dragMgr.dragState_ = DragState::STOP;
757 }
758 
759 /**
760  * @tc.name: DragServerTest24
761  * @tc.desc: Drag Drawing
762  * @tc.type: FUNC
763  * @tc.require:
764  */
765 HWTEST_F(DragServerTest, DragServerTest24, TestSize.Level0)
766 {
767     CALL_TEST_DEBUG;
768     CallingContext context {
769         .intention = g_intention,
770         .tokenId = IPCSkeleton::GetCallingTokenID(),
771         .uid = IPCSkeleton::GetCallingUid(),
772         .pid = IPCSkeleton::GetCallingPid(),
773     };
774     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
775     g_dragMgr.dragState_ = DragState::START;
776     int32_t ret = g_dragServerOne->StopDrag(context, dropResult);
777     EXPECT_EQ(ret, RET_ERR);
778     g_dragMgr.dragState_ = DragState::STOP;
779 }
780 
781 /**
782  * @tc.name: DragServerTest25
783  * @tc.desc: Drag Drawing
784  * @tc.type: FUNC
785  * @tc.require:
786  */
787 HWTEST_F(DragServerTest, DragServerTest25, TestSize.Level0)
788 {
789     CALL_TEST_DEBUG;
790     CallingContext context {
791         .intention = g_intention,
792         .tokenId = IPCSkeleton::GetCallingTokenID(),
793         .uid = IPCSkeleton::GetCallingUid(),
794         .pid = IPCSkeleton::GetCallingPid(),
795     };
796     bool isJsCaller = false;
797     int32_t ret = g_dragServer->AddDraglistener(context, isJsCaller);
798     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
799 }
800 
801 /**
802  * @tc.name: DragServerTest26
803  * @tc.desc: Drag Drawing
804  * @tc.type: FUNC
805  * @tc.require:
806  */
807 HWTEST_F(DragServerTest, DragServerTest26, TestSize.Level0)
808 {
809     CALL_TEST_DEBUG;
810     CallingContext context {
811         .intention = g_intention,
812         .tokenId = IPCSkeleton::GetCallingTokenID(),
813         .uid = IPCSkeleton::GetCallingUid(),
814         .pid = IPCSkeleton::GetCallingPid(),
815     };
816     bool isJsCaller = false;
817     int32_t ret = g_dragServer->RemoveDraglistener(context, isJsCaller);
818     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
819 }
820 
821 /**
822  * @tc.name: DragServerTest27
823  * @tc.desc: Drag Drawing
824  * @tc.type: FUNC
825  * @tc.require:
826  */
827 HWTEST_F(DragServerTest, DragServerTest27, TestSize.Level0)
828 {
829     CALL_TEST_DEBUG;
830     CallingContext context {
831         .intention = g_intention,
832         .tokenId = IPCSkeleton::GetCallingTokenID(),
833         .uid = IPCSkeleton::GetCallingUid(),
834         .pid = IPCSkeleton::GetCallingPid(),
835     };
836     int32_t ret = g_dragServer->AddSubscriptListener(context);
837     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
838 }
839 
840 /**
841  * @tc.name: DragServerTest28
842  * @tc.desc: Drag Drawing
843  * @tc.type: FUNC
844  * @tc.require:
845  */
846 HWTEST_F(DragServerTest, DragServerTest28, TestSize.Level0)
847 {
848     CALL_TEST_DEBUG;
849     CallingContext context {
850         .intention = g_intention,
851         .tokenId = IPCSkeleton::GetCallingTokenID(),
852         .uid = IPCSkeleton::GetCallingUid(),
853         .pid = IPCSkeleton::GetCallingPid(),
854     };
855     int32_t ret = g_dragServer->RemoveSubscriptListener(context);
856     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
857 }
858 
859 /**
860  * @tc.name: DragServerTest29
861  * @tc.desc: Drag Drawing
862  * @tc.type: FUNC
863  * @tc.require:
864  */
865 HWTEST_F(DragServerTest, DragServerTest29, TestSize.Level0)
866 {
867     CALL_TEST_DEBUG;
868     bool state = false;
869     int64_t downTime = 1;
870     int32_t ret = g_dragServer->SetDraggableStateAsync(state, downTime);
871     EXPECT_EQ(ret, RET_OK);
872 }
873 
874 /**
875  * @tc.name: DragServerTest30
876  * @tc.desc: Drag Drawing
877  * @tc.type: FUNC
878  * @tc.require:
879  */
880 HWTEST_F(DragServerTest, DragServerTest30, TestSize.Level0)
881 {
882     CALL_TEST_DEBUG;
883     CallingContext context {
884         .intention = g_intention,
885         .tokenId = IPCSkeleton::GetCallingTokenID(),
886         .uid = IPCSkeleton::GetCallingUid(),
887         .pid = IPCSkeleton::GetCallingPid(),
888     };
889     bool enable = false;
890     bool isJsCaller = false;
891     int32_t ret = g_dragServer->SetDragSwitchState(context, enable, isJsCaller);
892     EXPECT_EQ(ret, RET_OK);
893 }
894 
895 /**
896  * @tc.name: DragServerTest31
897  * @tc.desc: Drag Drawing
898  * @tc.type: FUNC
899  * @tc.require:
900  */
901 HWTEST_F(DragServerTest, DragServerTest31, TestSize.Level0)
902 {
903     CALL_TEST_DEBUG;
904     CallingContext context {
905         .intention = g_intention,
906         .tokenId = IPCSkeleton::GetCallingTokenID(),
907         .uid = IPCSkeleton::GetCallingUid(),
908         .pid = IPCSkeleton::GetCallingPid(),
909     };
910     int32_t ret = g_dragServer->AddPrivilege(context);
911     EXPECT_EQ(ret, RET_ERR);
912 }
913 
914 /**
915  * @tc.name: DragServerTest32
916  * @tc.desc: Drag Drawing
917  * @tc.type: FUNC
918  * @tc.require:
919  */
920 HWTEST_F(DragServerTest, DragServerTest32, TestSize.Level0)
921 {
922     CALL_TEST_DEBUG;
923     CallingContext context {
924         .intention = g_intention,
925         .tokenId = IPCSkeleton::GetCallingTokenID(),
926         .uid = IPCSkeleton::GetCallingUid(),
927         .pid = IPCSkeleton::GetCallingPid(),
928     };
929     int32_t ret = g_dragServer->EraseMouseIcon(context);
930     EXPECT_EQ(ret, COMMON_NOT_SYSTEM_APP);
931 }
932 
933 /**
934  * @tc.name: DragServerTest33
935  * @tc.desc: Drag Drawing
936  * @tc.type: FUNC
937  * @tc.require:
938  */
939 HWTEST_F(DragServerTest, DragServerTest33, TestSize.Level0)
940 {
941     CALL_TEST_DEBUG;
942     CallingContext context {
943         .intention = g_intention,
944         .tokenId = IPCSkeleton::GetCallingTokenID(),
945         .uid = IPCSkeleton::GetCallingUid(),
946         .pid = IPCSkeleton::GetCallingPid(),
947     };
948     bool enable = false;
949     std::string pkgName { "Undefined name" };
950     bool isJsCaller = false;
951     int32_t ret = g_dragServer->SetAppDragSwitchState(context, enable, pkgName, isJsCaller);
952     EXPECT_EQ(ret, RET_OK);
953 }
954 
955 /**
956  * @tc.name: DragServerTest34
957  * @tc.desc: Drag Drawing
958  * @tc.type: FUNC
959  * @tc.require:
960  */
961 HWTEST_F(DragServerTest, DragServerTest34, TestSize.Level0)
962 {
963     CALL_TEST_DEBUG;
964     bool enable = false;
965     int32_t ret = g_dragServer->EnableUpperCenterMode(enable);
966     EXPECT_EQ(ret, RET_ERR);
967     bool enable1 = true;
968     int32_t ret1 = g_dragServer->EnableUpperCenterMode(enable1);
969     EXPECT_EQ(ret1, RET_ERR);
970 }
971 
972 /**
973  * @tc.name: DragServerTest35
974  * @tc.desc: Drag Drawing
975  * @tc.type: FUNC
976  * @tc.require:
977  */
978 HWTEST_F(DragServerTest, DragServerTest35, TestSize.Level0)
979 {
980     CALL_TEST_DEBUG;
981     PreviewStyle previewStyleIn;
982     previewStyleIn.types = { PreviewType::FOREGROUND_COLOR };
983     previewStyleIn.foregroundColor = FOREGROUND_COLOR_IN;
984     PreviewAnimation animationOut;
985     AssignToAnimation(animationOut);
986     int32_t ret = g_dragServer->UpdatePreviewStyleWithAnimation(previewStyleIn, animationOut);
987     EXPECT_EQ(ret, RET_ERR);
988 }
989 
990 /**
991  * @tc.name: DragServerTest57
992  * @tc.desc: Drag Drawing
993  * @tc.type: FUNC
994  * @tc.require:
995  */
996 HWTEST_F(DragServerTest, DragServerTest57, TestSize.Level0)
997 {
998     CALL_TEST_DEBUG;
999     DragBundleInfo dragBundleInfo;
1000     int32_t ret = g_dragServer->GetDragBundleInfo(dragBundleInfo);
1001     EXPECT_EQ(ret, RET_ERR);
1002 }
1003 
1004 /**
1005  * @tc.name: DragServerTest58
1006  * @tc.desc: Drag Drawing
1007  * @tc.type: FUNC
1008  * @tc.require:
1009  */
1010 HWTEST_F(DragServerTest, DragServerTest58, TestSize.Level0)
1011 {
1012     CALL_TEST_DEBUG;
1013     DragBundleInfo dragBundleInfo;
1014 
1015     g_dragMgr.dragState_ = DragState::ERROR;
1016     int32_t ret = g_dragServer->GetDragBundleInfo(dragBundleInfo);
1017     EXPECT_EQ(ret, RET_ERR);
1018 
1019     g_dragMgr.dragState_ = DragState::START;
1020     g_dragMgr.isCrossDragging_ = false;
1021     ret = g_dragServer->GetDragBundleInfo(dragBundleInfo);
1022     EXPECT_EQ(ret, RET_OK);
1023     EXPECT_FALSE(dragBundleInfo.isCrossDevice);
1024 
1025     g_dragMgr.dragState_ = DragState::MOTION_DRAGGING;
1026     g_dragMgr.isCrossDragging_ = true;
1027     ret = g_dragServer->GetDragBundleInfo(dragBundleInfo);
1028     EXPECT_EQ(ret, RET_OK);
1029     EXPECT_TRUE(dragBundleInfo.isCrossDevice);
1030 
1031     g_dragMgr.dragState_ = DragState::STOP;
1032 }
1033 
1034 /**
1035  * @tc.name: DragServerTest59
1036  * @tc.desc: Drag Drawing
1037  * @tc.type: FUNC
1038  * @tc.require:
1039  */
1040 HWTEST_F(DragServerTest, DragServerTest59, TestSize.Level0)
1041 {
1042     CALL_TEST_DEBUG;
1043     PreviewStyle previewStyleIn;
1044     previewStyleIn.types = { PreviewType::FOREGROUND_COLOR };
1045     previewStyleIn.foregroundColor = FOREGROUND_COLOR_IN;
1046     DRAG_DATA_MGR.SetPreviewStyle(previewStyleIn);
1047     PreviewStyle previewStyleIn1;
1048     previewStyleIn1 = DRAG_DATA_MGR.GetPreviewStyle();
1049     EXPECT_EQ(previewStyleIn, previewStyleIn1);
1050 }
1051 
1052 
1053 /**
1054  * @tc.name: DragServerTest60
1055  * @tc.desc: Drag Drawingx`
1056  * @tc.type: FUNC
1057  * @tc.require:
1058  */
1059 HWTEST_F(DragServerTest, DragServerTest60, TestSize.Level0)
1060 {
1061     CALL_TEST_DEBUG;
1062     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(PIXEL_MAP_WIDTH, PIXEL_MAP_HEIGHT);
1063     ASSERT_NE(pixelMap, nullptr);
1064     ShadowInfo shadowInfo = { pixelMap, 1, 0 };
1065     ShadowOffset shadowOffset;
1066     DRAG_DATA_MGR.SetShadowInfos({shadowInfo});
1067     int32_t ret = DRAG_DATA_MGR.GetShadowOffset(shadowOffset);
1068     EXPECT_EQ(ret, RET_OK);
1069 }
1070 
1071 /**
1072  * @tc.name: DragServerTest61
1073  * @tc.desc: Drag Drawingx`
1074  * @tc.type: FUNC
1075  * @tc.require:
1076  */
1077 HWTEST_F(DragServerTest, DragServerTest61, TestSize.Level0)
1078 {
1079     CALL_TEST_DEBUG;
1080     bool visible = true;
1081     DRAG_DATA_MGR.SetDragWindowVisible(visible);
1082     bool ret = DRAG_DATA_MGR.GetDragWindowVisible();
1083     EXPECT_TRUE(ret);
1084 }
1085 
1086 /**
1087  * @tc.name: DragServerTest62
1088  * @tc.desc: Drag Drawing
1089  * @tc.type: FUNC
1090  * @tc.require:
1091  */
1092 HWTEST_F(DragServerTest, DragServerTest62, TestSize.Level0)
1093 {
1094     CALL_TEST_DEBUG;
1095     uint64_t g_tokenId = NativeTokenGet();
1096     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1097     CallingContext context {
1098         .intention = g_intention,
1099         .tokenId = IPCSkeleton::GetCallingTokenID(),
1100         .uid = IPCSkeleton::GetCallingUid(),
1101         .pid = IPCSkeleton::GetCallingPid(),
1102     };
1103     MessageParcel reply;
1104     MessageParcel datas;
1105     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1106     bool ret = g_dragServer->IsSystemHAPCalling(context);
1107     EXPECT_TRUE(ret);
1108     bool isJsCaller = false;
1109     int32_t ret1 = g_dragServer->AddDraglistener(context, isJsCaller);
1110     EXPECT_EQ(ret1, RET_ERR);
1111     ret1 = g_dragServer->RemoveDraglistener(context, isJsCaller);
1112     EXPECT_EQ(ret1, RET_ERR);
1113     OHOS::Security::AccessToken::AccessTokenKit::DeleteToken(g_tokenId);
1114 }
1115 
1116 /**
1117  * @tc.name: DragServerTest63
1118  * @tc.desc: Drag Drawing
1119  * @tc.type: FUNC
1120  * @tc.require:
1121  */
1122 HWTEST_F(DragServerTest, DragServerTest63, TestSize.Level0)
1123 {
1124     CALL_TEST_DEBUG;
1125     uint64_t g_tokenId = NativeTokenGet();
1126     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1127     CallingContext context {
1128         .intention = g_intention,
1129         .tokenId = IPCSkeleton::GetCallingTokenID(),
1130         .uid = IPCSkeleton::GetCallingUid(),
1131         .pid = IPCSkeleton::GetCallingPid(),
1132     };
1133     MessageParcel reply;
1134     MessageParcel datas;
1135     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1136     bool ret = g_dragServer->IsSystemHAPCalling(context);
1137     EXPECT_TRUE(ret);
1138     int32_t ret1 = g_dragServer->AddSubscriptListener(context);
1139     EXPECT_EQ(ret1, RET_ERR);
1140     ret1 = g_dragServer->RemoveSubscriptListener(context);
1141     EXPECT_EQ(ret1, RET_ERR);
1142     OHOS::Security::AccessToken::AccessTokenKit::DeleteToken(g_tokenId);
1143 }
1144 
1145 /**
1146  * @tc.name: DragServerTest64
1147  * @tc.desc: Drag Drawing
1148  * @tc.type: FUNC
1149  * @tc.require:
1150  */
1151 HWTEST_F(DragServerTest, DragServerTest64, TestSize.Level0)
1152 {
1153     CALL_TEST_DEBUG;
1154     Security::AccessToken::AccessTokenIDEx tokenIdEx = {0};
1155     tokenIdEx = Security::AccessToken::AccessTokenKit::AllocHapToken(g_testInfoParms, g_testPolicyPrams);
1156     EXPECT_EQ(0, SetSelfTokenID(tokenIdEx.tokenIdExStruct.tokenID));
1157     auto g_tokenId1 = tokenIdEx.tokenIdExStruct.tokenID;
1158     CallingContext context {
1159         .intention = g_intention,
1160         .tokenId = g_tokenId1,
1161         .uid = IPCSkeleton::GetCallingUid(),
1162         .pid = IPCSkeleton::GetCallingPid(),
1163     };
1164     MessageParcel reply;
1165     MessageParcel datas;
1166     g_dragServer->GetPackageName(g_tokenId1);
1167     bool ret = g_dragServer->IsSystemHAPCalling(context);
1168     EXPECT_FALSE(ret);
1169     int32_t targetPid = -1;
1170     int32_t ret1 = g_dragServer->GetDragTargetPid(context, targetPid);
1171     EXPECT_EQ(ret1, COMMON_NOT_SYSTEM_APP);
1172 }
1173 
1174 /**
1175  * @tc.name: DragServerTest65
1176  * @tc.desc: Drag Drawing
1177  * @tc.type: FUNC
1178  * @tc.require:
1179  */
1180 HWTEST_F(DragServerTest, DragServerTest65, TestSize.Level0)
1181 {
1182     CALL_TEST_DEBUG;
1183     Security::AccessToken::AccessTokenIDEx tokenIdEx = {0};
1184     tokenIdEx = Security::AccessToken::AccessTokenKit::AllocHapToken(g_testInfoParms, g_testPolicyPrams);
1185     EXPECT_EQ(0, SetSelfTokenID(tokenIdEx.tokenIdExStruct.tokenID));
1186     auto g_tokenId1 = tokenIdEx.tokenIdExStruct.tokenID;
1187     CallingContext context {
1188         .intention = g_intention,
1189         .tokenId = g_tokenId1,
1190         .uid = IPCSkeleton::GetCallingUid(),
1191         .pid = IPCSkeleton::GetCallingPid(),
1192     };
1193     MessageParcel reply;
1194     MessageParcel datas;
1195     g_dragServer->GetPackageName(g_tokenId1);
1196     bool ret = g_dragServer->IsSystemHAPCalling(context);
1197     EXPECT_FALSE(ret);
1198     DragData datas1;
1199     int32_t ret1 = g_dragServer->GetDragData(context, datas1);
1200     EXPECT_EQ(ret1, COMMON_NOT_SYSTEM_APP);
1201 }
1202 
1203 /**
1204  * @tc.name: DragServerTest66
1205  * @tc.desc: Drag Drawing
1206  * @tc.type: FUNC
1207  * @tc.require:
1208  */
1209 HWTEST_F(DragServerTest, DragServerTest66, TestSize.Level0)
1210 {
1211     CALL_TEST_DEBUG;
1212     Security::AccessToken::AccessTokenIDEx tokenIdEx = {0};
1213     tokenIdEx = Security::AccessToken::AccessTokenKit::AllocHapToken(g_testInfoParms, g_testPolicyPrams);
1214     EXPECT_EQ(0, SetSelfTokenID(tokenIdEx.tokenIdExStruct.tokenID));
1215     auto g_tokenId1 = tokenIdEx.tokenIdExStruct.tokenID;
1216     CallingContext context {
1217         .intention = g_intention,
1218         .tokenId = g_tokenId1,
1219         .uid = IPCSkeleton::GetCallingUid(),
1220         .pid = IPCSkeleton::GetCallingPid(),
1221     };
1222     MessageParcel reply;
1223     MessageParcel datas;
1224     g_dragServer->GetPackageName(g_tokenId1);
1225     bool ret = g_dragServer->IsSystemHAPCalling(context);
1226     EXPECT_FALSE(ret);
1227     const std::shared_ptr<Rosen::RSTransaction> rsTransaction;
1228     int32_t ret1 = g_dragServer->RotateDragWindowSync(context, rsTransaction);
1229     EXPECT_EQ(ret1, COMMON_NOT_SYSTEM_APP);
1230 }
1231 
1232 /**
1233  * @tc.name: DragServerTest67
1234  * @tc.desc: Drag Drawing
1235  * @tc.type: FUNC
1236  * @tc.require:
1237  */
1238 HWTEST_F(DragServerTest, DragServerTest67, TestSize.Level0)
1239 {
1240     CALL_TEST_DEBUG;
1241     uint64_t g_tokenId = NativeTokenGet();
1242     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1243     CallingContext context {
1244         .intention = g_intention,
1245         .tokenId = IPCSkeleton::GetCallingTokenID(),
1246         .uid = IPCSkeleton::GetCallingUid(),
1247         .pid = IPCSkeleton::GetCallingPid(),
1248     };
1249     MessageParcel reply;
1250     MessageParcel datas;
1251     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1252     bool ret = g_dragServer->IsSystemHAPCalling(context);
1253     EXPECT_TRUE(ret);
1254     DragData datas1;
1255     uint16_t displayId = 0;
1256     uint64_t screenId = 0;
1257     int32_t ret1 = g_dragServer->SetDragWindowScreenId(context, displayId, screenId);
1258     EXPECT_EQ(ret1, RET_OK);
1259 }
1260 
1261 /**
1262  * @tc.name: DragServerTest68
1263  * @tc.desc: Drag Drawing
1264  * @tc.type: FUNC
1265  * @tc.require:
1266  */
1267 HWTEST_F(DragServerTest, DragServerTest68, TestSize.Level0)
1268 {
1269     CALL_TEST_DEBUG;
1270     CallingContext context {
1271         .intention = g_intention,
1272         .tokenId = IPCSkeleton::GetCallingTokenID(),
1273         .uid = IPCSkeleton::GetCallingUid(),
1274         .pid = IPCSkeleton::GetCallingPid(),
1275     };
1276     std::map<std::string, int64_t> summarys;
1277     bool isJsCaller = true;
1278     int32_t ret = g_dragServer->GetDragSummary(context, summarys, isJsCaller);
1279     EXPECT_EQ(ret, RET_OK);
1280 }
1281 
1282 /**
1283  * @tc.name: DragServerTest69
1284  * @tc.desc: Drag Drawing
1285  * @tc.type: FUNC
1286  * @tc.require:
1287  */
1288 HWTEST_F(DragServerTest, DragServerTest69, TestSize.Level0)
1289 {
1290     CALL_TEST_DEBUG;
1291     uint64_t g_tokenId = NativeTokenGet();
1292     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1293     CallingContext context {
1294         .intention = g_intention,
1295         .tokenId = IPCSkeleton::GetCallingTokenID(),
1296         .uid = IPCSkeleton::GetCallingUid(),
1297         .pid = IPCSkeleton::GetCallingPid(),
1298     };
1299     MessageParcel reply;
1300     MessageParcel datas;
1301     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1302     bool ret = g_dragServer->IsSystemHAPCalling(context);
1303     EXPECT_TRUE(ret);
1304     std::map<std::string, int64_t> summarys;
1305     bool isJsCaller = true;
1306     int32_t ret1 = g_dragServer->GetDragSummary(context, summarys, isJsCaller);
1307     EXPECT_EQ(ret1, RET_OK);
1308 }
1309 
1310 /**
1311  * @tc.name: DragServerTest70
1312  * @tc.desc: Drag Drawing
1313  * @tc.type: FUNC
1314  * @tc.require:
1315  */
1316 HWTEST_F(DragServerTest, DragServerTest70, TestSize.Level0)
1317 {
1318     CALL_TEST_DEBUG;
1319     Security::AccessToken::AccessTokenIDEx tokenIdEx = {0};
1320     tokenIdEx = Security::AccessToken::AccessTokenKit::AllocHapToken(g_testInfoParms, g_testPolicyPrams);
1321     EXPECT_EQ(0, SetSelfTokenID(tokenIdEx.tokenIdExStruct.tokenID));
1322     auto g_tokenId1 = tokenIdEx.tokenIdExStruct.tokenID;
1323     CallingContext context {
1324         .intention = g_intention,
1325         .tokenId = g_tokenId1,
1326         .uid = IPCSkeleton::GetCallingUid(),
1327         .pid = IPCSkeleton::GetCallingPid(),
1328     };
1329     MessageParcel reply;
1330     MessageParcel datas;
1331     g_dragServer->GetPackageName(g_tokenId1);
1332     bool ret = g_dragServer->IsSystemHAPCalling(context);
1333     EXPECT_FALSE(ret);
1334     std::map<std::string, int64_t> summarys;
1335     bool isJsCaller = true;
1336     int32_t ret1 = g_dragServer->GetDragSummary(context, summarys, isJsCaller);
1337     EXPECT_EQ(ret1, COMMON_NOT_SYSTEM_APP);
1338 }
1339 
1340 /**
1341  * @tc.name: DragServerTest71
1342  * @tc.desc: Drag Drawing
1343  * @tc.type: FUNC
1344  * @tc.require:
1345  */
1346 HWTEST_F(DragServerTest, DragServerTest71, TestSize.Level0)
1347 {
1348     CALL_TEST_DEBUG;
1349     uint64_t g_tokenId = NativeTokenGet();
1350     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1351     CallingContext context {
1352         .intention = g_intention,
1353         .tokenId = IPCSkeleton::GetCallingTokenID(),
1354         .uid = IPCSkeleton::GetCallingUid(),
1355         .pid = IPCSkeleton::GetCallingPid(),
1356     };
1357     MessageParcel reply;
1358     MessageParcel datas;
1359     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1360     bool ret = g_dragServer->IsSystemHAPCalling(context);
1361     EXPECT_TRUE(ret);
1362     int32_t ret1 = g_dragServer->EraseMouseIcon(context);
1363     EXPECT_EQ(ret1, RET_ERR);
1364 }
1365 
1366 /**
1367  * @tc.name: DragServerTest74
1368  * @tc.desc: Test
1369  * @tc.desc: Drag Drawing
1370  * @tc.type: FUNC
1371  * @tc.require:
1372  */
1373 HWTEST_F(DragServerTest, DragServerTest74, TestSize.Level0)
1374 {
1375     CALL_TEST_DEBUG;
1376     DragData dragData;
1377     dragData.displayX = DISPLAY_X;
1378     dragData.displayY = DISPLAY_Y;
1379     DRAG_DATA_MGR.Init(dragData);
1380     DRAG_DATA_MGR.SetDragStyle(DragCursorStyle::DEFAULT);
1381     EXPECT_TRUE(DRAG_DATA_MGR.GetDragStyle() == DragCursorStyle::DEFAULT);
1382     int32_t eventId = 1;
1383     DRAG_DATA_MGR.SetEventId(eventId);
1384     EXPECT_TRUE(DRAG_DATA_MGR.GetEventId() == eventId);
1385 }
1386 
1387 /**
1388  * @tc.name: DragServerTest75
1389  * @tc.desc: Test
1390  * @tc.desc: Drag Drawing
1391  * @tc.type: FUNC
1392  * @tc.require:
1393  */
1394 HWTEST_F(DragServerTest, DragServerTest75, TestSize.Level0)
1395 {
1396     CALL_TEST_DEBUG;
1397     bool isStart = false;
1398 
1399     g_dragMgr.dragState_ = DragState::ERROR;
1400     int32_t ret = g_dragServer->IsDragStart(isStart);
1401     EXPECT_EQ(ret, RET_OK);
1402     EXPECT_EQ(isStart, false);
1403 
1404     g_dragMgr.dragState_ = DragState::START;
1405     ret = g_dragServer->IsDragStart(isStart);
1406     EXPECT_EQ(ret, RET_OK);
1407     EXPECT_EQ(isStart, true);
1408 
1409     g_dragMgr.dragState_ = DragState::MOTION_DRAGGING;
1410     ret = g_dragServer->IsDragStart(isStart);
1411     EXPECT_EQ(ret, RET_OK);
1412     EXPECT_EQ(isStart, false);
1413 }
1414 
1415 #ifdef OHOS_BUILD_INTERNAL_DROP_ANIMATION
1416 /**
1417  * @tc.name: DragServerTest76
1418  * @tc.desc: Test
1419  * @tc.desc: Drag Drawing
1420  * @tc.type: FUNC
1421  * @tc.require:
1422  */
1423 HWTEST_F(DragServerTest, DragServerTest76, TestSize.Level0)
1424 {
1425     CALL_TEST_DEBUG;
1426     uint64_t g_tokenId = NativeTokenGet();
1427     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1428     CallingContext context {
1429         .intention = g_intention,
1430         .tokenId = IPCSkeleton::GetCallingTokenID(),
1431         .uid = IPCSkeleton::GetCallingUid(),
1432         .pid = IPCSkeleton::GetCallingPid(),
1433     };
1434     MessageParcel reply;
1435     MessageParcel datas;
1436     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1437     bool ret = g_dragServer->IsSystemHAPCalling(context);
1438     EXPECT_TRUE(ret);
1439     std::string animationInfo = "{\"targetPos\": [8, 8]}";
1440     int32_t ret1 = g_dragServer->EnableInternalDropAnimation(context, animationInfo);
1441     EXPECT_EQ(ret1, RET_OK);
1442 }
1443 
1444 /**
1445  * @tc.name: DragServerTest77
1446  * @tc.desc: Drag Drawing
1447  * @tc.type: FUNC
1448  * @tc.require:
1449  */
1450 HWTEST_F(DragServerTest, DragServerTest77, TestSize.Level0)
1451 {
1452     CALL_TEST_DEBUG;
1453     Security::AccessToken::AccessTokenIDEx tokenIdEx = {0};
1454     tokenIdEx = Security::AccessToken::AccessTokenKit::AllocHapToken(g_testInfoParms, g_testPolicyPrams);
1455     EXPECT_EQ(0, SetSelfTokenID(tokenIdEx.tokenIdExStruct.tokenID));
1456     auto g_tokenId1 = tokenIdEx.tokenIdExStruct.tokenID;
1457     CallingContext context {
1458         .intention = g_intention,
1459         .tokenId = g_tokenId1,
1460         .uid = IPCSkeleton::GetCallingUid(),
1461         .pid = IPCSkeleton::GetCallingPid(),
1462     };
1463     MessageParcel reply;
1464     MessageParcel datas;
1465     g_dragServer->GetPackageName(g_tokenId1);
1466     bool ret = g_dragServer->IsSystemHAPCalling(context);
1467     EXPECT_FALSE(ret);
1468     std::string animationInfo = "{\"targetPos\": [8, 8]}";
1469     int32_t ret1 = g_dragServer->EnableInternalDropAnimation(context, animationInfo);
1470     EXPECT_EQ(ret1, COMMON_NOT_SYSTEM_APP);
1471 }
1472 
1473 /**
1474  * @tc.name: DragServerTest78
1475  * @tc.desc: Test
1476  * @tc.desc: Drag Drawing
1477  * @tc.type: FUNC
1478  * @tc.require:
1479  */
1480 HWTEST_F(DragServerTest, DragServerTest78, TestSize.Level0)
1481 {
1482     CALL_TEST_DEBUG;
1483     uint64_t g_tokenId = NativeTokenGet();
1484     EXPECT_EQ(g_tokenId, IPCSkeleton::GetCallingTokenID());
1485     CallingContext context {
1486         .intention = g_intention,
1487         .tokenId = IPCSkeleton::GetCallingTokenID(),
1488         .uid = IPCSkeleton::GetCallingUid(),
1489         .pid = IPCSkeleton::GetCallingPid(),
1490     };
1491     MessageParcel reply;
1492     MessageParcel datas;
1493     g_dragServer->GetPackageName(IPCSkeleton::GetCallingTokenID());
1494     bool ret = g_dragServer->IsSystemHAPCalling(context);
1495     EXPECT_TRUE(ret);
1496     std::string animationInfo = "{}";
1497     int32_t ret1 = g_dragServer->EnableInternalDropAnimation(context, animationInfo);
1498     EXPECT_EQ(ret1, COMMON_PARAMETER_ERROR);
1499     std::string animationInfo1;
1500     ret1 = g_dragServer->EnableInternalDropAnimation(context, animationInfo1);
1501     EXPECT_EQ(ret1, COMMON_PARAMETER_ERROR);
1502     std::string animationInfo2 ="{ \"dip_scale\": 3.5, \"drag_shadow_offsetX\": 50, \"drag_shadow_offsetY\": 50, "
1503         "\"drag_shadow_argb\": 872415231, \"drag_shadow_path\": \"M 10 10 H 90 V 90 H 10 L 10 10\", "
1504 		"\"shadow_color_strategy\": 0, \"shadow_is_hardwareacceleration\": true, \"shadow_elevation\": 120, "
1505 		"\"drag_type\": \"text\", \"dip_scale\": 3.5, \"drag_shadow_offsetX\": 50, \"drag_shadow_offsetY\": 50, "
1506         "\"drag_shadow_argb\": 872415231, \"drag_shadow_path\": \"M 10 10 H 90 V 90 H 10 L 10 10\", "
1507 		"\"shadow_color_strategy\": 0, \"shadow_is_hardwareacceleration\": true, \"shadow_elevation\": 120, "
1508 		"\"drag_type\": \"text\",  \"dip_scale\": 3.5, \"drag_shadow_offsetX\": 50, \"drag_shadow_offsetY\": 50, "
1509         "\"drag_shadow_argb\": 872415231, \"drag_shadow_path\": \"M 10 10 H 90 V 90 H 10 L 10 10\", "
1510 		"\"shadow_color_strategy\": 0, \"shadow_is_hardwareacceleration\": true, \"shadow_elevation\": 120, "
1511         "\"shadow_color_strategy\": 0, \"shadow_is_hardwareacceleration\": true, \"shadow_elevation\": 120, "
1512 		"\"drag_type\": \"text\", \"shadow_enable\": true }";
1513     EXPECT_FALSE(animationInfo2.length() > MAX_ANIMATION_INFO_LENGTH);
1514     ret1 = g_dragServer->EnableInternalDropAnimation(context, animationInfo2);
1515     EXPECT_EQ(ret1, COMMON_PARAMETER_ERROR);
1516 }
1517 #endif // OHOS_BUILD_INTERNAL_DROP_ANIMATION
1518 
1519 
1520 /**
1521  * @tc.name: DragServerTest79
1522  * @tc.desc: When dragState_ is MOTION_DRAGGING, FlushDragPosition should skip execution.
1523  * @tc.type: FUNC
1524  * @tc.require:
1525  */
1526 HWTEST_F(DragServerTest, DragServerTest79, TestSize.Level0) {
1527     CALL_TEST_DEBUG;
1528     g_dragMgr.SetDragState(DragState::MOTION_DRAGGING);
1529     DragState dragState;
1530     int32_t ret = g_dragMgr.GetDragState(dragState);
1531     EXPECT_EQ(ret, RET_OK);
1532     EXPECT_EQ(dragState, DragState::MOTION_DRAGGING);
1533     g_dragMgr.dragDrawing_.dragSmoothProcessor_.InsertEvent({0, 0, -1, 0});
1534     g_dragMgr.dragDrawing_.FlushDragPosition(0);
1535     g_dragMgr.dragDrawing_.StopVSyncStation();
1536     g_dragMgr.SetDragState(DragState::STOP);
1537 }
1538 
1539 /**
1540  * @tc.name: DragServerTest80
1541  * @tc.desc: When rsUiDirector_ is nullptr, FlushDragPosition should output an error log and return.
1542  * @tc.type: FUNC
1543  * @tc.require:
1544  */
1545 HWTEST_F(DragServerTest, DragServerTest80, TestSize.Level0) {
1546     CALL_TEST_DEBUG;
1547     g_dragMgr.SetDragState(DragState::START);
1548     DragState dragState;
1549     int32_t ret = g_dragMgr.GetDragState(dragState);
1550     EXPECT_EQ(ret, RET_OK);
1551     EXPECT_EQ(dragState, DragState::START);
1552     g_dragMgr.dragDrawing_.dragSmoothProcessor_.InsertEvent({0, 0, -1, 0});
1553     g_dragMgr.dragDrawing_.FlushDragPosition(0);
1554     g_dragMgr.dragDrawing_.StopVSyncStation();
1555     g_dragMgr.SetDragState(DragState::STOP);
1556 }
1557 
1558 /**
1559  * @tc.name: DragServerTest81
1560  * @tc.desc: When DragWindowRotationFlush_ is not equal to the current rotation state.
1561  * @tc.type: FUNC
1562  * @tc.require:
1563  */
1564 HWTEST_F(DragServerTest, DragServerTest81, TestSize.Level0) {
1565     CALL_TEST_DEBUG;
1566     g_dragMgr.SetDragState(DragState::START);
1567     DragState dragState;
1568     int32_t ret = g_dragMgr.GetDragState(dragState);
1569     EXPECT_EQ(ret, RET_OK);
1570     EXPECT_EQ(dragState, DragState::START);
1571     g_dragMgr.dragDrawing_.DragWindowRotationFlush_ = Rosen::Rotation::ROTATION_90;
1572     g_dragMgr.dragDrawing_.dragSmoothProcessor_.InsertEvent({0, 0, -1, 0});
1573     g_dragMgr.dragDrawing_.FlushDragPosition(0);
1574     g_dragMgr.dragDrawing_.StopVSyncStation();
1575     Rosen::Rotation rotation = g_dragMgr.dragDrawing_.GetRotation(WINDOW_ID);
1576     EXPECT_EQ(g_dragMgr.dragDrawing_.DragWindowRotationFlush_, rotation);
1577     g_dragMgr.SetDragState(DragState::STOP);
1578 }
1579 
1580 /**
1581  * @tc.name: DragServerTest82
1582  * @tc.desc: The drag-and-drop window is controlled by drag manager.
1583  * @tc.type: FUNC
1584  * @tc.require:
1585  */
1586 HWTEST_F(DragServerTest, DragServerTest82, TestSize.Level0)
1587 {
1588     CALL_TEST_DEBUG;
1589     bool visible = true;
1590     bool isForce = false;
1591     DRAG_DATA_MGR.SetDragWindowVisible(false);
1592     const std::shared_ptr<Rosen::RSTransaction>& rsTransaction { nullptr };
1593     g_dragMgr.SetControlCollaborationVisible(false);
1594     bool collaborationVisible = g_dragMgr.GetControlCollaborationVisible();
1595     EXPECT_FALSE(collaborationVisible);
1596     g_dragMgr.SetDragState(DragState::START);
1597     DragState dragState;
1598     int32_t ret = g_dragMgr.GetDragState(dragState);
1599     EXPECT_EQ(ret, RET_OK);
1600     EXPECT_EQ(dragState, DragState::START);
1601     ret = g_dragServer->SetDragWindowVisible(visible, isForce, rsTransaction);
1602     EXPECT_EQ(ret, RET_OK);
1603     bool dragWindowVisible = DRAG_DATA_MGR.GetDragWindowVisible();
1604     EXPECT_TRUE(dragWindowVisible);
1605     g_dragMgr.SetControlCollaborationVisible(false);
1606     g_dragMgr.SetDragState(DragState::STOP);
1607 }
1608 
1609 /**
1610  * @tc.name: DragServerTest83
1611  * @tc.desc: The drag-and-drop window is controlled by drag manager.
1612  * @tc.type: FUNC
1613  * @tc.require:
1614  */
1615 HWTEST_F(DragServerTest, DragServerTest83, TestSize.Level0)
1616 {
1617     CALL_TEST_DEBUG;
1618     bool visible = true;
1619     bool isForce = true;
1620     DRAG_DATA_MGR.SetDragWindowVisible(false);
1621     const std::shared_ptr<Rosen::RSTransaction>& rsTransaction { nullptr };
1622     g_dragMgr.SetControlCollaborationVisible(false);
1623     bool collaborationVisible = g_dragMgr.GetControlCollaborationVisible();
1624     EXPECT_FALSE(collaborationVisible);
1625     g_dragMgr.SetDragState(DragState::START);
1626     DragState dragState;
1627     int32_t ret = g_dragMgr.GetDragState(dragState);
1628     EXPECT_EQ(ret, RET_OK);
1629     EXPECT_EQ(dragState, DragState::START);
1630     ret = g_dragServer->SetDragWindowVisible(visible, isForce, rsTransaction);
1631     EXPECT_EQ(ret, RET_OK);
1632     bool dragWindowVisible = DRAG_DATA_MGR.GetDragWindowVisible();
1633     EXPECT_TRUE(dragWindowVisible);
1634     g_dragMgr.SetControlCollaborationVisible(false);
1635     g_dragMgr.SetDragState(DragState::STOP);
1636 }
1637 
1638 /**
1639  * @tc.name: DragServerTest84
1640  * @tc.desc: The drag-and-drop window is controlled by multi-screen collaboration.
1641  * @tc.type: FUNC
1642  * @tc.require:
1643  */
1644 HWTEST_F(DragServerTest, DragServerTest84, TestSize.Level0)
1645 {
1646     CALL_TEST_DEBUG;
1647     bool visible = true;
1648     bool isForce = false;
1649     DRAG_DATA_MGR.SetDragWindowVisible(false);
1650     const std::shared_ptr<Rosen::RSTransaction>& rsTransaction { nullptr };
1651     g_dragMgr.SetControlCollaborationVisible(true);
1652     bool collaborationVisible = g_dragMgr.GetControlCollaborationVisible();
1653     EXPECT_TRUE(collaborationVisible);
1654     g_dragMgr.SetDragState(DragState::START);
1655     DragState dragState;
1656     int32_t ret = g_dragMgr.GetDragState(dragState);
1657     EXPECT_EQ(ret, RET_OK);
1658     EXPECT_EQ(dragState, DragState::START);
1659     ret = g_dragServer->SetDragWindowVisible(visible, isForce, rsTransaction);
1660     EXPECT_EQ(ret, RET_OK);
1661     bool dragWindowVisible = DRAG_DATA_MGR.GetDragWindowVisible();
1662     EXPECT_FALSE(dragWindowVisible);
1663     g_dragMgr.SetControlCollaborationVisible(false);
1664     g_dragMgr.SetDragState(DragState::STOP);
1665 }
1666 
1667 /**
1668  * @tc.name: DragServerTest85
1669  * @tc.desc: Drag Drawing
1670  * @tc.type: FUNC
1671  * @tc.require:
1672  */
1673 HWTEST_F(DragServerTest, DragServerTest85, TestSize.Level0)
1674 {
1675     CALL_TEST_DEBUG;
1676     g_dragMgr.dragState_ = DragState::STOP;
1677     DragSummaryInfo dragSummaryInfo;
1678     int32_t ret = g_dragServer->GetDragSummaryInfo(dragSummaryInfo);
1679     EXPECT_EQ(ret, RET_ERR);
1680 }
1681 
1682 /**
1683  * @tc.name: DragServerTest86
1684  * @tc.desc: Drag Drawing
1685  * @tc.type: FUNC
1686  * @tc.require:
1687  */
1688 HWTEST_F(DragServerTest, DragServerTest86, TestSize.Level0)
1689 {
1690     CALL_TEST_DEBUG;
1691     g_dragMgr.dragState_ = DragState::START;
1692     DragSummaryInfo dragSummaryInfo;
1693     int32_t ret = g_dragServer->GetDragSummaryInfo(dragSummaryInfo);
1694     EXPECT_EQ(ret, RET_OK);
1695     g_dragMgr.dragState_ = DragState::STOP;
1696 }
1697 
1698 /**
1699  * @tc.name: DragServerTest87
1700  * @tc.desc: Drag Drawing
1701  * @tc.type: FUNC
1702  * @tc.require:
1703  */
1704 HWTEST_F(DragServerTest, DragServerTest87, TestSize.Level1)
1705 {
1706     CALL_TEST_DEBUG;
1707     std::optional<DragData> dragData = CreateDragData(MMI::PointerEvent::SOURCE_TYPE_MOUSE, 0, 1, false, 1);
1708     ASSERT_TRUE(dragData);
1709     const std::string udType = "general.message";
1710     constexpr int64_t recordSize = 20;
1711     dragData.value().detailedSummarys = { { udType, recordSize } };
1712     Parcel parcel;
1713     int32_t ret = DragDataUtil::MarshallingDetailedSummarys(dragData.value(), parcel);
1714     ASSERT_EQ(ret, RET_OK);
1715     DragData dragDataFromParcel;
1716     ret = DragDataUtil::UnMarshallingDetailedSummarys(parcel, dragDataFromParcel);
1717     ASSERT_EQ(ret, RET_OK);
1718 }
1719 
1720 /**
1721  * @tc.name: DragServerTest88
1722  * @tc.desc: Drag Drawing
1723  * @tc.type: FUNC
1724  * @tc.require:
1725  */
1726 HWTEST_F(DragServerTest, DragServerTest88, TestSize.Level1)
1727 {
1728     CALL_TEST_DEBUG;
1729     std::optional<DragData> dragData = CreateDragData(MMI::PointerEvent::SOURCE_TYPE_MOUSE, 0, 1, false, 1);
1730     ASSERT_TRUE(dragData);
1731     dragData.value().summaryFormat = { { "image", { 0, 1 } } };
1732     dragData.value().summaryTotalSize = 100;
1733     Parcel parcel;
1734     int32_t ret = DragDataUtil::MarshallingSummaryExpanding(dragData.value(), parcel);
1735     ASSERT_EQ(ret, RET_OK);
1736     DragData dragDataFromParcel;
1737     ret = DragDataUtil::UnMarshallingSummaryExpanding(parcel, dragDataFromParcel);
1738     ASSERT_EQ(ret, RET_OK);
1739 }
1740 
1741 /**
1742  * @tc.name: DragServerTest89
1743  * @tc.desc: Drag Drawing
1744  * @tc.type: FUNC
1745  * @tc.require:
1746  */
1747 HWTEST_F(DragServerTest, DragServerTest89, TestSize.Level1)
1748 {
1749     CALL_TEST_DEBUG;
1750     DragSummaryInfo dragSummaryInfo;
1751     Parcel parcel;
1752     SequenceableDragSummaryInfo sequenceableDragSummaryInfo(dragSummaryInfo);
1753     bool ret = sequenceableDragSummaryInfo.Marshalling(parcel);
1754     EXPECT_TRUE(ret);
1755     ASSERT_NO_FATAL_FAILURE(sequenceableDragSummaryInfo.Unmarshalling(parcel));
1756 }
1757 
1758 /**
1759  * @tc.name: DragServerTest90
1760  * @tc.desc: Drag Drawing
1761  * @tc.type: FUNC
1762  * @tc.require:
1763  */
1764 HWTEST_F(DragServerTest, DragServerTest90, TestSize.Level1)
1765 {
1766     CALL_TEST_DEBUG;
1767     DragSummaryInfo dragSummaryInfo;
1768     Parcel parcel;
1769     SequenceableDragSummaryInfo sequenceableDragSummaryInfo(dragSummaryInfo);
1770     bool ret = sequenceableDragSummaryInfo.Marshalling(parcel);
1771     EXPECT_TRUE(ret);
1772     ASSERT_NO_FATAL_FAILURE(sequenceableDragSummaryInfo.SetDragSummaryInfo(dragSummaryInfo));
1773 }
1774 
1775 /**
1776  * @tc.name: DragServerTest91
1777  * @tc.desc: Drag Drawing
1778  * @tc.type: FUNC
1779  * @tc.require:
1780  */
1781 HWTEST_F(DragServerTest, DragServerTest91, TestSize.Level1)
1782 {
1783     CALL_TEST_DEBUG;
1784     DragData dragData;
1785     Parcel parcel;
1786     SequenceableDragData sequenceableDragData(dragData);
1787     bool ret = sequenceableDragData.Marshalling(parcel);
1788     EXPECT_FALSE(ret);
1789 }
1790 
1791 /**
1792  * @tc.name: DragServerTest92
1793  * @tc.desc: Drag Drawing
1794  * @tc.type: FUNC
1795  * @tc.require:
1796  */
1797 HWTEST_F(DragServerTest, DragServerTest92, TestSize.Level1)
1798 {
1799     CALL_TEST_DEBUG;
1800     DragSummaryInfo dragSummaryInfo;
1801     SequenceableDragSummaryInfo sequenceableDragSummaryInfo(dragSummaryInfo);
1802     Parcel parcel;
1803     parcel.SetMaxCapacity(0);
1804     auto ret = sequenceableDragSummaryInfo.Unmarshalling(parcel);
1805     ASSERT_EQ(ret, nullptr);
1806     ASSERT_NO_FATAL_FAILURE(sequenceableDragSummaryInfo.SetDragSummaryInfo(dragSummaryInfo));
1807 }
1808 
1809 /**
1810  * @tc.name: DragServerTest93
1811  * @tc.desc: Drag Drawing
1812  * @tc.type: FUNC
1813  * @tc.require:
1814  */
1815 HWTEST_F(DragServerTest, DragServerTest93, TestSize.Level1)
1816 {
1817     CALL_TEST_DEBUG;
1818     Parcel parcel;
1819     parcel.SetMaxCapacity(0);
1820     DragDataPacker dragDataPacker;
1821     DragData dragData;
1822     auto ret = dragDataPacker.UnMarshallingDetailedSummarys(parcel, dragData);
1823     ASSERT_EQ(ret, RET_ERR);
1824 }
1825 
1826 /**
1827  * @tc.name: DragServerTest94
1828  * @tc.desc: Drag Drawing
1829  * @tc.type: FUNC
1830  * @tc.require:
1831  */
1832 HWTEST_F(DragServerTest, DragServerTest94, TestSize.Level1)
1833 {
1834     CALL_TEST_DEBUG;
1835     Parcel parcel;
1836     parcel.SetMaxCapacity(0);
1837     DragDataPacker dragDataPacker;
1838     DragData dragData;
1839     auto ret = dragDataPacker.UnMarshallingSummaryExpanding(parcel, dragData);
1840     ASSERT_EQ(ret, RET_ERR);
1841 }
1842 
1843 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
1844 /**
1845  * @tc.name: DragServerTest95
1846  * @tc.desc: Drag Drawing
1847  * @tc.type: FUNC
1848  * @tc.require:
1849  */
1850 HWTEST_F(DragServerTest, DragServerTest95, TestSize.Level1)
1851 {
1852     CALL_TEST_DEBUG;
1853     std::shared_ptr<EventHub> eventHub = EventHub::GetEventHub(g_context);
1854     ASSERT_NE(eventHub, nullptr);
1855     g_dragMgr.dragState_ = DragState::START;
1856     OHOS::AAFwk::Want want;
1857     EventFwk::CommonEventData event;
1858     want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED);
1859     event.SetWant(want);
1860     ASSERT_NO_FATAL_FAILURE(eventHub->OnReceiveEvent(event));
1861     want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_LOCALE_CHANGED);
1862     event.SetWant(want);
1863     ASSERT_NO_FATAL_FAILURE(eventHub->OnReceiveEvent(event));
1864     g_dragMgr.dragState_ = DragState::STOP;
1865 }
1866 #endif // OHOS_BUILD_ENABLE_ARKUI_X
1867 } // namespace DeviceStatus
1868 } // namespace Msdp
1869 } // namespace OHOS
1870