• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 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 "mock_notification_helper.h"
17 
18 #include "notification_helper.h"
19 
20 namespace OHOS::Notification {
21 namespace {
22 bool g_mockIsAllowUseReminder = true;
23 bool g_mockIsAllowedNotify = true;
24 int32_t g_mockIsAllowedNotifyRet = 0;
25 }
26 
MockIsAllowUseReminder(const bool isAllowUseReminder)27 void MockNotificationHelper::MockIsAllowUseReminder(const bool isAllowUseReminder)
28 {
29     g_mockIsAllowUseReminder = isAllowUseReminder;
30 }
31 
MockIsAllowedNotify(const bool isAllowedNotify,const int32_t ret)32 void MockNotificationHelper::MockIsAllowedNotify(const bool isAllowedNotify, const int32_t ret)
33 {
34     g_mockIsAllowedNotify = isAllowedNotify;
35     g_mockIsAllowedNotifyRet = ret;
36 }
37 
AllowUseReminder(const std::string & bundleName,bool & isAllowUseReminder)38 ErrCode NotificationHelper::AllowUseReminder(const std::string& bundleName, bool& isAllowUseReminder)
39 {
40     isAllowUseReminder = g_mockIsAllowUseReminder;
41     return 0;
42 }
43 
IsAllowedNotify(const NotificationBundleOption & bundleOption,bool & allowed)44 ErrCode NotificationHelper::IsAllowedNotify(const NotificationBundleOption& bundleOption, bool& allowed)
45 {
46     allowed = g_mockIsAllowedNotify;
47     return g_mockIsAllowedNotifyRet;
48 }
49 } // namespace OHOS::Notification