1 /* 2 * Copyright (c) 2023 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 DEFERREDPROCESSING_FUZZER_H 17 #define DEFERREDPROCESSING_FUZZER_H 18 #define FUZZ_PROJECT_NAME "deferredprocessing_fuzzer" 19 #include <iostream> 20 #include "deferred_photo_processing_session.h" 21 #include "deferred_photo_processor.h" 22 #include "ideferred_photo_processing_session_callback.h" 23 #include "deferred_photo_processing_session_stub.h" 24 namespace OHOS { 25 namespace CameraStandard { 26 using namespace OHOS::CameraStandard::DeferredProcessing; 27 void DeferredProcessingFuzzTestGetPermission(); 28 void DeferredProcessingFuzzTest(uint8_t *rawData, size_t size); 29 30 class IDeferredPhotoProcessingSessionCallbackFuzz : public IDeferredPhotoProcessingSessionCallback { 31 public: 32 explicit IDeferredPhotoProcessingSessionCallbackFuzz() = default; 33 virtual ~IDeferredPhotoProcessingSessionCallbackFuzz() = default; OnProcessImageDone(const std::string & imageId,sptr<IPCFileDescriptor> ipcFd,const long bytes,bool isCloudEnhancementAvailable)34 inline int32_t OnProcessImageDone(const std::string &imageId, 35 sptr<IPCFileDescriptor> ipcFd, const long bytes, bool isCloudEnhancementAvailable) override 36 { 37 return 0; 38 } OnProcessImageDone(const std::string & imageId,std::shared_ptr<Media::Picture> picture,bool isCloudEnhancementAvailable)39 inline int32_t OnProcessImageDone(const std::string &imageId, std::shared_ptr<Media::Picture> picture, 40 bool isCloudEnhancementAvailable) override 41 { 42 return 0; 43 } OnError(const std::string & imageId,const ErrorCode errorCode)44 inline int32_t OnError(const std::string &imageId, const ErrorCode errorCode) override 45 { 46 return 0; 47 } OnStateChanged(const StatusCode status)48 inline int32_t OnStateChanged(const StatusCode status) override 49 { 50 return 0; 51 } 52 }; 53 54 void TestBufferInfo(uint8_t *rawData, size_t size); 55 } 56 } 57 #endif 58 59