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 651d3ed5a0893dec3189b2f06dc8d1c170b26239..8fb62312dc390f01056bee0c9484bd87eb2dbb60 100644 --- a/services/ans/test/unittest/advanced_notification_publish_service_test.cpp +++ b/services/ans/test/unittest/advanced_notification_publish_service_test.cpp @@ -169,103 +169,6 @@ HWTEST_F(AnsPublishServiceTest, Publish_00002, Function | SmallTest | Level1) ASSERT_EQ(ret, (int)ERR_OK); } - -/** - * @tc.name: Publish_00003 - * @tc.desc: Publish live_view notification once - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(AnsPublishServiceTest, Publish_00003, Function | SmallTest | Level1) -{ - sptr request = new (std::nothrow) NotificationRequest(); - std::string label = ""; - request->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - request->SetNotificationId(1); - auto liveContent = std::make_shared(); - auto content = std::make_shared(liveContent); - request->SetContent(content); - RegisterPushCheck(); - MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); - MockIsSystemApp(true); - MockIsVerfyPermisson(false); - - auto ret = advancedNotificationService_->Publish(label, request); - ASSERT_EQ(ret, (int)ERR_OK); - - sptr slot; - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::LIVE_VIEW; - ret = advancedNotificationService_->GetSlotByType(slotType, slot); - ASSERT_EQ(ret, (int)ERR_OK); - ASSERT_EQ(1, slot->GetAuthorizedStatus()); - ASSERT_EQ(1, slot->GetAuthHintCnt()); -} - -/** - * @tc.name: Publish_00004 - * @tc.desc: Publish live_view notification twice - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(AnsPublishServiceTest, Publish_00004, Function | SmallTest | Level1) -{ - sptr request = new (std::nothrow) NotificationRequest(); - std::string label = ""; - request->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - request->SetNotificationId(1); - auto liveContent = std::make_shared(); - auto content = std::make_shared(liveContent); - request->SetContent(content); - RegisterPushCheck(); - - MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); - MockIsSystemApp(true); - MockIsVerfyPermisson(false); - - auto ret = advancedNotificationService_->Publish(label, request); - ASSERT_EQ(ret, (int)ERR_OK); - - sptr request2 = new (std::nothrow) NotificationRequest(); - request2->SetNotificationId(2); - request2->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - request2->SetContent(content); - ret = advancedNotificationService_->Publish(label, request2); - ASSERT_EQ(ret, (int)ERR_OK); - - sptr slot; - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::LIVE_VIEW; - ret = advancedNotificationService_->GetSlotByType(slotType, slot); - ASSERT_EQ(ret, (int)ERR_OK); - ASSERT_EQ(0, slot->GetAuthorizedStatus()); - ASSERT_EQ(2, slot->GetAuthHintCnt()); -} - -/** - * @tc.name: Publish_00005 - * @tc.desc: Publish test receiver user and checkUserExists is true - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(AnsPublishServiceTest, Publish_00005, Function | SmallTest | Level1) -{ - sptr request = new (std::nothrow) NotificationRequest(); - std::string label = ""; - request->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - request->SetNotificationId(1); - request->SetReceiverUserId(101); - auto liveContent = std::make_shared(); - auto content = std::make_shared(liveContent); - request->SetContent(content); - RegisterPushCheck(); - MockIsOsAccountExists(true); - MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); - MockIsSystemApp(true); - MockIsVerfyPermisson(true); - - auto ret = advancedNotificationService_->Publish(label, request); - ASSERT_EQ(ret, (int)ERR_OK); -} - /** * @tc.name: Publish_00006 * @tc.desc: Publish test receiver user and checkUserExists is false @@ -341,6 +244,7 @@ HWTEST_F(AnsPublishServiceTest, Publish_00008, Function | SmallTest | Level1) */ HWTEST_F(AnsPublishServiceTest, DeleteByBundle_00001, Function | SmallTest | Level1) { + MockIsVerfyPermisson(true); sptr bundleOption = nullptr; auto ret = advancedNotificationService_->DeleteByBundle(bundleOption); ASSERT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); @@ -2718,34 +2622,6 @@ HWTEST_F(AnsPublishServiceTest, IsDisableNotification_005, Function | SmallTest system::SetBoolParameter("persist.edm.notification_disable", defaultPolicy); } -/* - * @tc.name: AtomicServicePublish_0100 - * @tc.desc: test PublishNotification with common liveView. - * @tc.type: FUNC - * @tc.require: #I62SME - */ -HWTEST_F(AnsPublishServiceTest, AtomicServicePublish_0100, Function | MediumTest | Level1) -{ - MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); - MockIsSystemApp(true); - sptr request = new NotificationRequest(1000); - std::shared_ptr liveViewContent = std::make_shared(); - liveViewContent->SetContentType(static_cast(NotificationContent::Type::LIVE_VIEW)); - std::shared_ptr content = std::make_shared(liveViewContent); - request->SetContent(content); - request->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - request->SetIsAgentNotification(true); - request->SetOwnerBundleName("test.com"); - request->SetOwnerUserId(100); - auto extendInfo = std::make_shared(); - extendInfo->SetParam("autoServiceIntallStatus", AAFwk::Integer::Box(0)); - request->SetExtendInfo(extendInfo); - auto params = request->GetExtendInfo(); - int32_t installedStatus = params->GetIntParam("autoServiceIntallStatus", 0); - auto ret = advancedNotificationService_->Publish("", request); - EXPECT_EQ(ret, ERR_OK); -} - /* * @tc.name: AtomicServicePublish_0100 * @tc.desc: test PublishNotification with common liveView. diff --git a/services/ans/test/unittest/advanced_notification_service_test/advanced_notification_service_publish_test.cpp b/services/ans/test/unittest/advanced_notification_service_test/advanced_notification_service_publish_test.cpp index bada0de6a70eb3bf4468afd43d44de790ac23790..91140bef819716090b2bc95650c8b821e0192d40 100644 --- a/services/ans/test/unittest/advanced_notification_service_test/advanced_notification_service_publish_test.cpp +++ b/services/ans/test/unittest/advanced_notification_service_test/advanced_notification_service_publish_test.cpp @@ -1422,36 +1422,6 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_19000, ASSERT_EQ(advancedNotificationService_->Publish("label", req), (int)ERR_OK); } -/** - * @tc.number : AdvancedNotificationServiceTest_20000 - * @tc.name : ANS_Publish_With_PixelMap - * @tc.desc : Publish a notification with pixelMap. - */ -HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_20000, Function | SmallTest | Level1) -{ - MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); - MockIsSystemApp(true); - sptr req = new NotificationRequest(1); - EXPECT_NE(req, nullptr); - req->SetSlotType(NotificationConstant::SlotType::LIVE_VIEW); - req->SetLabel("label"); - std::shared_ptr liveViewContent = std::make_shared(); - EXPECT_NE(liveViewContent, nullptr); - liveViewContent->SetText("notification text"); - liveViewContent->SetTitle("notification title"); - std::shared_ptr content = std::make_shared(liveViewContent); - EXPECT_NE(content, nullptr); - req->SetContent(content); - - req->SetLittleIcon(nullptr); - EXPECT_EQ(nullptr, req->GetLittleIcon()); - req->SetBigIcon(nullptr); - EXPECT_EQ(nullptr, req->GetBigIcon()); - req->SetOverlayIcon(nullptr); - EXPECT_EQ(nullptr, req->GetOverlayIcon()); - ASSERT_EQ(advancedNotificationService_->Publish("label", req), (int)ERR_OK); -} - /** * @tc.number : OnReceiveEvent_0200 * @tc.name : OnReceiveEvent_0200