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