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 OS_ACCOUNT_TEST_SYSTEMTEST_COMMON_RESOURCE_FUZZTEST_INCLUDE_FUZZ_TEST_MANAGER_H 16 #define OS_ACCOUNT_TEST_SYSTEMTEST_COMMON_RESOURCE_FUZZTEST_INCLUDE_FUZZ_TEST_MANAGER_H 17 18 #include <functional> 19 #include <map> 20 #include <memory> 21 #include <string> 22 #include <unordered_map> 23 #include "nlohmann/json.hpp" 24 25 namespace OHOS { 26 namespace AccountSA { 27 class FuzzTestManager { 28 public: 29 using Ptr = std::shared_ptr<FuzzTestManager>; ~FuzzTestManager()30 ~FuzzTestManager() 31 {} 32 GetInstance()33 static Ptr GetInstance() 34 { 35 if (instance_ == nullptr) { 36 instance_ = std::make_shared<FuzzTestManager>(); 37 } 38 return instance_; 39 } 40 41 void StartFuzzTest(); 42 FuzzTestManager(); 43 44 private: 45 void SetJsonFunction(std::string functionName); 46 void SetCycle(uint16_t cycle); 47 FuzzTestManager(FuzzTestManager &) = delete; 48 FuzzTestManager &operator=(const FuzzTestManager &) = delete; 49 static Ptr instance_; 50 uint16_t cycle_ {}; 51 std::unordered_map<std::string, int> remainderMap_ {}; 52 std::unordered_map<std::string, std::function<void()>> callFunctionMap_ {}; 53 54 void RegisterAppAccountManager(); 55 void RegisterOsAccountManager(); 56 }; 57 } // namespace AccountSA 58 } // namespace OHOS 59 60 #endif // OS_ACCOUNT_TEST_SYSTEMTEST_COMMON_RESOURCE_FUZZTEST_INCLUDE_FUZZ_TEST_MANAGER_H 61