1 /* 2 * Copyright (c) 2024 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 DEFERRED_VIDEO_PROC_SESSION_FUZZER_H 17 #define DEFERRED_VIDEO_PROC_SESSION_FUZZER_H 18 19 #include "stream_repeat_stub.h" 20 #include "deferred_video_proc_session.h" 21 #include "token_setproc.h" 22 #include "iservice_registry.h" 23 #include "system_ability_definition.h" 24 #include <fuzzer/FuzzedDataProvider.h> 25 26 namespace OHOS { 27 namespace CameraStandard { 28 class IDeferredVideoProcSessionCallbackFuzz : public IDeferredVideoProcSessionCallback { 29 public: OnProcessVideoDone(const std::string & videoId,const sptr<IPCFileDescriptor> ipcFd)30 void OnProcessVideoDone(const std::string& videoId, const sptr<IPCFileDescriptor> ipcFd) override {} OnError(const std::string & videoId,const DpsErrorCode errorCode)31 void OnError(const std::string& videoId, const DpsErrorCode errorCode) override {} OnStateChanged(const DpsStatusCode status)32 void OnStateChanged(const DpsStatusCode status) override {} 33 }; 34 35 class IDeferredVideoProcessingSessionFuzz : public DeferredProcessing::IDeferredVideoProcessingSession { 36 public: BeginSynchronize()37 int32_t BeginSynchronize() override 38 { 39 return 0; 40 } EndSynchronize()41 int32_t EndSynchronize() override 42 { 43 return 0; 44 } AddVideo(const std::string & videoId,const sptr<IPCFileDescriptor> & srcFd,const sptr<IPCFileDescriptor> & dstFd)45 int32_t AddVideo( 46 const std::string& videoId, 47 const sptr<IPCFileDescriptor>& srcFd, 48 const sptr<IPCFileDescriptor>& dstFd) override 49 { 50 return 0; 51 } RemoveVideo(const std::string & videoId,bool restorable)52 int32_t RemoveVideo(const std::string& videoId, bool restorable) override 53 { 54 return 0; 55 } RestoreVideo(const std::string & videoId)56 int32_t RestoreVideo(const std::string& videoId) override 57 { 58 return 0; 59 } 60 AsObject()61 sptr<IRemoteObject> AsObject() override 62 { 63 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 64 if (samgr == nullptr) { 65 return nullptr; 66 } 67 sptr<IRemoteObject> object = samgr->GetSystemAbility(CAMERA_SERVICE_ID); 68 return object; 69 } 70 }; 71 72 class DeferredVideoProcSessionFuzzer { 73 public: 74 static void DeferredVideoProcSessionFuzzTest(FuzzedDataProvider& fdp); 75 }; 76 } //CameraStandard 77 } //OHOS 78 #endif //DEFERRED_VIDEO_PROC_SESSION_FUZZER_H