diff --git a/test/fuzztest/commoneventmanagerservice/servicedumpstate_fuzzer/dumpstate_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicedumpstate_fuzzer/dumpstate_fuzzer.cpp index 900668d06b309910289b92b0ab9a97f952ad9431..e8883423af7f17b3cf55a789a5f3385263b3da00 100644 --- a/test/fuzztest/commoneventmanagerservice/servicedumpstate_fuzzer/dumpstate_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicedumpstate_fuzzer/dumpstate_fuzzer.cpp @@ -27,7 +27,7 @@ using namespace OHOS::EventFwk; namespace OHOS { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); AAFwk::Want want; diff --git a/test/fuzztest/commoneventmanagerservice/servicefinishreceiver_fuzzer/finishreceiver_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicefinishreceiver_fuzzer/finishreceiver_fuzzer.cpp index 226aa51802143901bee258ef3fde07a3f19e4171..198890128bda5ef95ed8e4adb1688f470d715b56 100644 --- a/test/fuzztest/commoneventmanagerservice/servicefinishreceiver_fuzzer/finishreceiver_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicefinishreceiver_fuzzer/finishreceiver_fuzzer.cpp @@ -41,7 +41,7 @@ public: bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); MatchingSkills matchingSkills; @@ -58,6 +58,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) bool funcResult1 = false; service->FinishReceiver(commonEventListener, fdp->ConsumeIntegral(), fdp->ConsumeRandomLengthString(), fdp->ConsumeBool(), funcResult1); + usleep(10000); return true; } } diff --git a/test/fuzztest/commoneventmanagerservice/servicefreezeandunfreeze_fuzzer/freezeandunfreeze_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicefreezeandunfreeze_fuzzer/freezeandunfreeze_fuzzer.cpp index 7914f26df914493ed35c96d8ee4f31f8cd8aa99b..e9766beaafe10d701d0c8e450db5865127906383 100644 --- a/test/fuzztest/commoneventmanagerservice/servicefreezeandunfreeze_fuzzer/freezeandunfreeze_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicefreezeandunfreeze_fuzzer/freezeandunfreeze_fuzzer.cpp @@ -26,7 +26,7 @@ using namespace OHOS::EventFwk; namespace OHOS { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); bool funcResult1 = false; @@ -38,6 +38,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) pidList.insert(fdp->ConsumeIntegral()); } service->SetFreezeStatus(pidList, fdp->ConsumeBool(), funcResult1); + usleep(10000); return true; } } diff --git a/test/fuzztest/commoneventmanagerservice/servicepublishcommonevent_fuzzer/publishcommonevent_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicepublishcommonevent_fuzzer/publishcommonevent_fuzzer.cpp index ccaf5c1f3637d5894ab06e91ce68e2c54bf92f87..ace4d39deb88d49f74e7144f8961197e4a2ee86a 100644 --- a/test/fuzztest/commoneventmanagerservice/servicepublishcommonevent_fuzzer/publishcommonevent_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicepublishcommonevent_fuzzer/publishcommonevent_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); AAFwk::Want want; diff --git a/test/fuzztest/commoneventmanagerservice/servicesetstaticsubscriberstate_fuzzer/setstaticsubscriberstate_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicesetstaticsubscriberstate_fuzzer/setstaticsubscriberstate_fuzzer.cpp index 3fe8c9a016ade55700aca2f5d65b851a95779f3c..762571f5e794a717a6b790b21ae3c76686442b5d 100644 --- a/test/fuzztest/commoneventmanagerservice/servicesetstaticsubscriberstate_fuzzer/setstaticsubscriberstate_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicesetstaticsubscriberstate_fuzzer/setstaticsubscriberstate_fuzzer.cpp @@ -26,7 +26,7 @@ using namespace OHOS::EventFwk; namespace OHOS { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); std::vector events; @@ -35,6 +35,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) } int32_t funcResult1 = -1; service->SetStaticSubscriberStateByEvents(events, fdp->ConsumeBool(), funcResult1); + usleep(10000); return true; } } diff --git a/test/fuzztest/commoneventmanagerservice/servicestickycommonevent_fuzzer/stickycommonevent_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicestickycommonevent_fuzzer/stickycommonevent_fuzzer.cpp index ace9548182e7096394c4ef2c88537737feea8207..999711ca558fc7e88f377e449d929943b3177b53 100644 --- a/test/fuzztest/commoneventmanagerservice/servicestickycommonevent_fuzzer/stickycommonevent_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicestickycommonevent_fuzzer/stickycommonevent_fuzzer.cpp @@ -27,7 +27,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { std::string event = fdp->ConsumeRandomLengthString(); - sptr service = EventFwk::CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) EventFwk::CommonEventManagerService(); service->Init(); AAFwk::Want want; @@ -47,6 +47,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) service->GetStickyCommonEvent(fdp->ConsumeRandomLengthString(), stickyCommonEvent, funcResult1); service->RemoveStickyCommonEvent(event, funcResult); + usleep(10000); return true; } } diff --git a/test/fuzztest/commoneventmanagerservice/servicesubscribecommonevent_fuzzer/unsubscribecommonevent_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/servicesubscribecommonevent_fuzzer/unsubscribecommonevent_fuzzer.cpp index 8be2cbb4ff217fe34f764c834363a62b412f48ab..a62914293682930cdfd1a87bd9b66e20904e9022 100644 --- a/test/fuzztest/commoneventmanagerservice/servicesubscribecommonevent_fuzzer/unsubscribecommonevent_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/servicesubscribecommonevent_fuzzer/unsubscribecommonevent_fuzzer.cpp @@ -42,7 +42,7 @@ public: bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { bool enabled = fdp->ConsumeBool(); - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); MatchingSkills matchingSkills; @@ -59,6 +59,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) service->SubscribeCommonEvent(subscribeInfo, commonEventListener, fdp->ConsumeIntegral(), funcResult); service->UnsubscribeCommonEvent(commonEventListener, funcResult); + usleep(10000); return true; } } diff --git a/test/fuzztest/commoneventmanagerservice/serviceunsubscribecommonevent_fuzzer/subscribecommonevent_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice/serviceunsubscribecommonevent_fuzzer/subscribecommonevent_fuzzer.cpp index 5a897503d3d533e1161a5433aa5d5b62d1d02ca8..82eabaa3449a668212d9abb6cc1050206c37c8cc 100644 --- a/test/fuzztest/commoneventmanagerservice/serviceunsubscribecommonevent_fuzzer/subscribecommonevent_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice/serviceunsubscribecommonevent_fuzzer/subscribecommonevent_fuzzer.cpp @@ -42,7 +42,7 @@ public: bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) { bool enabled = fdp->ConsumeBool(); - sptr service = CommonEventManagerService::GetInstance(); + sptr service = new (std::nothrow) CommonEventManagerService(); service->Init(); MatchingSkills matchingSkills; @@ -59,6 +59,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) service->SubscribeCommonEvent(subscribeInfo, commonEventListener, fdp->ConsumeIntegral(), funcResult); service->UnsubscribeCommonEventSync(commonEventListener, funcResult); + usleep(10000); return true; } } diff --git a/test/fuzztest/commoneventmanagerservice_fuzzer/commoneventmanagerservice_fuzzer.cpp b/test/fuzztest/commoneventmanagerservice_fuzzer/commoneventmanagerservice_fuzzer.cpp index c864556fa552de18c58bb63f7ca330c4b1ad8861..2a748b3718f31fc27be1b327fd2f49c1708100db 100644 --- a/test/fuzztest/commoneventmanagerservice_fuzzer/commoneventmanagerservice_fuzzer.cpp +++ b/test/fuzztest/commoneventmanagerservice_fuzzer/commoneventmanagerservice_fuzzer.cpp @@ -29,8 +29,7 @@ bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fdp) int32_t code = fdp->ConsumeIntegral(); bool enabled = fdp->ConsumeBool(); EventFwk::CommonEventManagerService::GetInstance(); - sptr service = - sptr(new EventFwk::CommonEventManagerService()); + sptr service = new (std::nothrow) EventFwk::CommonEventManagerService(); service->Init(); AAFwk::Want want; EventFwk::CommonEventData commonEventData;