• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 PHOTO_OUTPUT_FUZZER_H
17 #define PHOTO_OUTPUT_FUZZER_H
18 
19 #include <fuzzer/FuzzedDataProvider.h>
20 #include "output/photo_output.h"
21 
22 namespace OHOS {
23 namespace CameraStandard {
24 namespace PhotoOutputFuzzer {
25 
26 class PhotoStateCallbackMock : public PhotoStateCallback {
27 public:
OnCaptureStarted(const int32_t captureID)28     void OnCaptureStarted(const int32_t captureID) const override {}
OnCaptureStarted(const int32_t captureID,uint32_t exposureTime)29     void OnCaptureStarted(const int32_t captureID, uint32_t exposureTime) const override {}
OnCaptureEnded(const int32_t captureID,const int32_t frameCount)30     void OnCaptureEnded(const int32_t captureID, const int32_t frameCount) const override {}
OnFrameShutter(const int32_t captureId,const uint64_t timestamp)31     void OnFrameShutter(const int32_t captureId, const uint64_t timestamp) const override {}
OnFrameShutterEnd(const int32_t captureId,const uint64_t timestamp)32     void OnFrameShutterEnd(const int32_t captureId, const uint64_t timestamp) const override {}
OnCaptureReady(const int32_t captureId,const uint64_t timestamp)33     void OnCaptureReady(const int32_t captureId, const uint64_t timestamp) const override {}
OnEstimatedCaptureDuration(const int32_t duration)34     void OnEstimatedCaptureDuration(const int32_t duration) const override {}
OnCaptureError(const int32_t captureId,const int32_t errorCode)35     void OnCaptureError(const int32_t captureId, const int32_t errorCode) const override {}
OnOfflineDeliveryFinished(const int32_t captureId)36     void OnOfflineDeliveryFinished(const int32_t captureId) const override {}
37 };
38 
39 class IBufferConsumerListenerMock : public IBufferConsumerListener {
40 public:
OnBufferAvailable()41     void OnBufferAvailable() override {}
42 };
43 
44 void Test(uint8_t *rawData, size_t size);
45 void TestOutput1(sptr<PhotoOutput> output, uint8_t *rawData, size_t size);
46 void TestOutput2(sptr<PhotoOutput> output, uint8_t *rawData, size_t size);
47 void CaptureSetting(std::shared_ptr<PhotoCaptureSetting> setting, uint8_t *rawData, size_t size);
48 void CaptureCallback(sptr<HStreamCaptureCallbackImpl> callback, uint8_t *rawData, size_t size);
49 
50 }
51 } //CameraStandard
52 } //OHOS
53 #endif //PHOTO_OUTPUT_FUZZER_H