• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 MOCK_ITRANSCODER_ENGINE_H
17 #define MOCK_ITRANSCODER_ENGINE_H
18 
19 #include "i_transcoder_engine.h"
20 #include "gmock/gmock.h"
21 
22 namespace OHOS {
23 namespace Media {
24 class MockITransCoderEngineObs : public ITransCoderEngineObs {
25 public:
26     MockITransCoderEngineObs() = default;
27     ~MockITransCoderEngineObs() override = default;
28     MOCK_METHOD(void, OnError, (TransCoderErrorType errorType, int32_t errorCode), ());
OnInfo(TransCoderOnInfoType type,int32_t extra)29     void OnInfo(TransCoderOnInfoType type, int32_t extra) override
30     {
31         onInfoFlag = true;
32     }
33 private:
34     bool onInfoFlag = false;
35 };
36 
37 class MockITransCoderEngine : public ITransCoderEngine {
38 public:
39     MockITransCoderEngine() = default;
~MockITransCoderEngine()40     ~MockITransCoderEngine() override {};
41     MOCK_METHOD(void, SetInstanceId, (uint64_t instanceId), ());
42 
43     MOCK_METHOD(int32_t, SetInputFile, (const std::string &url), ());
44 
45     MOCK_METHOD(int32_t, SetOutputFile, (const int32_t fd), ());
46 
47     MOCK_METHOD(int32_t, SetOutputFormat, (OutputFormatType format), ());
48 
49     MOCK_METHOD(int32_t, SetObs, (const std::weak_ptr<ITransCoderEngineObs> &obs), ());
50 
51     MOCK_METHOD(int32_t, Configure, (const TransCoderParam &recParam), ());
52 
53     MOCK_METHOD(int32_t, Prepare, (), ());
54 
55     MOCK_METHOD(int32_t, Start, (), ());
56 
57     MOCK_METHOD(int32_t, Pause, (), ());
58 
59     MOCK_METHOD(int32_t, Resume, (), ());
60 
61     MOCK_METHOD(int32_t, Cancel, (), ());
62 
63     MOCK_METHOD(int32_t, GetCurrentTime, (int32_t &currentTime), ());
64 
65     MOCK_METHOD(int32_t, GetDuration, (int32_t &duration), ());
66 };
67 } // namespace Media
68 } // namespace OHOS
69 #endif