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 CAPTURE_SESSION_FUZZER_H 17 #define CAPTURE_SESSION_FUZZER_H 18 19 #include "session/capture_session.h" 20 #include "session/capture_session_for_sys.h" 21 #include "iremote_proxy.h" 22 #include "fuzzer/FuzzedDataProvider.h" 23 24 namespace OHOS { 25 namespace CameraStandard { 26 namespace CaptureSessionFuzzer { 27 28 void Test(uint8_t* data, size_t size); 29 void TestSession(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 30 void TestExposure(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 31 void TestFocus(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 32 void TestZoom(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 33 void TestCallback(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 34 void TestStabilization(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 35 void TestFlash(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 36 void TestCreateMediaLibrary(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 37 void TestProcess(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 38 void TestAperture(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 39 void TestBeauty(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 40 void TestOther(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 41 void TestOther2(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 42 void TestOther3(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 43 void TestAdd(sptr<CaptureSessionForSys> session, FuzzedDataProvider& fdp); 44 45 class SessionCallbackMock : public SessionCallback { 46 public: OnError(int32_t errorCode)47 void OnError(int32_t errorCode) override {} 48 }; 49 50 class ExposureCallbackMock : public ExposureCallback { 51 public: OnExposureState(ExposureState state)52 void OnExposureState(ExposureState state) override {} 53 }; 54 55 class FocusCallbackMock : public FocusCallback { 56 public: OnFocusState(FocusState state)57 void OnFocusState(FocusState state) override {} 58 }; 59 60 class MacroStatusCallbackMock : public MacroStatusCallback { 61 public: OnMacroStatusChanged(MacroStatus status)62 void OnMacroStatusChanged(MacroStatus status) override {} 63 }; 64 65 class MoonCaptureBoostStatusCallbackMock : public MoonCaptureBoostStatusCallback { 66 public: OnMoonCaptureBoostStatusChanged(MoonCaptureBoostStatus status)67 void OnMoonCaptureBoostStatusChanged(MoonCaptureBoostStatus status) override {} 68 }; 69 70 class FeatureDetectionStatusCallbackMock : public FeatureDetectionStatusCallback { 71 public: FeatureDetectionStatusCallbackMock(bool ret)72 explicit FeatureDetectionStatusCallbackMock(bool ret) : ret_(ret) {} OnFeatureDetectionStatusChanged(SceneFeature feature,FeatureDetectionStatus status)73 void OnFeatureDetectionStatusChanged(SceneFeature feature, FeatureDetectionStatus status) override {} IsFeatureSubscribed(SceneFeature feature)74 bool IsFeatureSubscribed(SceneFeature feature) override 75 { 76 return ret_; 77 } 78 private: 79 bool ret_; 80 }; 81 82 class EffectSuggestionCallbackMock : public EffectSuggestionCallback { 83 public: OnEffectSuggestionChange(EffectSuggestionType effectSuggestionType)84 void OnEffectSuggestionChange(EffectSuggestionType effectSuggestionType) override {} 85 }; 86 87 class ARCallbackMock : public ARCallback { 88 public: OnResult(const ARStatusInfo & arStatusInfo)89 void OnResult(const ARStatusInfo &arStatusInfo) const override {} 90 }; 91 92 class SmoothZoomCallbackMock : public SmoothZoomCallback { 93 public: OnSmoothZoom(int32_t duration)94 void OnSmoothZoom(int32_t duration) override {} 95 }; 96 97 class AbilityCallbackMock : public AbilityCallback { 98 public: OnAbilityChange()99 void OnAbilityChange() override {} 100 }; 101 102 } //CaptureSessionFuzzer 103 } //CameraStandard 104 } //OHOS 105 #endif //CAPTURE_SESSION_FUZZER_H