1 /* 2 * Copyright (c) 2023-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 #ifndef BASE_NOTIFICATION_MOCK_ANS_SUBCRIBER_OBJECT_H 17 #define BASE_NOTIFICATION_MOCK_ANS_SUBCRIBER_OBJECT_H 18 19 #include "gmock/gmock.h" 20 #include "ians_subscriber.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class MockAnsSubscriber : public IAnsSubscriber { 25 public: MockAnsSubscriber()26 MockAnsSubscriber() {} ~MockAnsSubscriber()27 ~MockAnsSubscriber() {} 28 AsObject()29 sptr<IRemoteObject> AsObject() override 30 { 31 return nullptr; 32 } OnConnected()33 ErrCode OnConnected() override { return ERR_OK; }; 34 OnDisconnected()35 ErrCode OnDisconnected() override { return ERR_OK; }; 36 OnConsumed(const sptr<Notification> & notification,const sptr<NotificationSortingMap> & notificationMap)37 ErrCode OnConsumed( 38 const sptr<Notification> ¬ification, 39 const sptr<NotificationSortingMap> ¬ificationMap) override { return ERR_OK; }; 40 OnConsumed(const sptr<Notification> & notification)41 ErrCode OnConsumed(const sptr<Notification> ¬ification) override { return ERR_OK; }; 42 OnConsumedWithMaxCapacity(const sptr<Notification> & notification,const sptr<NotificationSortingMap> & notificationMap)43 ErrCode OnConsumedWithMaxCapacity( 44 const sptr<Notification> ¬ification, 45 const sptr<NotificationSortingMap> ¬ificationMap) override { return ERR_OK; }; 46 OnConsumedWithMaxCapacity(const sptr<Notification> & notification)47 ErrCode OnConsumedWithMaxCapacity(const sptr<Notification> ¬ification) override { return ERR_OK; }; 48 49 MOCK_METHOD(ErrCode, OnConsumedList, (const std::vector<sptr<Notification>> ¬ifications, 50 const sptr<NotificationSortingMap> ¬ificationMap)); 51 52 MOCK_METHOD(ErrCode, OnConsumedList, (const std::vector<sptr<Notification>> ¬ifications)); 53 OnCanceled(const sptr<Notification> & notification,const sptr<NotificationSortingMap> & notificationMap,int32_t deleteReason)54 ErrCode OnCanceled(const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap, 55 int32_t deleteReason) override { return ERR_OK; }; 56 OnCanceled(const sptr<Notification> & notification,int32_t deleteReason)57 ErrCode OnCanceled(const sptr<Notification> ¬ification, int32_t deleteReason) override { return ERR_OK; }; 58 OnCanceledWithMaxCapacity(const sptr<Notification> & notification,const sptr<NotificationSortingMap> & notificationMap,int32_t deleteReason)59 ErrCode OnCanceledWithMaxCapacity( 60 const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap, 61 int32_t deleteReason) override { return ERR_OK; }; 62 OnCanceledWithMaxCapacity(const sptr<Notification> & notification,int32_t deleteReason)63 ErrCode OnCanceledWithMaxCapacity( 64 const sptr<Notification> ¬ification, int32_t deleteReason) override { return ERR_OK; }; 65 OnCanceledList(const std::vector<sptr<Notification>> & notifications,const sptr<NotificationSortingMap> & notificationMap,int32_t deleteReason)66 ErrCode OnCanceledList(const std::vector<sptr<Notification>> ¬ifications, 67 const sptr<NotificationSortingMap> ¬ificationMap, int32_t deleteReason) override { return ERR_OK; }; 68 OnCanceledList(const std::vector<sptr<Notification>> & notifications,int32_t deleteReason)69 ErrCode OnCanceledList( 70 const std::vector<sptr<Notification>> ¬ifications, int32_t deleteReason) override { return ERR_OK; }; 71 OnUpdated(const sptr<NotificationSortingMap> & notificationMap)72 ErrCode OnUpdated(const sptr<NotificationSortingMap> ¬ificationMap) override { return ERR_OK; }; 73 OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> & date)74 ErrCode OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) override { return ERR_OK; }; 75 OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> & callbackData)76 ErrCode OnEnabledNotificationChanged( 77 const sptr<EnabledNotificationCallbackData> &callbackData) override { return ERR_OK; }; 78 OnBadgeChanged(const sptr<BadgeNumberCallbackData> & badgeData)79 ErrCode OnBadgeChanged(const sptr<BadgeNumberCallbackData> &badgeData) override { return ERR_OK; }; 80 OnBadgeEnabledChanged(const sptr<EnabledNotificationCallbackData> & callbackData)81 ErrCode OnBadgeEnabledChanged( 82 const sptr<EnabledNotificationCallbackData> &callbackData) override { return ERR_OK; }; 83 OnApplicationInfoNeedChanged(const std::string & bundleName)84 ErrCode OnApplicationInfoNeedChanged(const std::string& bundleName) override { return ERR_OK; }; 85 OnOperationResponse(const sptr<NotificationOperationInfo> & operationInfo,int32_t & funcResult)86 ErrCode OnOperationResponse( 87 const sptr<NotificationOperationInfo>& operationInfo, int32_t& funcResult) override { return 0; } 88 }; 89 } // namespace Notification 90 } // namespace OHOS 91 #endif 92