1 /* 2 * Copyright (c) 2023 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 "advanced_notification_service.h" 17 #include "ans_inner_errors.h" 18 19 namespace { 20 bool g_mockGetDistributedEnableInApplicationInfoRet = true; 21 bool g_mockAppInfoEnableRet = true; 22 } 23 MockGetDistributedEnableInApplicationInfo(bool mockRet,uint8_t mockCase=0)24void MockGetDistributedEnableInApplicationInfo(bool mockRet, uint8_t mockCase = 0) 25 { 26 g_mockGetDistributedEnableInApplicationInfoRet = mockRet; 27 switch (mockCase) { 28 case 1: { // mock for appInfoEnable 29 g_mockAppInfoEnableRet = true; 30 break; 31 } 32 default:{ 33 g_mockAppInfoEnableRet = false; 34 break; 35 } 36 } 37 } 38 39 namespace OHOS { 40 namespace Notification { GetDistributedEnableInApplicationInfo(const sptr<NotificationBundleOption> bundleOption,bool & enable)41ErrCode AdvancedNotificationService::GetDistributedEnableInApplicationInfo( 42 const sptr<NotificationBundleOption> bundleOption, bool &enable) 43 { 44 enable = g_mockAppInfoEnableRet; 45 if (g_mockGetDistributedEnableInApplicationInfoRet == false) { 46 return ERR_ANS_INVALID_PARAM; 47 } 48 return ERR_OK; 49 } 50 } // namespace Notification 51 } // namespace OHOS