• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 #ifndef POST_PROCESSOR_FACTORY_UNIT_TEST_H
16 #define POST_PROCESSOR_FACTORY_UNIT_TEST_H
17 
18 #include "gtest/gtest.h"
19 #include "gmock/gmock.h"
20 #include "video_post_processor_factory.h"
21 
22 namespace OHOS {
23 namespace Media {
24 
25 class MockPostProcessor : public BaseVideoPostProcessor {
26 public:
27     MOCK_METHOD(Status, Init, (), ());
28     MOCK_METHOD(Status, Flush, (), ());
29     MOCK_METHOD(Status, Stop, (), ());
30     MOCK_METHOD(Status, Start, (), ());
31     MOCK_METHOD(Status, Release, (), ());
32     MOCK_METHOD(Status, Pause, (), ());
33     MOCK_METHOD(Status, NotifyEos, (int64_t eosPts), ());
34 
35     MOCK_METHOD(sptr<Surface>, GetInputSurface, (), ());
36     MOCK_METHOD(Status, SetOutputSurface, (sptr<Surface> surface), ());
37 
38     MOCK_METHOD(Status, ReleaseOutputBuffer, (uint32_t index, bool render), ());
39     MOCK_METHOD(Status, RenderOutputBufferAtTime, (uint32_t index, int64_t renderTimestampNs), ());
40 
41     MOCK_METHOD(Status, SetCallback, (const std::shared_ptr<PostProcessorCallback> callback), ());
42     MOCK_METHOD(Status, SetEventReceiver, (const std::shared_ptr<Pipeline::EventReceiver> &receiver), ());
43 
44     MOCK_METHOD(Status, SetParameter, (const Format &format), ());
45     MOCK_METHOD(Status, SetPostProcessorOn, (bool isPostProcessorOn), ());
46     MOCK_METHOD(Status, SetVideoWindowSize, (int32_t width, int32_t height), ());
47 
48     MOCK_METHOD(Status, StartSeekContinous, (), ());
49     MOCK_METHOD(Status, StopSeekContinous, (), ());
50     MOCK_METHOD(Status, SetFd, (int32_t fd), ());
51     MOCK_METHOD(void, SetSeekTime, (int64_t seekTimeUs, PlayerSeekMode mode), ());
52     MOCK_METHOD(void, ResetSeekInfo, (), ());
53     MOCK_METHOD(Status, SetSpeed, (float speed), ());
54 };
55 
56 
57 class PostProcessorFacotoryUnitTest : public testing::Test {
58 public:
59     // SetUpTestCase: Called before all test cases
60     static void SetUpTestCase(void);
61     // TearDownTestCase: Called after all test case
62     static void TearDownTestCase(void);
63     // SetUp: Called before each test cases
64     void SetUp(void);
65     // TearDown: Called after each test cases
66     void TearDown(void);
67 
68 protected:
69     std::shared_ptr<VideoPostProcessorFactory> factory_ {nullptr};
70 };
71 }  // namespace Media
72 }  // namespace OHOS
73 #endif  // POST_PROCESSOR_FACTORY_UNIT_TEST_H
74