• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include <gtest/gtest.h>
17 
18 #include "notification_bundle_option.h"
19 #include "notification_do_not_disturb_date.h"
20 #include "enabled_notification_callback_data.h"
21 #include "notification_request.h"
22 #include "notification_slot.h"
23 #include "notification_sorting_map.h"
24 #include "notification_subscriber.h"
25 #include "ans_inner_errors.h"
26 #include "errors.h"
27 #include "notification_helper.h"
28 
29 using namespace testing::ext;
30 namespace OHOS {
31 namespace Notification {
32 class NotificationHelperTest : public testing::Test {
33 public:
SetUpTestCase()34     static void SetUpTestCase() {}
TearDownTestCase()35     static void TearDownTestCase() {}
SetUp()36     void SetUp() {}
TearDown()37     void TearDown() {}
38 };
39 
40 /**
41  * @tc.name: AddNotificationSlot_00001
42  * @tc.desc: Test AddNotificationSlot parameters.
43  * @tc.type: FUNC
44  * @tc.require: issueI5WRQ2
45  */
46 HWTEST_F(NotificationHelperTest, AddNotificationSlot_00001, Function | SmallTest | Level1)
47 {
48     NotificationSlot slot;
49     NotificationHelper notificationHelper;
50     ErrCode ret = notificationHelper.AddNotificationSlot(slot);
51     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
52 }
53 
54 /**
55  * @tc.name: AddSlotByType_00001
56  * @tc.desc: Test AddSlotByType parameters.
57  * @tc.type: FUNC
58  * @tc.require: issueI5WRQ2
59  */
60 HWTEST_F(NotificationHelperTest, AddSlotByType_00001, Function | SmallTest | Level1)
61 {
62     NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER;
63     NotificationHelper notificationHelper;
64     ErrCode ret = notificationHelper.AddSlotByType(slotType);
65     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
66 }
67 
68 /**
69  * @tc.name: AddNotificationSlots_00001
70  * @tc.desc: Test AddNotificationSlots parameters.
71  * @tc.type: FUNC
72  * @tc.require: issueI5WRQ2
73  */
74 HWTEST_F(NotificationHelperTest, AddNotificationSlots_00001, Function | SmallTest | Level1)
75 {
76     std::vector<NotificationSlot> slots;
77     NotificationHelper notificationHelper;
78     ErrCode ret = notificationHelper.AddNotificationSlots(slots);
79     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
80 }
81 
82 /**
83  * @tc.name: RemoveNotificationSlot_00001
84  * @tc.desc: Test RemoveNotificationSlot parameters.
85  * @tc.type: FUNC
86  * @tc.require: issueI5WRQ2
87  */
88 HWTEST_F(NotificationHelperTest, RemoveNotificationSlot_00001, Function | SmallTest | Level1)
89 {
90     NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER;
91     NotificationHelper notificationHelper;
92     ErrCode ret = notificationHelper.RemoveNotificationSlot(slotType);
93     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
94 }
95 
96 /**
97  * @tc.name: RemoveAllSlots_00001
98  * @tc.desc: Test RemoveAllSlots parameters.
99  * @tc.type: FUNC
100  * @tc.require: issueI5WRQ2
101  */
102 HWTEST_F(NotificationHelperTest, RemoveAllSlots_00001, Function | SmallTest | Level1)
103 {
104     NotificationHelper notificationHelper;
105     ErrCode ret = notificationHelper.RemoveAllSlots();
106     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
107 }
108 
109 /**
110  * @tc.name: GetNotificationSlot_00001
111  * @tc.desc: Test GetNotificationSlot parameters.
112  * @tc.type: FUNC
113  * @tc.require: issueI5WRQ2
114  */
115 HWTEST_F(NotificationHelperTest, GetNotificationSlot_00001, Function | SmallTest | Level1)
116 {
117     NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER;
118     sptr<NotificationSlot> slot = nullptr;
119     NotificationHelper notificationHelper;
120     ErrCode ret = notificationHelper.GetNotificationSlot(slotType, slot);
121     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
122 }
123 
124 /**
125  * @tc.name: GetNotificationSlots_00001
126  * @tc.desc: Test GetNotificationSlots parameters.
127  * @tc.type: FUNC
128  * @tc.require: issueI5WRQ2
129  */
130 HWTEST_F(NotificationHelperTest, GetNotificationSlots_00001, Function | SmallTest | Level1)
131 {
132     std::vector<sptr<NotificationSlot>> slots;
133     NotificationHelper notificationHelper;
134     ErrCode ret = notificationHelper.GetNotificationSlots(slots);
135     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
136 }
137 
138 /**
139  * @tc.name: GetNotificationSlotNumAsBundle_00001
140  * @tc.desc: Test GetNotificationSlotNumAsBundle parameters.
141  * @tc.type: FUNC
142  * @tc.require: issueI5WRQ2
143  */
144 HWTEST_F(NotificationHelperTest, GetNotificationSlotNumAsBundle_00001, Function | SmallTest | Level1)
145 {
146     NotificationBundleOption bundleOption;
147     uint64_t num = 10;
148     NotificationHelper notificationHelper;
149     ErrCode ret = notificationHelper.GetNotificationSlotNumAsBundle(bundleOption, num);
150     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
151 }
152 
153 /**
154  * @tc.name: PublishNotification_00001
155  * @tc.desc: Test PublishNotification parameters.
156  * @tc.type: FUNC
157  * @tc.require: issueI5WRQ2
158  */
159 HWTEST_F(NotificationHelperTest, PublishNotification_00001, Function | SmallTest | Level1)
160 {
161     NotificationRequest request;
162     NotificationHelper notificationHelper;
163     ErrCode ret = notificationHelper.PublishNotification(request);
164     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
165 }
166 
167 /**
168  * @tc.name: PublishNotification_00002
169  * @tc.desc: Test PublishNotification parameters.
170  * @tc.type: FUNC
171  * @tc.require: issueI5WRQ2
172  */
173 HWTEST_F(NotificationHelperTest, PublishNotification_00002, Function | SmallTest | Level1)
174 {
175     NotificationRequest request;
176     std::string deviceId = "DeviceId";
177     NotificationHelper notificationHelper;
178     ErrCode ret = notificationHelper.PublishNotification(request, deviceId);
179     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
180 }
181 
182 /**
183  * @tc.name: PublishNotification_00003
184  * @tc.desc: Test PublishNotification parameters.
185  * @tc.type: FUNC
186  * @tc.require: issueI5WRQ2
187  */
188 HWTEST_F(NotificationHelperTest, PublishNotification_00003, Function | SmallTest | Level1)
189 {
190     std::string label = "Label";
191     NotificationRequest request;
192     NotificationHelper notificationHelper;
193     ErrCode ret = notificationHelper.PublishNotification(label, request);
194     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
195 }
196 
197 /**
198  * @tc.name: CancelNotification_00001
199  * @tc.desc: Test CancelNotification parameters.
200  * @tc.type: FUNC
201  * @tc.require: issueI5WRQ2
202  */
203 HWTEST_F(NotificationHelperTest, CancelNotification_00001, Function | SmallTest | Level1)
204 {
205     int32_t notificationId = 10;
206     NotificationHelper notificationHelper;
207     ErrCode ret = notificationHelper.CancelNotification(notificationId);
208     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
209 }
210 
211 /**
212  * @tc.name: CancelNotification_00002
213  * @tc.desc: Test CancelNotification parameters.
214  * @tc.type: FUNC
215  * @tc.require: issueI5WRQ2
216  */
217 HWTEST_F(NotificationHelperTest, CancelNotification_00002, Function | SmallTest | Level1)
218 {
219     std::string label = "Label";
220     int32_t notificationId = 10;
221     NotificationHelper notificationHelper;
222     ErrCode ret = notificationHelper.CancelNotification(label, notificationId);
223     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
224 }
225 
226 /**
227  * @tc.name: CancelAllNotifications_00001
228  * @tc.desc: Test CancelAllNotifications parameters.
229  * @tc.type: FUNC
230  * @tc.require: issueI5WRQ2
231  */
232 HWTEST_F(NotificationHelperTest, CancelAllNotifications_00001, Function | SmallTest | Level1)
233 {
234     NotificationHelper notificationHelper;
235     ErrCode ret = notificationHelper.CancelAllNotifications();
236     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
237 }
238 
239 /**
240  * @tc.name: CancelAsBundle_00001
241  * @tc.desc: Test CancelAsBundle parameters.
242  * @tc.type: FUNC
243  * @tc.require: issueI5WRQ2
244  */
245 HWTEST_F(NotificationHelperTest, CancelAsBundle_00001, Function | SmallTest | Level1)
246 {
247     int32_t notificationId = 10;
248     std::string representativeBundle = "RepresentativeBundle";
249     int32_t userId = 10;
250     NotificationHelper notificationHelper;
251     ErrCode ret = notificationHelper.CancelAsBundle(notificationId, representativeBundle, userId);
252     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_UID);
253 }
254 
255 /**
256  * @tc.name: GetActiveNotificationNums_00001
257  * @tc.desc: Test GetActiveNotificationNums parameters.
258  * @tc.type: FUNC
259  * @tc.require: issueI5WRQ2
260  */
261 HWTEST_F(NotificationHelperTest, GetActiveNotificationNums_00001, Function | SmallTest | Level1)
262 {
263     uint64_t num = 10;
264     NotificationHelper notificationHelper;
265     ErrCode ret = notificationHelper.GetActiveNotificationNums(num);
266     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
267 }
268 
269 /**
270  * @tc.name: GetActiveNotifications_00001
271  * @tc.desc: Test GetActiveNotifications parameters.
272  * @tc.type: FUNC
273  * @tc.require: issueI5WRQ2
274  */
275 HWTEST_F(NotificationHelperTest, GetActiveNotifications_00001, Function | SmallTest | Level1)
276 {
277     std::vector<sptr<NotificationRequest>> request;
278     NotificationHelper notificationHelper;
279     ErrCode ret = notificationHelper.GetActiveNotifications(request);
280     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
281 }
282 
283 /**
284  * @tc.name: GetCurrentAppSorting_00001
285  * @tc.desc: Test GetCurrentAppSorting parameters.
286  * @tc.type: FUNC
287  * @tc.require: issueI5WRQ2
288  */
289 HWTEST_F(NotificationHelperTest, GetCurrentAppSorting_00001, Function | SmallTest | Level1)
290 {
291     sptr<NotificationSortingMap> sortingMap = nullptr;
292     NotificationHelper notificationHelper;
293     ErrCode ret = notificationHelper.GetCurrentAppSorting(sortingMap);
294     EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED);
295 }
296 
297 /**
298  * @tc.name: SetNotificationAgent_00001
299  * @tc.desc: Test SetNotificationAgent parameters.
300  * @tc.type: FUNC
301  * @tc.require: issueI5WRQ2
302  */
303 HWTEST_F(NotificationHelperTest, SetNotificationAgent_00001, Function | SmallTest | Level1)
304 {
305     std::string agent = "Agent";
306     NotificationHelper notificationHelper;
307     ErrCode ret = notificationHelper.SetNotificationAgent(agent);
308     EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION);
309 }
310 
311 /**
312  * @tc.name: GetNotificationAgent_00001
313  * @tc.desc: Test GetNotificationAgent parameters.
314  * @tc.type: FUNC
315  * @tc.require: issueI5WRQ2
316  */
317 HWTEST_F(NotificationHelperTest, GetNotificationAgent_00001, Function | SmallTest | Level1)
318 {
319     std::string agent = "Agent";
320     NotificationHelper notificationHelper;
321     ErrCode ret = notificationHelper.GetNotificationAgent(agent);
322     EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION);
323 }
324 
325 /**
326  * @tc.name: CanPublishNotificationAsBundle_00001
327  * @tc.desc: Test CanPublishNotificationAsBundle parameters.
328  * @tc.type: FUNC
329  * @tc.require: issueI5WRQ2
330  */
331 HWTEST_F(NotificationHelperTest, CanPublishNotificationAsBundle_00001, Function | SmallTest | Level1)
332 {
333     std::string representativeBundle = "RepresentativeBundle";
334     bool canPublish = true;
335     NotificationHelper notificationHelper;
336     ErrCode ret = notificationHelper.CanPublishNotificationAsBundle(representativeBundle, canPublish);
337     EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION);
338 }
339 
340 /**
341  * @tc.name: PublishNotificationAsBundle_00001
342  * @tc.desc: Test PublishNotificationAsBundle parameters.
343  * @tc.type: FUNC
344  * @tc.require: issueI5WRQ2
345  */
346 HWTEST_F(NotificationHelperTest, PublishNotificationAsBundle_00001, Function | SmallTest | Level1)
347 {
348     std::string representativeBundle = "RepresentativeBundle";
349     NotificationRequest request;
350     NotificationHelper notificationHelper;
351     ErrCode ret = notificationHelper.PublishNotificationAsBundle(representativeBundle, request);
352     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
353 }
354 
355 /**
356  * @tc.name: SetNotificationBadgeNum_00001
357  * @tc.desc: Test SetNotificationBadgeNum parameters.
358  * @tc.type: FUNC
359  * @tc.require: issueI5WRQ2
360  */
361 HWTEST_F(NotificationHelperTest, SetNotificationBadgeNum_00001, Function | SmallTest | Level1)
362 {
363     NotificationHelper notificationHelper;
364     ErrCode ret = notificationHelper.SetNotificationBadgeNum();
365     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
366 }
367 
368 /**
369  * @tc.name: SetNotificationBadgeNum_00002
370  * @tc.desc: Test SetNotificationBadgeNum parameters.
371  * @tc.type: FUNC
372  * @tc.require: issueI5WRQ2
373  */
374 HWTEST_F(NotificationHelperTest, SetNotificationBadgeNum_00002, Function | SmallTest | Level1)
375 {
376     int32_t num = 10;
377     NotificationHelper notificationHelper;
378     ErrCode ret = notificationHelper.SetNotificationBadgeNum(num);
379     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
380 }
381 
382 /**
383  * @tc.name: IsAllowedNotify_00001
384  * @tc.desc: Test IsAllowedNotify parameters.
385  * @tc.type: FUNC
386  * @tc.require: issueI5WRQ2
387  */
388 HWTEST_F(NotificationHelperTest, IsAllowedNotify_00001, Function | SmallTest | Level1)
389 {
390     bool allowed = true;
391     NotificationHelper notificationHelper;
392     ErrCode ret = notificationHelper.IsAllowedNotify(allowed);
393     EXPECT_EQ(ret, (int)ERR_OK);
394 }
395 
396 /**
397  * @tc.name: IsAllowedNotifySelf_00001
398  * @tc.desc: Test IsAllowedNotifySelf parameters.
399  * @tc.type: FUNC
400  * @tc.require: issueI5WRQ2
401  */
402 HWTEST_F(NotificationHelperTest, IsAllowedNotifySelf_00001, Function | SmallTest | Level1)
403 {
404     bool allowed = true;
405     NotificationHelper notificationHelper;
406     ErrCode ret = notificationHelper.IsAllowedNotifySelf(allowed);
407     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
408 }
409 
410 /**
411  * @tc.name: RequestEnableNotification_00001
412  * @tc.desc: Test RequestEnableNotification parameters.
413  * @tc.type: FUNC
414  * @tc.require: issueI5WRQ2
415  */
416 HWTEST_F(NotificationHelperTest, RequestEnableNotification_00001, Function | SmallTest | Level1)
417 {
418     std::string deviceId = "DeviceId";
419     NotificationHelper notificationHelper;
420     ErrCode ret = notificationHelper.RequestEnableNotification(deviceId);
421     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
422 }
423 
424 /**
425  * @tc.name: AreNotificationsSuspended_00001
426  * @tc.desc: Test AreNotificationsSuspended parameters.
427  * @tc.type: FUNC
428  * @tc.require: issueI5WRQ2
429  */
430 HWTEST_F(NotificationHelperTest, AreNotificationsSuspended_00001, Function | SmallTest | Level1)
431 {
432     bool suspended = true;
433     NotificationHelper notificationHelper;
434     ErrCode ret = notificationHelper.AreNotificationsSuspended(suspended);
435     EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION);
436 }
437 
438 /**
439  * @tc.name: HasNotificationPolicyAccessPermission_00001
440  * @tc.desc: Test HasNotificationPolicyAccessPermission parameters.
441  * @tc.type: FUNC
442  * @tc.require: issueI5WRQ2
443  */
444 HWTEST_F(NotificationHelperTest, HasNotificationPolicyAccessPermission_00001, Function | SmallTest | Level1)
445 {
446     bool hasPermission = true;
447     NotificationHelper notificationHelper;
448     ErrCode ret = notificationHelper.HasNotificationPolicyAccessPermission(hasPermission);
449     EXPECT_EQ(ret, (int)ERR_OK);
450 }
451 
452 /**
453  * @tc.name: GetBundleImportance_00001
454  * @tc.desc: Test GetBundleImportance parameters.
455  * @tc.type: FUNC
456  * @tc.require: issueI5WRQ2
457  */
458 HWTEST_F(NotificationHelperTest, GetBundleImportance_00001, Function | SmallTest | Level1)
459 {
460     NotificationSlot::NotificationLevel importance = NotificationSlot::NotificationLevel::LEVEL_NONE;
461     NotificationHelper notificationHelper;
462     ErrCode ret = notificationHelper.GetBundleImportance(importance);
463     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
464 }
465 
466 /**
467  * @tc.name: RemoveNotification_00001
468  * @tc.desc: Test RemoveNotification parameters.
469  * @tc.type: FUNC
470  * @tc.require: issueI5WRQ2
471  */
472 HWTEST_F(NotificationHelperTest, RemoveNotification_00001, Function | SmallTest | Level1)
473 {
474     std::string key = "Key";
475     int32_t removeReason = 2;
476     NotificationHelper notificationHelper;
477     ErrCode ret = notificationHelper.RemoveNotification(key, removeReason);
478     EXPECT_EQ(ret, (int)ERR_ANS_NOTIFICATION_NOT_EXISTS);
479 }
480 
481 /**
482  * @tc.name: RemoveNotification_00002
483  * @tc.desc: Test RemoveNotification parameters.
484  * @tc.type: FUNC
485  * @tc.require: issueI5WRQ2
486  */
487 HWTEST_F(NotificationHelperTest, RemoveNotification_00002, Function | SmallTest | Level1)
488 {
489     NotificationBundleOption bundleOption;
490     int32_t notificationId = 10;
491     std::string label = "Label";
492     int32_t removeReason = 2;
493     NotificationHelper notificationHelper;
494     ErrCode ret = notificationHelper.RemoveNotification(bundleOption, notificationId, label, removeReason);
495     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
496 }
497 
498 /**
499  * @tc.name: RemoveAllNotifications_00001
500  * @tc.desc: Test RemoveAllNotifications parameters.
501  * @tc.type: FUNC
502  * @tc.require: issueI5WRQ2
503  */
504 HWTEST_F(NotificationHelperTest, RemoveAllNotifications_00001, Function | SmallTest | Level1)
505 {
506     NotificationBundleOption bundleOption;
507     NotificationHelper notificationHelper;
508     ErrCode ret = notificationHelper.RemoveAllNotifications(bundleOption);
509     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
510 }
511 
512 /**
513  * @tc.name: RemoveNotificationsByBundle_00001
514  * @tc.desc: Test RemoveNotificationsByBundle parameters.
515  * @tc.type: FUNC
516  * @tc.require: issueI5WRQ2
517  */
518 HWTEST_F(NotificationHelperTest, RemoveNotificationsByBundle_00001, Function | SmallTest | Level1)
519 {
520     NotificationBundleOption bundleOption;
521     NotificationHelper notificationHelper;
522     ErrCode ret = notificationHelper.RemoveNotificationsByBundle(bundleOption);
523     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
524 }
525 
526 /**
527  * @tc.name: RemoveNotifications_00001
528  * @tc.desc: Test RemoveNotifications parameters.
529  * @tc.type: FUNC
530  * @tc.require: issueI5WRQ2
531  */
532 HWTEST_F(NotificationHelperTest, RemoveNotifications_00001, Function | SmallTest | Level1)
533 {
534     NotificationHelper notificationHelper;
535     ErrCode ret = notificationHelper.RemoveNotifications();
536     EXPECT_EQ(ret, (int)ERR_OK);
537 }
538 
539 /**
540  * @tc.name: GetNotificationSlotsForBundle_00001
541  * @tc.desc: Test GetNotificationSlotsForBundle parameters.
542  * @tc.type: FUNC
543  * @tc.require: issueI5WRQ2
544  */
545 HWTEST_F(NotificationHelperTest, GetNotificationSlotsForBundle_00001, Function | SmallTest | Level1)
546 {
547     NotificationBundleOption bundleOption;
548     std::vector<sptr<NotificationSlot>> slots;
549     NotificationHelper notificationHelper;
550     ErrCode ret = notificationHelper.GetNotificationSlotsForBundle(bundleOption, slots);
551     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
552 }
553 
554 /**
555  * @tc.name: UpdateNotificationSlots_00001
556  * @tc.desc: Test UpdateNotificationSlots parameters.
557  * @tc.type: FUNC
558  * @tc.require: issueI5WRQ2
559  */
560 HWTEST_F(NotificationHelperTest, UpdateNotificationSlots_00001, Function | SmallTest | Level1)
561 {
562     NotificationBundleOption bundleOption;
563     std::vector<sptr<NotificationSlot>> slots;
564     NotificationHelper notificationHelper;
565     ErrCode ret = notificationHelper.UpdateNotificationSlots(bundleOption, slots);
566     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
567 }
568 
569 /**
570  * @tc.name: GetAllActiveNotifications_00001
571  * @tc.desc: Test GetAllActiveNotifications parameters.
572  * @tc.type: FUNC
573  * @tc.require: issueI5WRQ2
574  */
575 HWTEST_F(NotificationHelperTest, GetAllActiveNotifications_00001, Function | SmallTest | Level1)
576 {
577     std::vector<sptr<Notification>> notification;
578     NotificationHelper notificationHelper;
579     ErrCode ret = notificationHelper.GetAllActiveNotifications(notification);
580     EXPECT_EQ(ret, (int)ERR_OK);
581 }
582 
583 /**
584  * @tc.name: GetAllActiveNotifications_00002
585  * @tc.desc: Test GetAllActiveNotifications parameters.
586  * @tc.type: FUNC
587  * @tc.require: issueI5WRQ2
588  */
589 HWTEST_F(NotificationHelperTest, GetAllActiveNotifications_00002, Function | SmallTest | Level1)
590 {
591     std::vector<std::string> key;
592     std::vector<sptr<Notification>> notification;
593     NotificationHelper notificationHelper;
594     ErrCode ret = notificationHelper.GetAllActiveNotifications(key, notification);
595     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
596 }
597 
598 /**
599  * @tc.name: IsAllowedNotify_00002
600  * @tc.desc: Test IsAllowedNotify parameters.
601  * @tc.type: FUNC
602  * @tc.require: issueI5WRQ2
603  */
604 HWTEST_F(NotificationHelperTest, IsAllowedNotify_00002, Function | SmallTest | Level1)
605 {
606     NotificationBundleOption bundleOption;
607     bool allowed = true;
608     NotificationHelper notificationHelper;
609     ErrCode ret = notificationHelper.IsAllowedNotify(bundleOption, allowed);
610     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
611 }
612 
613 /**
614  * @tc.name: SetNotificationsEnabledForAllBundles_00001
615  * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters.
616  * @tc.type: FUNC
617  * @tc.require: issueI5WRQ2
618  */
619 HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00001, Function | SmallTest | Level1)
620 {
621     std::string deviceId = "DeviceId";
622     bool enabled = true;
623     NotificationHelper notificationHelper;
624     ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(deviceId, enabled);
625     EXPECT_EQ(ret, (int)ERR_OK);
626 }
627 
628 /**
629  * @tc.name: SetNotificationsEnabledForDefaultBundle_00001
630  * @tc.desc: Test SetNotificationsEnabledForDefaultBundle parameters.
631  * @tc.type: FUNC
632  * @tc.require: issueI5WRQ2
633  */
634 HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForDefaultBundle_00001, Function | SmallTest | Level1)
635 {
636     std::string deviceId = "DeviceId";
637     bool enabled = true;
638     NotificationHelper notificationHelper;
639     ErrCode ret = notificationHelper.SetNotificationsEnabledForDefaultBundle(deviceId, enabled);
640     EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION);
641 }
642 
643 /**
644  * @tc.name: SetShowBadgeEnabledForBundle_00001
645  * @tc.desc: Test SetShowBadgeEnabledForBundle parameters.
646  * @tc.type: FUNC
647  * @tc.require: issueI5WRQ2
648  */
649 HWTEST_F(NotificationHelperTest, SetShowBadgeEnabledForBundle_00001, Function | SmallTest | Level1)
650 {
651     NotificationBundleOption bundleOption;
652     bool enabled = true;
653     NotificationHelper notificationHelper;
654     ErrCode ret = notificationHelper.SetShowBadgeEnabledForBundle(bundleOption, enabled);
655     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
656 }
657 
658 /**
659  * @tc.name: GetShowBadgeEnabledForBundle_00001
660  * @tc.desc: Test GetShowBadgeEnabledForBundle parameters.
661  * @tc.type: FUNC
662  * @tc.require: issueI5WRQ2
663  */
664 HWTEST_F(NotificationHelperTest, GetShowBadgeEnabledForBundle_00001, Function | SmallTest | Level1)
665 {
666     NotificationBundleOption bundleOption;
667     bool enabled = true;
668     NotificationHelper notificationHelper;
669     ErrCode ret = notificationHelper.GetShowBadgeEnabledForBundle(bundleOption, enabled);
670     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
671 }
672 
673 /**
674  * @tc.name: GetShowBadgeEnabled_00001
675  * @tc.desc: Test GetShowBadgeEnabled parameters.
676  * @tc.type: FUNC
677  * @tc.require: issueI5WRQ2
678  */
679 HWTEST_F(NotificationHelperTest, GetShowBadgeEnabled_00001, Function | SmallTest | Level1)
680 {
681     bool enabled = true;
682     NotificationHelper notificationHelper;
683     ErrCode ret = notificationHelper.GetShowBadgeEnabled(enabled);
684     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
685 }
686 
687 /**
688  * @tc.name: CancelGroup_00001
689  * @tc.desc: Test CancelGroup parameters.
690  * @tc.type: FUNC
691  * @tc.require: issueI5WRQ2
692  */
693 HWTEST_F(NotificationHelperTest, CancelGroup_00001, Function | SmallTest | Level1)
694 {
695     std::string groupName = "GroupName";
696     NotificationHelper notificationHelper;
697     ErrCode ret = notificationHelper.CancelGroup(groupName);
698     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
699 }
700 
701 /**
702  * @tc.name: RemoveGroupByBundle_00001
703  * @tc.desc: Test RemoveGroupByBundle parameters.
704  * @tc.type: FUNC
705  * @tc.require: issueI5WRQ2
706  */
707 HWTEST_F(NotificationHelperTest, RemoveGroupByBundle_00001, Function | SmallTest | Level1)
708 {
709     NotificationBundleOption bundleOption;
710     std::string groupName = "GroupName";
711     NotificationHelper notificationHelper;
712     ErrCode ret = notificationHelper.RemoveGroupByBundle(bundleOption, groupName);
713     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
714 }
715 
716 /**
717  * @tc.name: SetDoNotDisturbDate_00001
718  * @tc.desc: Test SetDoNotDisturbDate parameters.
719  * @tc.type: FUNC
720  * @tc.require: issueI5WRQ2
721  */
722 HWTEST_F(NotificationHelperTest, SetDoNotDisturbDate_00001, Function | SmallTest | Level1)
723 {
724     NotificationDoNotDisturbDate doNotDisturbDate;
725     NotificationHelper notificationHelper;
726     ErrCode ret = notificationHelper.SetDoNotDisturbDate(doNotDisturbDate);
727     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
728 }
729 
730 /**
731  * @tc.name: GetDoNotDisturbDate_00001
732  * @tc.desc: Test GetDoNotDisturbDate parameters.
733  * @tc.type: FUNC
734  * @tc.require: issueI5WRQ2
735  */
736 HWTEST_F(NotificationHelperTest, GetDoNotDisturbDate_00001, Function | SmallTest | Level1)
737 {
738     NotificationDoNotDisturbDate doNotDisturbDate;
739     NotificationHelper notificationHelper;
740     ErrCode ret = notificationHelper.GetDoNotDisturbDate(doNotDisturbDate);
741     EXPECT_EQ(ret, (int)ERR_OK);
742 }
743 
744 /**
745  * @tc.name: DoesSupportDoNotDisturbMode_00001
746  * @tc.desc: Test DoesSupportDoNotDisturbMode parameters.
747  * @tc.type: FUNC
748  * @tc.require: issueI5WRQ2
749  */
750 HWTEST_F(NotificationHelperTest, DoesSupportDoNotDisturbMode_00001, Function | SmallTest | Level1)
751 {
752     bool doesSupport = true;
753     NotificationHelper notificationHelper;
754     ErrCode ret = notificationHelper.DoesSupportDoNotDisturbMode(doesSupport);
755     EXPECT_EQ(ret, (int)ERR_OK);
756 }
757 
758 /**
759  * @tc.name: IsDistributedEnabled_00001
760  * @tc.desc: Test IsDistributedEnabled parameters.
761  * @tc.type: FUNC
762  * @tc.require: issueI5WRQ2
763  */
764 HWTEST_F(NotificationHelperTest, IsDistributedEnabled_00001, Function | SmallTest | Level1)
765 {
766     bool enabled = true;
767     NotificationHelper notificationHelper;
768     ErrCode ret = notificationHelper.IsDistributedEnabled(enabled);
769     EXPECT_EQ(ret, (int)ERR_OK);
770 }
771 
772 /**
773  * @tc.name: EnableDistributed_00001
774  * @tc.desc: Test EnableDistributed parameters.
775  * @tc.type: FUNC
776  * @tc.require: issueI5WRQ2
777  */
778 HWTEST_F(NotificationHelperTest, EnableDistributed_00001, Function | SmallTest | Level1)
779 {
780     bool enabled = true;
781     NotificationHelper notificationHelper;
782     ErrCode ret = notificationHelper.EnableDistributed(enabled);
783     EXPECT_EQ(ret, (int)ERR_OK);
784 }
785 
786 /**
787  * @tc.name: EnableDistributedByBundle_00001
788  * @tc.desc: Test EnableDistributedByBundle parameters.
789  * @tc.type: FUNC
790  * @tc.require: issueI5WRQ2
791  */
792 HWTEST_F(NotificationHelperTest, EnableDistributedByBundle_00001, Function | SmallTest | Level1)
793 {
794     NotificationBundleOption bundleOption;
795     bool enabled = true;
796     NotificationHelper notificationHelper;
797     ErrCode ret = notificationHelper.EnableDistributedByBundle(bundleOption, enabled);
798     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
799 }
800 
801 /**
802  * @tc.name: EnableDistributedSelf_00001
803  * @tc.desc: Test EnableDistributedSelf parameters.
804  * @tc.type: FUNC
805  * @tc.require: issueI5WRQ2
806  */
807 HWTEST_F(NotificationHelperTest, EnableDistributedSelf_00001, Function | SmallTest | Level1)
808 {
809     bool enabled = true;
810     NotificationHelper notificationHelper;
811     ErrCode ret = notificationHelper.EnableDistributedSelf(enabled);
812     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
813 }
814 
815 /**
816  * @tc.name: IsDistributedEnableByBundle_00001
817  * @tc.desc: Test IsDistributedEnableByBundle parameters.
818  * @tc.type: FUNC
819  * @tc.require: issueI5WRQ2
820  */
821 HWTEST_F(NotificationHelperTest, IsDistributedEnableByBundle_00001, Function | SmallTest | Level1)
822 {
823     NotificationBundleOption bundleOption;
824     bool enabled = true;
825     NotificationHelper notificationHelper;
826     ErrCode ret = notificationHelper.IsDistributedEnableByBundle(bundleOption, enabled);
827     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
828 }
829 
830 /**
831  * @tc.name: GetDeviceRemindType_00001
832  * @tc.desc: Test GetDeviceRemindType parameters.
833  * @tc.type: FUNC
834  * @tc.require: issueI5WRQ2
835  */
836 HWTEST_F(NotificationHelperTest, GetDeviceRemindType_00001, Function | SmallTest | Level1)
837 {
838     NotificationConstant::RemindType remindType = NotificationConstant::RemindType::DEVICE_ACTIVE_REMIND;
839     NotificationHelper notificationHelper;
840     ErrCode ret = notificationHelper.GetDeviceRemindType(remindType);
841     EXPECT_EQ(ret, (int)ERR_OK);
842 }
843 
844 /**
845  * @tc.name: PublishContinuousTaskNotification_00001
846  * @tc.desc: Test PublishContinuousTaskNotification parameters.
847  * @tc.type: FUNC
848  * @tc.require: issueI5WRQ2
849  */
850 HWTEST_F(NotificationHelperTest, PublishContinuousTaskNotification_00001, Function | SmallTest | Level1)
851 {
852     NotificationRequest request;
853     NotificationHelper notificationHelper;
854     ErrCode ret = notificationHelper.PublishContinuousTaskNotification(request);
855     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
856 }
857 
858 /**
859  * @tc.name: CancelContinuousTaskNotification_00001
860  * @tc.desc: Test CancelContinuousTaskNotification parameters.
861  * @tc.type: FUNC
862  * @tc.require: issueI5WRQ2
863  */
864 HWTEST_F(NotificationHelperTest, CancelContinuousTaskNotification_00001, Function | SmallTest | Level1)
865 {
866     std::string label = "label";
867     int32_t notificationId = 10;
868     NotificationHelper notificationHelper;
869     ErrCode ret = notificationHelper.CancelContinuousTaskNotification(label, notificationId);
870     EXPECT_EQ(ret, (int)ERR_OK);
871 }
872 
873 /**
874  * @tc.name: IsSupportTemplate_00001
875  * @tc.desc: Test IsSupportTemplate parameters.
876  * @tc.type: FUNC
877  * @tc.require: issueI5WRQ2
878  */
879 HWTEST_F(NotificationHelperTest, IsSupportTemplate_00001, Function | SmallTest | Level1)
880 {
881     std::string templateName = "TemplateName";
882     bool support = true;
883     NotificationHelper notificationHelper;
884     ErrCode ret = notificationHelper.IsSupportTemplate(templateName, support);
885     EXPECT_EQ(ret, (int)ERR_OK);
886 }
887 
888 /**
889  * @tc.name: SetNotificationsEnabledForAllBundles_00002
890  * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters.
891  * @tc.type: FUNC
892  * @tc.require: issueI5WRQ2
893  */
894 HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00002, Function | SmallTest | Level1)
895 {
896     int32_t userId = 10;
897     bool enabled = true;
898     NotificationHelper notificationHelper;
899     ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(userId, enabled);
900     EXPECT_EQ(ret, (int)ERR_OK);
901 }
902 
903 /**
904  * @tc.name: IsSupportTemplate_00002
905  * @tc.desc: Test IsSupportTemplate parameters.
906  * @tc.type: FUNC
907  * @tc.require: issueI5WRQ2
908  */
909 HWTEST_F(NotificationHelperTest, IsSupportTemplate_00002, Function | SmallTest | Level1)
910 {
911     std::string templateName = "TemplateName";
912     bool support = true;
913     NotificationHelper notificationHelper;
914     ErrCode ret = notificationHelper.IsSupportTemplate(templateName, support);
915     EXPECT_EQ(ret, (int)ERR_OK);
916 }
917 
918 /**
919  * @tc.name: IsAllowedNotify_00004
920  * @tc.desc: Test IsAllowedNotify parameters.
921  * @tc.type: FUNC
922  * @tc.require: issueI5WRQ2
923  */
924 HWTEST_F(NotificationHelperTest, IsAllowedNotify_00004, Function | SmallTest | Level1)
925 {
926     int32_t userId = 10;
927     bool allowed = true;
928     NotificationHelper notificationHelper;
929     ErrCode ret = notificationHelper.IsAllowedNotify(userId, allowed);
930     EXPECT_EQ(ret, (int)ERR_OK);
931 }
932 
933 /**
934  * @tc.name: SetNotificationsEnabledForAllBundles_00003
935  * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters.
936  * @tc.type: FUNC
937  * @tc.require: issueI5WRQ2
938  */
939 HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00003, Function | SmallTest | Level1)
940 {
941     int32_t userId = 10;
942     bool enabled = true;
943     NotificationHelper notificationHelper;
944     ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(userId, enabled);
945     EXPECT_EQ(ret, (int)ERR_OK);
946 }
947 
948 /**
949  * @tc.name: RemoveNotifications_00002
950  * @tc.desc: Test RemoveNotifications parameters.
951  * @tc.type: FUNC
952  * @tc.require: issueI5WRQ2
953  */
954 HWTEST_F(NotificationHelperTest, RemoveNotifications_00002, Function | SmallTest | Level1)
955 {
956     int32_t userId = 10;
957     NotificationHelper notificationHelper;
958     ErrCode ret = notificationHelper.RemoveNotifications(userId);
959     EXPECT_EQ(ret, (int)ERR_OK);
960 }
961 
962 /**
963  * @tc.name: SetDoNotDisturbDate_00002
964  * @tc.desc: Test SetDoNotDisturbDate parameters.
965  * @tc.type: FUNC
966  * @tc.require: issueI5WRQ2
967  */
968 HWTEST_F(NotificationHelperTest, SetDoNotDisturbDate_00002, Function | SmallTest | Level1)
969 {
970     int32_t userId = 10;
971     NotificationDoNotDisturbDate doNotDisturbDate;
972     NotificationHelper notificationHelper;
973     ErrCode ret = notificationHelper.SetDoNotDisturbDate(userId, doNotDisturbDate);
974     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE);
975 }
976 
977 /**
978  * @tc.name: GetDoNotDisturbDate_00002
979  * @tc.desc: Test GetDoNotDisturbDate parameters.
980  * @tc.type: FUNC
981  * @tc.require: issueI5WRQ2
982  */
983 HWTEST_F(NotificationHelperTest, GetDoNotDisturbDate_00002, Function | SmallTest | Level1)
984 {
985     int32_t userId = 10;
986     NotificationDoNotDisturbDate doNotDisturbDate;
987     NotificationHelper notificationHelper;
988     ErrCode ret = notificationHelper.GetDoNotDisturbDate(userId, doNotDisturbDate);
989     EXPECT_EQ(ret, (int)ERR_OK);
990 }
991 
992 /**
993  * @tc.name: SetEnabledForBundleSlot_00001
994  * @tc.desc: Test SetEnabledForBundleSlot parameters.
995  * @tc.type: FUNC
996  * @tc.require: issueI5WRQ2
997  */
998 HWTEST_F(NotificationHelperTest, SetEnabledForBundleSlot_00001, Function | SmallTest | Level1)
999 {
1000     NotificationBundleOption bundleOption;
1001     NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER;
1002     bool enabled = true;
1003     NotificationHelper notificationHelper;
1004     ErrCode ret = notificationHelper.SetEnabledForBundleSlot(bundleOption, slotType, enabled);
1005     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
1006 }
1007 
1008 /**
1009  * @tc.name: GetEnabledForBundleSlot_00001
1010  * @tc.desc: Test GetEnabledForBundleSlot parameters.
1011  * @tc.type: FUNC
1012  * @tc.require: issueI5WRQ2
1013  */
1014 HWTEST_F(NotificationHelperTest, GetEnabledForBundleSlot_00001, Function | SmallTest | Level1)
1015 {
1016     NotificationBundleOption bundleOption;
1017     NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER;
1018     bool enabled = true;
1019     NotificationHelper notificationHelper;
1020     ErrCode ret = notificationHelper.GetEnabledForBundleSlot(bundleOption, slotType, enabled);
1021     EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM);
1022 }
1023 
1024 /**
1025  * @tc.name: SetSyncNotificationEnabledWithoutApp_00001
1026  * @tc.desc: Test SetSyncNotificationEnabledWithoutApp parameters.
1027  * @tc.type: FUNC
1028  * @tc.require: issueI5WRQ2
1029  */
1030 HWTEST_F(NotificationHelperTest, SetSyncNotificationEnabledWithoutApp_00001, Function | SmallTest | Level1)
1031 {
1032     int32_t userId = 10;
1033     bool enabled = true;
1034     NotificationHelper notificationHelper;
1035     ErrCode ret = notificationHelper.SetSyncNotificationEnabledWithoutApp(userId, enabled);
1036     EXPECT_EQ(ret, (int)ERR_OK);
1037 }
1038 
1039 /**
1040  * @tc.name: GetSyncNotificationEnabledWithoutApp_00001
1041  * @tc.desc: Test GetSyncNotificationEnabledWithoutApp parameters.
1042  * @tc.type: FUNC
1043  * @tc.require: issueI5WRQ2
1044  */
1045 HWTEST_F(NotificationHelperTest, GetSyncNotificationEnabledWithoutApp_00001, Function | SmallTest | Level1)
1046 {
1047     int32_t userId = 10;
1048     bool enabled = true;
1049     NotificationHelper notificationHelper;
1050     ErrCode ret = notificationHelper.GetSyncNotificationEnabledWithoutApp(userId, enabled);
1051     EXPECT_EQ(ret, (int)ERR_OK);
1052 }
1053 }
1054 }