1 /* 2 * Copyright (c) 2021 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 #ifndef NOTIFICATION_FUZZTESTMANAGER_H 16 #define NOTIFICATION_FUZZTESTMANAGER_H 17 18 #include <map> 19 #include <unordered_map> 20 21 #include "nlohmann/json.hpp" 22 namespace OHOS { 23 namespace Notification { 24 class NotificationFuzzTestManager { 25 public: 26 using Ptr = std::shared_ptr<NotificationFuzzTestManager>; ~NotificationFuzzTestManager()27 ~NotificationFuzzTestManager() 28 {} GetInstance()29 static Ptr GetInstance() 30 { 31 if (instance == nullptr) { 32 NotificationFuzzTestManager* pObj = new NotificationFuzzTestManager(); 33 instance = std::shared_ptr<NotificationFuzzTestManager>(pObj); 34 } 35 return instance; 36 } 37 38 void StartFuzzTest(); 39 40 private: 41 void SetJsonFunction(std::string functionName); 42 void SetCycle(uint16_t cycle); 43 NotificationFuzzTestManager(); 44 NotificationFuzzTestManager(const NotificationFuzzTestManager &) = delete; 45 NotificationFuzzTestManager &operator=(const NotificationFuzzTestManager &) = delete; 46 static Ptr instance; 47 uint16_t cycle_ = 0; 48 std::unordered_map<std::string, int> remainderMap_ {}; 49 std::unordered_map<std::string, std::function<void()>> callFunctionMap_ {}; 50 51 const int COLOR_R = 100; 52 const int COLOR_G = 100; 53 const int COLOR_B = 100; 54 void RegisterNotificationHelper(); 55 void RegisterNotificationSorting(); 56 void RegisterNotificationSortingMap(); 57 void RegisterNotificationSubscribeInfo(); 58 void RegisterNotificationSubscriber(); 59 void RegisterWantAgentHelper(); 60 void RegisterLauncherService(); 61 void RegisterNapiBundlemgr(); 62 void RegisterIAbilityContinuation(); 63 void RegisterRevocable(); 64 void RegisterTaskDispatcher(); 65 void RegisterAbility(); 66 void RegisterAbilityContext(); 67 void RegisterContext(); 68 void RegisterAbilityLifecycleCallbacks(); 69 void RegisterIAbilityManager(); 70 friend class TestAnsSubscriber; 71 }; 72 } // namespace EventFwk 73 } // namespace OHOS 74 75 #endif