mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-24 07:31:57 +00:00
commit
81302f7df1
@ -28,11 +28,50 @@ namespace OHOS {
|
||||
}
|
||||
|
||||
bool FileImageLoaderTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto info = CreatImageSourceInfo(data, size);
|
||||
Ace::WeakPtr<Ace::PipelineBase> context = nullptr;
|
||||
Ace::FileImageLoader fileImageLoader;
|
||||
return fileImageLoader.LoadImageData(info, context) != nullptr;
|
||||
}
|
||||
|
||||
bool DataProviderImageLoaderTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto info = CreatImageSourceInfo(data, size);
|
||||
Ace::WeakPtr<Ace::PipelineBase> context = nullptr;
|
||||
Ace::DataProviderImageLoader dataProviderImageLoader;
|
||||
return dataProviderImageLoader.LoadImageData(info, context) != nullptr;
|
||||
Ace::Base64ImageLoader base64ImageLoader;
|
||||
auto base64Image = base64ImageLoader.LoadImageData(info, context) != nullptr;
|
||||
return dataProviderImageLoader.LoadImageData(info, context) != nullptr && base64Image;
|
||||
}
|
||||
|
||||
bool DecodedDataProviderImageLoaderTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto info = CreatImageSourceInfo(data, size);
|
||||
Ace::WeakPtr<Ace::PipelineBase> context = nullptr;
|
||||
Ace::DecodedDataProviderImageLoader decodedDataProviderImageLoader;
|
||||
auto skData = decodedDataProviderImageLoader.LoadImageData(info, context);
|
||||
auto ngData = decodedDataProviderImageLoader.LoadDecodedImageData(info, context);
|
||||
return skData != nullptr && ngData != nullptr;
|
||||
}
|
||||
|
||||
bool PixelMapImageLoaderTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto info = CreatImageSourceInfo(data, size);
|
||||
Ace::WeakPtr<Ace::PipelineBase> context = nullptr;
|
||||
Ace::PixelMapImageLoader pixelMapImageLoader;
|
||||
auto skData = pixelMapImageLoader.LoadImageData(info, context);
|
||||
auto ngData = pixelMapImageLoader.LoadDecodedImageData(info, context);
|
||||
return skData != nullptr && ngData != nullptr;
|
||||
}
|
||||
|
||||
bool ResourceImageLoaderTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto info = CreatImageSourceInfo(data, size);
|
||||
Ace::WeakPtr<Ace::PipelineBase> context = nullptr;
|
||||
Ace::ResourceImageLoader resourceImageLoader;
|
||||
auto skData = resourceImageLoader.LoadImageData(info, context);
|
||||
return skData != nullptr;
|
||||
}
|
||||
|
||||
bool AssetImageLoader(const uint8_t* data, size_t size)
|
||||
@ -40,7 +79,9 @@ namespace OHOS {
|
||||
auto info = CreatImageSourceInfo(data, size);
|
||||
Ace::WeakPtr<Ace::PipelineBase> context = nullptr;
|
||||
Ace::AssetImageLoader assetImageLoader;
|
||||
return assetImageLoader.LoadImageData(info, context) != nullptr;
|
||||
std::string randomString = reinterpret_cast<const char*>(data);
|
||||
auto jsonString = assetImageLoader.LoadJsonData(randomString);
|
||||
return assetImageLoader.LoadImageData(info, context) != nullptr && jsonString.empty();
|
||||
}
|
||||
|
||||
bool NetworkImageLoader(const uint8_t* data, size_t size)
|
||||
@ -65,9 +106,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
OHOS::FileImageLoaderTest(data, size);
|
||||
OHOS::DataProviderImageLoaderTest(data, size);
|
||||
OHOS::DecodedDataProviderImageLoaderTest(data, size);
|
||||
OHOS::AssetImageLoader(data, size);
|
||||
OHOS::NetworkImageLoader(data, size);
|
||||
OHOS::InternalImageLoader(data, size);
|
||||
OHOS::ResourceImageLoaderTest(data, size);
|
||||
OHOS::PixelMapImageLoaderTest(data, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,20 @@
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
bool RegisterCallBackTest(const AAFwk::Want& want)
|
||||
bool RegisterCallBackTest(const uint8_t* data, const AAFwk::Want& want)
|
||||
{
|
||||
OHOS::Ace::UIServiceMgrClient client;
|
||||
sptr<Ace::IUIService> uiService = nullptr;
|
||||
return client.RegisterCallBack(want, uiService) == ERR_OK;
|
||||
std::string randomString = reinterpret_cast<const char*>(data);
|
||||
int randomNumber = static_cast<int>(U32_AT(data));
|
||||
DialogCallback callback;
|
||||
int* id = nullptr;
|
||||
client.RegisterCallBack(want, uiService);
|
||||
client.ShowDialog(
|
||||
randomString, randomString, OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,
|
||||
randomNumber, randomNumber, randomNumber, randomNumber, callback, id);
|
||||
client.UpdateDialog(randomNumber, randomString);
|
||||
return client.CancelDialog(randomNumber) == ERR_OK;
|
||||
}
|
||||
|
||||
bool UnregisterCallBackTest(const uint8_t* data, const AAFwk::Want& want)
|
||||
@ -61,7 +70,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string randomString = reinterpret_cast<const char*>(data);
|
||||
want = want.SetUri(randomString);
|
||||
OHOS::RegisterCallBackTest(want);
|
||||
OHOS::RegisterCallBackTest(data, want);
|
||||
OHOS::PushTest(data, want);
|
||||
OHOS::RequestTest(data, want);
|
||||
OHOS::ReturnRequestTest(data, want);
|
||||
|
Loading…
Reference in New Issue
Block a user