diff --git a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp index ce18bd153819536136efc731f75d5eeb7df1d0f1..f84d5f4a0967ede5be98189a59ddc01db1324e87 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -633,6 +633,13 @@ void AnsInnerKitsModulePublishTest::CheckJsonConverter(const NotificationRequest */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00100, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_00100 start ==========>"; NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); @@ -714,6 +721,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00100, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00200, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -776,6 +790,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00200, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00300, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -829,6 +850,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00300, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00400, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -880,6 +908,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00400, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00500, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -919,6 +954,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00500, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00600, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -958,6 +1000,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00600, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00700, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -999,6 +1048,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00700, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00800, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::CONTENT_INFORMATION); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1043,6 +1099,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00800, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00900, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1091,6 +1154,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00900, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_01000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::SERVICE_REMINDER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1125,6 +1195,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_01000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_02000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::SOCIAL_COMMUNICATION); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1157,6 +1234,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_02000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_03000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::CUSTOM); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1190,6 +1274,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_03000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_07000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::SOCIAL_COMMUNICATION); slot.EnableBypassDnd(true); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); @@ -1226,6 +1317,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_07000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_GetActiveNotifications_00100, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + std::shared_ptr implContent = std::make_shared(); EXPECT_NE(implContent, nullptr); std::shared_ptr content = std::make_shared(implContent); @@ -1270,6 +1368,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_GetActiveNotifications_ */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_CancelGroup_10100, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSubscribeInfo info = NotificationSubscribeInfo(); info.AddAppName("bundleName"); info.AddAppUserId(SUBSCRIBE_USER_ALL); @@ -1343,6 +1448,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_CancelGroup_10100, Func */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_04000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1458,6 +1570,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_08000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_05000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1497,6 +1616,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_05000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_06000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); @@ -1532,6 +1658,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_06000, Function */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00100, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + GTEST_LOG_(INFO) << "ANS_Interface_MT_Slot_Enalbe_00100::start:"; NotificationSlot slot(NotificationConstant::CONTENT_INFORMATION); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); @@ -1568,6 +1701,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00100, Func */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00200, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + GTEST_LOG_(INFO) << "ANS_Interface_MT_Slot_Enalbe_00200::start:"; NotificationSlot slot(NotificationConstant::SERVICE_REMINDER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); @@ -1610,6 +1750,13 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Slot_Enalbe_00200, Func */ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_09000, Function | MediumTest | Level1) { + NotificationBundleOption bundleOption; + bundleOption.SetBundleName("bundleName"); + bundleOption.SetUid(1); + std::string deviceId = ""; + EXPECT_EQ(NotificationHelper::SetNotificationsEnabledForSpecifiedBundle( + bundleOption, deviceId, true), (int)ERR_OK); + NotificationSlot slot(NotificationConstant::OTHER); EXPECT_EQ(0, NotificationHelper::AddNotificationSlot(slot)); auto subscriber = std::make_shared(); diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index d86bc32c7bad742efb41de8916131816aea85f50..74f168725d523de6180c2afdc68be58476a31a80 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -89,6 +89,9 @@ bool BundleManagerHelper::CheckApiCompatibility(const sptrSetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); sptr request = new (std::nothrow) NotificationRequest(); std::string label = ""; request->SetSlotType(NotificationConstant::SlotType::CONTENT_INFORMATION); 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 8beae1eb6b14d27b60212aad07c7a51e4dcc8a46..5eb55753755d30e352df6a951a3c12d8efa575f1 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 @@ -200,6 +200,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00100, TestAddSlot(NotificationConstant::SlotType::OTHER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(1); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -227,6 +230,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00200, TestAddSlot(NotificationConstant::SlotType::OTHER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(1); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -312,6 +318,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00500, TestAddSlot(NotificationConstant::SlotType::SERVICE_REMINDER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::CONTENT_INFORMATION); @@ -340,6 +349,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00600, TestAddSlot(NotificationConstant::SlotType::CONTENT_INFORMATION); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::CONTENT_INFORMATION); @@ -367,6 +379,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00700, { MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::CONTENT_INFORMATION); @@ -394,6 +409,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00800, TestAddSlot(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); @@ -421,6 +439,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_00900, TestAddSlot(NotificationConstant::SlotType::SERVICE_REMINDER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::SERVICE_REMINDER); @@ -448,6 +469,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_01000, TestAddSlot(NotificationConstant::SlotType::CONTENT_INFORMATION); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::CONTENT_INFORMATION); @@ -475,6 +499,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_01100, TestAddSlot(NotificationConstant::SlotType::OTHER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -584,6 +611,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_04700, TestAddSlot(NotificationConstant::SlotType::OTHER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); std::string label = "testLabel"; { sptr req = new NotificationRequest(1); @@ -638,6 +668,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_05000, TestAddSlot(NotificationConstant::SlotType::OTHER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); int32_t notificationId = 2; std::string label = "testLabel"; sptr req = new NotificationRequest(notificationId); @@ -663,6 +696,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_10000, MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(1); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -761,6 +797,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_10300, { MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(1); ASSERT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -788,6 +827,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_10400, { MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(1); ASSERT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -886,6 +928,8 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12100, */ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12200, Function | SmallTest | Level1) { + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); TestAddSlot(NotificationConstant::SlotType::OTHER); int32_t notificationId = 1; std::string label = "testRemove"; @@ -910,6 +954,8 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12200, */ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12300, Function | SmallTest | Level1) { + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, 1), true), (int)ERR_OK); TestAddSlot(NotificationConstant::SlotType::CONTENT_INFORMATION); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); @@ -940,6 +986,8 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12300, */ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12400, Function | SmallTest | Level1) { + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); sptr req = new (std::nothrow) NotificationRequest(1); @@ -968,6 +1016,8 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12400, */ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_12500, Function | SmallTest | Level1) { + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); sptr req = new (std::nothrow) NotificationRequest(1); @@ -1006,6 +1056,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_15500, { MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new (std::nothrow) NotificationRequest(1); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -1041,6 +1094,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_15600, { MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new (std::nothrow) NotificationRequest(1); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -1111,6 +1167,9 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_17200, TestAddSlot(NotificationConstant::SlotType::OTHER); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); + + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); sptr req = new NotificationRequest(1); EXPECT_NE(req, nullptr); req->SetSlotType(NotificationConstant::SlotType::OTHER); @@ -1140,6 +1199,8 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_17200, */ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_04100, Function | SmallTest | Level1) { + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); TestAddSlot(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); sptr req = new NotificationRequest(); EXPECT_NE(req, nullptr); @@ -1311,6 +1372,8 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_21500, */ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_19000, Function | SmallTest | Level1) { + ASSERT_EQ(advancedNotificationService_->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption(TEST_DEFUALT_BUNDLE, SYSTEM_APP_UID), true), (int)ERR_OK); MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); MockIsSystemApp(true); sptr req = new NotificationRequest(1); diff --git a/services/test/moduletest/ans_module_test.cpp b/services/test/moduletest/ans_module_test.cpp index f8941c9c9590f88f43718a5f757781981c0293d1..9abc4a1e6b45408e27adaca23481522055e08a19 100644 --- a/services/test/moduletest/ans_module_test.cpp +++ b/services/test/moduletest/ans_module_test.cpp @@ -146,6 +146,8 @@ void AnsModuleTest::TestAddSlots() */ HWTEST_F(AnsModuleTest, AnsModuleTest_002, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); TestAddSlots(); std::string label = "testLabel"; sptr req = new NotificationRequest(0); @@ -178,6 +180,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_002, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_003, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -219,6 +223,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_003, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_005, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -276,6 +282,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_005, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_006, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -318,6 +326,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_006, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_007, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -377,6 +387,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_007, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0013, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -419,6 +431,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0013, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0014, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -461,6 +475,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0014, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0015, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -503,6 +519,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0015, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0017, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -545,6 +563,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0017, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0019, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -587,6 +607,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0019, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0021, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -645,6 +667,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0021, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0023, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -687,6 +711,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0023, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0031, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -744,6 +770,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0031, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0033, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -792,6 +820,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0033, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0034, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -840,6 +870,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0034, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0035, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -884,6 +916,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0035, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0036, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -928,6 +962,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0036, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0039, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -986,6 +1022,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0039, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0040, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1028,6 +1066,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0040, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0041, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1070,6 +1110,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0041, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0042, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1112,6 +1154,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0042, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0043, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1281,6 +1325,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0056, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0058, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1331,6 +1377,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0058, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0062, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1389,6 +1437,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0062, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0063, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1480,6 +1530,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0065, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0066, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1516,6 +1568,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0066, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0100, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // create wantagent std::shared_ptr agent = std::make_shared(); @@ -1563,6 +1617,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0100, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0101, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // create wantagent std::shared_ptr agent = std::make_shared(); @@ -1603,6 +1659,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0101, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0102, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // create wantagent std::shared_ptr agent = std::make_shared(); @@ -1707,6 +1765,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0105, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0106, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // create wantagent std::shared_ptr agent = std::make_shared(); @@ -1894,6 +1954,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0111, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0112, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -1958,6 +2020,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0112, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0113, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2021,6 +2085,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0113, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0114, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2084,6 +2150,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0114, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0116, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2148,6 +2216,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0116, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0117, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2212,6 +2282,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0117, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0120, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2335,6 +2407,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0122, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0123, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); int ret = 0; std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2408,6 +2482,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0123, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0124, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2449,6 +2525,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0124, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0125, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2488,6 +2566,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0125, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0126, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2529,6 +2609,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0126, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0127, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); const int EXPECT_REQUST_NUM = 2; int ret = 0; @@ -2587,6 +2669,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0127, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0128, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); const int EXPECT_REQUST_NUM = 2; int ret = 0; @@ -2645,6 +2729,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0128, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0130, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2700,6 +2786,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0131, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0132, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2743,6 +2831,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0132, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0133, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2792,6 +2882,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0133, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0134, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber); @@ -2841,6 +2933,8 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0134, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0135, Function | SmallTest | Level1) { + ASSERT_EQ(g_advancedNotificationService->SetNotificationsEnabledForSpecialBundle(std::string(), + new NotificationBundleOption("bundleName", 1), true), (int)ERR_OK); // subscriber std::shared_ptr subscriber = std::make_shared(); std::shared_ptr ptr = std::static_pointer_cast(subscriber);