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 IMAGE_EFFECT_MOCK_PRODUCER_SURFACE_H 17 #define IMAGE_EFFECT_MOCK_PRODUCER_SURFACE_H 18 19 #include "gmock/gmock.h" 20 #include "native_window.h" 21 #include "producer_surface.h" 22 23 namespace OHOS { 24 namespace Media { 25 namespace Effect { 26 class MockProducerSurface : public ProducerSurface { 27 public: 28 MockProducerSurface(sptr<IBufferProducer>& producer); 29 ~MockProducerSurface(); 30 MOCK_METHOD3(RequestBuffer, GSError(sptr<SurfaceBuffer>& buffer, sptr<SyncFence>& fence, 31 BufferRequestConfig &config)); 32 MOCK_METHOD3(FlushBuffer, GSError(sptr<SurfaceBuffer>& buffer, int32_t fence, BufferFlushConfig &config)); 33 34 static void AllocDmaMemory(sptr<SurfaceBuffer> &buffer); 35 static void ReleaseDmaBuffer(sptr<SurfaceBuffer> &buffer); 36 private: 37 sptr<SurfaceBuffer> buffer_; 38 }; 39 } // namespace Effect 40 } // namespace Media 41 } // namespace OHOS 42 43 #endif // IMAGE_EFFECT_MOCK_PRODUCER_SURFACE_H 44