From 0dc6e02cf6ccdc753d783c411cfd1e30fd53922a Mon Sep 17 00:00:00 2001 From: wufarong Date: Wed, 26 Feb 2025 16:39:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wufarong Change-Id: I707bc31de8753b9b4623e82a8c0fc38c095b9e4b --- services/ans/test/unittest/ans_manager_stub_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ans/test/unittest/ans_manager_stub_test.cpp b/services/ans/test/unittest/ans_manager_stub_test.cpp index b3bff9055..e84abde79 100644 --- a/services/ans/test/unittest/ans_manager_stub_test.cpp +++ b/services/ans/test/unittest/ans_manager_stub_test.cpp @@ -3432,7 +3432,7 @@ HWTEST_F(AnsManagerStubTest, HandleSetEnabledForBundleSlot01, Function | SmallTe data.WriteBool(isForceControl); ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); } /** -- Gitee From 032ea9090b9a716e22ffe333d84a6df246a9d421 Mon Sep 17 00:00:00 2001 From: wufarong Date: Fri, 28 Feb 2025 14:39:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ans=5Ftest=E5=A4=B1=E8=B4=A5=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E4=B8=8ECrash=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wufarong Change-Id: Iab6a92c6b1817beea4cfae3686bed63cea544cdb --- .../ans/test/unittest/notification_capsule_test.cpp | 1 + .../ans/test/unittest/notification_request_test.cpp | 4 ++-- .../unittest/notification_subscribe_info_test.cpp | 2 +- frameworks/ans/test/unittest/notification_test.cpp | 12 +++++++----- services/ans/test/unittest/ans_manager_stub_test.cpp | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/frameworks/ans/test/unittest/notification_capsule_test.cpp b/frameworks/ans/test/unittest/notification_capsule_test.cpp index 350f6d216..a21e8cdcf 100644 --- a/frameworks/ans/test/unittest/notification_capsule_test.cpp +++ b/frameworks/ans/test/unittest/notification_capsule_test.cpp @@ -129,6 +129,7 @@ HWTEST_F(NotificationCapsuleTest, Unmarshalling_00001, Function | SmallTest | Le Parcel parcel; std::shared_ptr result = std::make_shared(); + result->Marshalling(parcel); if (nullptr != result) { if (nullptr == result->Unmarshalling(parcel)) { diff --git a/frameworks/ans/test/unittest/notification_request_test.cpp b/frameworks/ans/test/unittest/notification_request_test.cpp index b8ea1c84a..65c7ddcb2 100644 --- a/frameworks/ans/test/unittest/notification_request_test.cpp +++ b/frameworks/ans/test/unittest/notification_request_test.cpp @@ -956,7 +956,7 @@ HWTEST_F(NotificationRequestTest, GetNotificationRequestKey_0001, Level1) notificationRequest.SetLabel(string("test")); notificationRequest.SetCreatorBundleName(string("push.com")); auto key = notificationRequest.GetKey(); - string expectKey {"ans_live_view__1_0_push.com_test_10"}; + string expectKey {"ans_live_view___1_0_push.com_test_10"}; EXPECT_EQ(key, expectKey); } @@ -976,7 +976,7 @@ HWTEST_F(NotificationRequestTest, GetNotificationRequestKey_0002, Level1) notificationRequest.SetOwnerBundleName(string("test.com")); notificationRequest.SetIsAgentNotification(true); auto key = notificationRequest.GetKey(); - string expectKey {"ans_live_view__1_2_test.com_test_10"}; + string expectKey {"ans_live_view___1_2_test.com_test_10"}; EXPECT_EQ(key, expectKey); } diff --git a/frameworks/ans/test/unittest/notification_subscribe_info_test.cpp b/frameworks/ans/test/unittest/notification_subscribe_info_test.cpp index d01af4692..3ef984874 100644 --- a/frameworks/ans/test/unittest/notification_subscribe_info_test.cpp +++ b/frameworks/ans/test/unittest/notification_subscribe_info_test.cpp @@ -167,7 +167,7 @@ HWTEST_F(NotificationSubscribeInfoTest, Dump_00001, Function | SmallTest | Level "appNames = [" + appName + ", ]" + "deviceType = " + deviceType + "userId = " + std::to_string(userId) + - "slotTypes = []filterType = 0 }"; + "slotTypes = []filterType = 0needResponse = 0 }"; EXPECT_EQ(res, rrc->Dump()); } } diff --git a/frameworks/ans/test/unittest/notification_test.cpp b/frameworks/ans/test/unittest/notification_test.cpp index 6e0040ad8..7346ad239 100644 --- a/frameworks/ans/test/unittest/notification_test.cpp +++ b/frameworks/ans/test/unittest/notification_test.cpp @@ -216,7 +216,7 @@ HWTEST_F(NotificationTest, GenerateNotificationKey_00001, Function | SmallTest | request->SetNotificationId(id); request->SetCreatorBundleName("come.test"); auto rrc = std::make_shared(request); - std::string result = "_10_20_come.test_Lable_30"; + std::string result = "__10_20_come.test_Lable_30"; EXPECT_EQ(rrc->GetKey(), result); } @@ -242,7 +242,7 @@ HWTEST_F(NotificationTest, GenerateNotificationKey_00002, Function | SmallTest | request->SetCreatorBundleName("come.push"); request->SetOwnerBundleName("come.test"); auto rrc = std::make_shared(deviceId, request); - std::string result = "DeviceId_10_20_come.test_Lable_30"; + std::string result = "_DeviceId_10_20_come.test_Lable_30"; EXPECT_EQ(rrc->GetKey(), result); } @@ -301,7 +301,7 @@ HWTEST_F(NotificationTest, Dump_00001, Function | SmallTest | Level1) std::string deviceId = "DeviceId"; sptr request = new NotificationRequest(); auto rrc = std::make_shared(deviceId, request); - std::string ret = "Notification{ key = DeviceId_-1_0___0, ledLightColor = 0, " + std::string ret = "Notification{ key = _DeviceId_-1_0___0, ledLightColor = 0, " "lockscreenVisbleness = 0, remindType = -1, isRemoveAllowed = true, sourceType = 0, " "deviceId = DeviceId, request = NotificationRequest{ notificationId = 0, slotType = 3, " "createTime = 0, deliveryTime = 0, autoDeletedTime = -1, settingsText = , " @@ -313,14 +313,16 @@ HWTEST_F(NotificationTest, Dump_00001, Function | SmallTest | Level1) "tapDismissed = true, colorEnabled = false, alertOneTime = false, showStopwatch = false, " "isCountdown = false, inProgress = false, groupOverview = false, isRemoveAllowed = true, " "progressIndeterminate = false, unremovable = false, floatingIcon = false, onlyLocal = false, " - "permitted = true, isAgent = false, updateOnly = false, removalWantAgent = null, maxScreenWantAgent = null, " + "permitted = true, isAgent = false, updateOnly = false, isForceDistributed = false, " + "isNotDistributed = false, removalWantAgent = null, maxScreenWantAgent = null, " "additionalParams = null, littleIcon = null, bigIcon = null, overlayIcon = null, " "notificationContent = null, notificationTemplate = null, actionButtons = empty, " "messageUsers = empty, userInputHistory = empty, distributedOptions = " "NotificationDistributedOptions{ isDistributed = true, devicesSupportDisplay = [], " "devicesSupportOperate = [] }, notificationFlags = null, notificationFlagsOfDevices = null, " "notificationBundleOption = null, agentBundle = null, creatorUserId = -1, ownerUserId = -1, " - "receiverUserId = -1, updateDeadLine = 0, finishDeadLine = 0, sound = , unifiedGroupInfo_ = null }, postTime = 0, " + "receiverUserId = -1, updateDeadLine = 0, finishDeadLine = 0, sound = , distributed = 0: " + "flag: 0, unifiedGroupInfo_ = null }, postTime = 0, " "sound = nullptr, vibrationStyle = [], updateTimer = 0, finishTimer = 0, archiveTimer = 0 }"; EXPECT_EQ(rrc->Dump(), ret); } diff --git a/services/ans/test/unittest/ans_manager_stub_test.cpp b/services/ans/test/unittest/ans_manager_stub_test.cpp index e84abde79..600a7403e 100644 --- a/services/ans/test/unittest/ans_manager_stub_test.cpp +++ b/services/ans/test/unittest/ans_manager_stub_test.cpp @@ -4893,7 +4893,7 @@ HWTEST_F(AnsManagerStubTest, HandleAddDoNotDisturbProfiles_0100, TestSize.Level1 MessageParcel data; MessageParcel reply; ErrCode ret = ansManagerStub_->HandleAddDoNotDisturbProfiles(data, reply); - EXPECT_EQ(ret, ERR_ANS_PARCELABLE_FAILED); + EXPECT_EQ(ret, ERR_OK); } /** -- Gitee