1 /*
2  * Copyright (c) 2022-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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_MEDIA_PLAYER_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_MEDIA_PLAYER_H
18 
19 #include <stdint.h>
20 
21 #include "gmock/gmock.h"
22 
23 #include "core/components_ng/render/media_player.h"
24 
25 namespace OHOS::Ace::NG {
26 namespace {
27 constexpr int32_t DEFAULT_WIDTH = 100;
28 constexpr int32_t DEFAULT_HEIGHT = 100;
29 } // namespace
30 
31 class MockMediaPlayer : public MediaPlayer {
32     DECLARE_ACE_TYPE(MockMediaPlayer, MediaPlayer)
33 public:
34     ~MockMediaPlayer() override = default;
35 
GetVideoWidth()36     int32_t GetVideoWidth() override
37     {
38         return DEFAULT_WIDTH;
39     }
40 
GetVideoHeight()41     int32_t GetVideoHeight() override
42     {
43         return DEFAULT_HEIGHT;
44     }
45 
46     MOCK_METHOD0(IsMediaPlayerValid, bool());
47     MOCK_METHOD3(SetSource, bool(const std::string&, const std::string&, const std::string&));
48     MOCK_METHOD0(SetSurface, int32_t());
49     MOCK_METHOD0(PrepareAsync, int32_t());
50     MOCK_METHOD0(Pause, int32_t());
51     MOCK_METHOD1(GetDuration, int32_t(int32_t&));
52     MOCK_METHOD0(Prepare, int32_t());
53     MOCK_METHOD0(Stop, int32_t());
54     MOCK_METHOD2(Seek, int32_t(int32_t, SeekMode));
55 };
56 } // namespace OHOS::Ace::NG
57 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_MEDIA_PLAYER_H
58