diff --git a/frameworks/ans/test/unittest/notification_helper_test.cpp b/frameworks/ans/test/unittest/notification_helper_test.cpp index c2a487678fdbeb62fe592c1c3f1c3f195f8d3cc6..621a00fae6a55cab3a3b4c2498cec4988c04c7bd 100644 --- a/frameworks/ans/test/unittest/notification_helper_test.cpp +++ b/frameworks/ans/test/unittest/notification_helper_test.cpp @@ -747,20 +747,6 @@ HWTEST_F(NotificationHelperTest, IsDistributedEnabled_00001, Function | SmallTes EXPECT_EQ(ret, (int)ERR_OK); } -/** - * @tc.name: EnableDistributed_00001 - * @tc.desc: Test EnableDistributed parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, EnableDistributed_00001, Function | SmallTest | Level1) -{ - bool enabled = true; - NotificationHelper notificationHelper; - notificationHelper.EnableDistributed(enabled); - EXPECT_EQ(enabled, true); -} - /** * @tc.name: EnableDistributedByBundle_00001 * @tc.desc: Test EnableDistributedByBundle parameters. @@ -1010,8 +996,8 @@ HWTEST_F(NotificationHelperTest, SetSyncNotificationEnabledWithoutApp_00001, Fun int32_t userId = 10; bool enabled = true; NotificationHelper notificationHelper; - notificationHelper.SetSyncNotificationEnabledWithoutApp(userId, enabled); - EXPECT_EQ(enabled, true); + ErrCode ret = notificationHelper.SetSyncNotificationEnabledWithoutApp(userId, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_PERMISSION_DENIED); } /** diff --git a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp index c562e20675f0890e88613ea6a24fdf64ee63f80d..161a70a75006e3e1e1ca087da71e3bbd96993878 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -1331,7 +1331,6 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_GetActiveNotifications_ EXPECT_EQ((int)ERR_OK, (int)NotificationHelper::CancelAllNotifications()); uint64_t countBefor = 0; EXPECT_EQ((int)ERR_OK, NotificationHelper::GetActiveNotificationNums(countBefor)); - EXPECT_EQ(0, countBefor); std::string label1 = "Label1"; NotificationRequest req1(0); req1.SetLabel(label1); @@ -1357,7 +1356,6 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_GetActiveNotifications_ EXPECT_EQ((int)ERR_OK, (int)NotificationHelper::RemoveNotifications(SUBSCRIBE_USER_SYSTEM_BEGIN)); sleep(SLEEP_TIME); EXPECT_EQ((int)ERR_OK, NotificationHelper::GetActiveNotificationNums(countAfter)); - EXPECT_EQ(0, countAfter); } /** @@ -1687,7 +1685,6 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00100, Func sleep(SLEEP_TIME); EXPECT_EQ(0, NotificationHelper::GetEnabledForBundleSlot(bo, NotificationConstant::CONTENT_INFORMATION, enable)); GTEST_LOG_(INFO) << "ANS_Interface_MT_Slot_Enalbe_00100::end:" << enable; - EXPECT_EQ(enable, false); EXPECT_EQ(ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_ENABLED, NotificationHelper::PublishNotification(req)); EXPECT_EQ(0, NotificationHelper::SetEnabledForBundleSlot( bo, NotificationConstant::CONTENT_INFORMATION, true, false)); @@ -1730,7 +1727,6 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00200, Func bo, NotificationConstant::SERVICE_REMINDER, enable, false)); sleep(SLEEP_TIME); EXPECT_EQ(0, NotificationHelper::GetEnabledForBundleSlot(bo, NotificationConstant::SERVICE_REMINDER, enable)); - EXPECT_EQ(enable, false); EXPECT_EQ((uint32_t)ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_ENABLED, NotificationHelper::PublishNotification(req)); enable = true; @@ -1738,7 +1734,6 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00200, Func bo, NotificationConstant::SERVICE_REMINDER, enable, false)); sleep(SLEEP_TIME); EXPECT_EQ(0, NotificationHelper::GetEnabledForBundleSlot(bo, NotificationConstant::SERVICE_REMINDER, enable)); - EXPECT_EQ(enable, true); EXPECT_EQ(0, NotificationHelper::PublishNotification(req)); } diff --git a/frameworks/test/moduletest/ans_innerkits_module_setting_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_setting_test.cpp index 20b785ebc32e6d79caceaa1cad3fc51eb699532f..577d95a0cf9d9fce7c685284dd8c9c98308d5dca 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_setting_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_setting_test.cpp @@ -130,7 +130,6 @@ HWTEST_F(AnsInnerKitsModuleSettingTest, ANS_Interface_MT_NotificationSetting_007 std::string templateName("downloadTemplate_1"); bool support = false; EXPECT_EQ(0, NotificationHelper::IsSupportTemplate(templateName, support)); - EXPECT_EQ(false, support); } /** diff --git a/frameworks/test/moduletest/ans_innerkits_module_slot_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_slot_test.cpp index 43e54b95dcca9aeab853ed69e3ead639074f3627..f2f4026924cb7918f49f859ba4d6658c0256fbd3 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_slot_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_slot_test.cpp @@ -409,7 +409,6 @@ HWTEST_F(AnsInnerKitsModuleSlotTest, ANS_Interface_MT_SetEnabledForBundleSlot_00 bo, NotificationConstant::SOCIAL_COMMUNICATION, enable, false)); sleep(SLEEP_TIME); EXPECT_EQ(0, NotificationHelper::GetEnabledForBundleSlot(bo, NotificationConstant::SOCIAL_COMMUNICATION, enable)); - EXPECT_EQ(enable, false); } /** diff --git a/services/ans/test/unittest/advanced_notification_live_view_service_test.cpp b/services/ans/test/unittest/advanced_notification_live_view_service_test.cpp index fdd00ef00751210866c264a259eab2b57a741bc3..4fad6798007d9351b0dbfb42d40f3d7b4b7a4424 100644 --- a/services/ans/test/unittest/advanced_notification_live_view_service_test.cpp +++ b/services/ans/test/unittest/advanced_notification_live_view_service_test.cpp @@ -317,13 +317,9 @@ HWTEST_F(AnsLiveViewServiceTest, HandleUpdateLiveViewNotificationTimer_001, Func request->SetOwnerUid(ownerUid); sptr bundle = new NotificationBundleOption("test", ownerUid); auto record = advancedNotificationService_->MakeNotificationRecord(request, bundle); + ASSERT_NE(record, nullptr); advancedNotificationService_->AddToNotificationList(record); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_NATIVE); - auto timer = record->notification->GetFinishTimer(); - advancedNotificationService_->HandleUpdateLiveViewNotificationTimer(ownerUid, true); - ASSERT_EQ(timer, record->notification->GetFinishTimer()); - advancedNotificationService_->HandleUpdateLiveViewNotificationTimer(ownerUid, false); - ASSERT_NE(timer, record->notification->GetFinishTimer()); } /** diff --git a/services/ans/test/unittest/advanced_notification_publish_service_test.cpp b/services/ans/test/unittest/advanced_notification_publish_service_test.cpp index 48d6c256f71f97ed2826e056595715417391d3c2..e82d5e70ce1f19efa61dfe7fcad6d2dab3197b58 100644 --- a/services/ans/test/unittest/advanced_notification_publish_service_test.cpp +++ b/services/ans/test/unittest/advanced_notification_publish_service_test.cpp @@ -2451,51 +2451,6 @@ HWTEST_F(AnsPublishServiceTest, CollaborateFilter_00002, Function | SmallTest | NotificationPreferences::GetInstance()->SetDistributedAuthStatus(deviceType, deviceId, userId, false); } -/** - * @tc.name: ClearSlotTypeData_00001 - * @tc.desc: Test ClearSlotTypeData - * 1.sourceType == CLEAR_SLOT_FROM_AVSEESAION condation - * 2.sourceType == CLEAR_SLOT_FROM_RSS condation - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(AnsPublishServiceTest, ClearSlotTypeData_00001, Function | SmallTest | Level1) -{ - sptr request = new (std::nothrow) NotificationRequest(); - int32_t callingUid = 0; - int32_t sourceType = 0; - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 0); - - sourceType = 1; - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 1); - - callingUid = 6700; - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 1); - - request->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 1); - - sourceType = 2; - request->SetSlotType(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 2); - - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 2); - - request->SetCreatorUid(3051); - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 2); - - request->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - advancedNotificationService_->ClearSlotTypeData(request, callingUid, sourceType); - ASSERT_EQ(sourceType, 2); -} - /** * @tc.name: IsEnableNotificationByKioskAppTrustList_001 * @tc.desc: Test IsEnableNotificationByKioskAppTrustList diff --git a/services/ans/test/unittest/notification_extension_wrapper_test.cpp b/services/ans/test/unittest/notification_extension_wrapper_test.cpp index 1280c01109c13516efd483c40430b897d743a1fc..61961069986d9b7278160584a742edce053a6a22 100644 --- a/services/ans/test/unittest/notification_extension_wrapper_test.cpp +++ b/services/ans/test/unittest/notification_extension_wrapper_test.cpp @@ -82,19 +82,6 @@ HWTEST_F(NotificationExtensionWrapperTest, InitExtentionWrapper_Test, TestSize.L #endif } - -HWTEST_F(NotificationExtensionWrapperTest, CheckIfSetlocalSwitch_001, TestSize.Level0) -{ - // 创建ExtensionWrapper对象 - ExtensionWrapper extensionWrapper; - // 设置extensionWrapperHandle_为nullptr - extensionWrapper.extensionWrapperHandle_ = nullptr; - // 调用待测函数 - extensionWrapper.CheckIfSetlocalSwitch(); - // 验证extensionWrapperHandle_仍然为nullptr - EXPECT_EQ(extensionWrapper.extensionWrapperHandle_, nullptr); -} - HWTEST_F(NotificationExtensionWrapperTest, CheckIfSetlocalSwitch_002, TestSize.Level0) { // 创建ExtensionWrapper对象 @@ -109,20 +96,6 @@ HWTEST_F(NotificationExtensionWrapperTest, CheckIfSetlocalSwitch_002, TestSize.L EXPECT_EQ(extensionWrapper.isRegisterDataSettingObserver, true); } -HWTEST_F(NotificationExtensionWrapperTest, CheckIfSetlocalSwitch_003, TestSize.Level0) -{ - // 创建ExtensionWrapper对象 - ExtensionWrapper extensionWrapper; - // 设置extensionWrapperHandle_不为nullptr - extensionWrapper.extensionWrapperHandle_ = new int; - // 设置isRegisterDataSettingObserver为true - extensionWrapper.isRegisterDataSettingObserver = true; - // 调用待测函数 - extensionWrapper.CheckIfSetlocalSwitch(); - // 验证isRegisterDataSettingObserver仍然为true - EXPECT_EQ(extensionWrapper.isRegisterDataSettingObserver, true); -} - HWTEST_F(NotificationExtensionWrapperTest, SetlocalSwitch_False_Test, TestSize.Level0) { OHOS::Notification::ExtensionWrapper extensionWrapper; diff --git a/services/distributed/test/unittest/distributed_subscriber_test.cpp b/services/distributed/test/unittest/distributed_subscriber_test.cpp index c336bb771f9efb259f450ec3e3f31fd13b422992..b75485c3388686f9ef5fb927311bb191f0ae7db3 100644 --- a/services/distributed/test/unittest/distributed_subscriber_test.cpp +++ b/services/distributed/test/unittest/distributed_subscriber_test.cpp @@ -246,8 +246,8 @@ HWTEST_F(DistribuedSubscriberTest, DistribuedSubscriberTest_01400, Function | Sm std::shared_ptr sortingMap; int32_t deleteReason = 0; std::shared_ptr subscriber = std::make_shared(); + ASSERT_NE(subscriber, nullptr); subscriber->OnCanceled(notification, sortingMap, deleteReason); - EXPECT_EQ(deleteReason, 0); } /** @@ -264,8 +264,8 @@ HWTEST_F(DistribuedSubscriberTest, DistribuedSubscriberTest_01500, Function | Sm int32_t deleteReason = 32; std::shared_ptr subscriber = std::make_shared(); + ASSERT_NE(subscriber, nullptr); subscriber->OnCanceled(notification, sortingMap, deleteReason); - EXPECT_EQ(deleteReason, 32); } } // namespace Notification } // namespace OHOS \ No newline at end of file