• 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 
16 #ifndef I_PLAYER_SERVICE_MOCK_H
17 #define I_PLAYER_SERVICE_MOCK_H
18 
19 #include "gmock/gmock.h"
20 #include "i_player_service.h"
21 
22 namespace OHOS {
23 namespace Media {
24 class MockIPlayerService : public IPlayerService {
25 public:
26     MockIPlayerService() = default;
~MockIPlayerService()27     ~MockIPlayerService() override {};
28     MOCK_METHOD(int32_t, SetPlayerProducer, (const PlayerProducer producer), (override));
29     MOCK_METHOD(int32_t, SetSource, (const std::string &url), (override));
30     MOCK_METHOD(int32_t, SetSource, (const std::shared_ptr<IMediaDataSource> &dataSrc), (override));
31     MOCK_METHOD(int32_t, SetSource, (int32_t fd, int64_t offset, int64_t size), (override));
32     MOCK_METHOD(int32_t, AddSubSource, (const std::string &url), (override));
33     MOCK_METHOD(int32_t, AddSubSource, (int32_t fd, int64_t offset, int64_t size), (override));
34     MOCK_METHOD(int32_t, Play, (), (override));
35     MOCK_METHOD(int32_t, Freeze, (), (override));
36     MOCK_METHOD(int32_t, UnFreeze, (), (override));
37     MOCK_METHOD(int32_t, EnableReportAudioInterrupt, (bool enable), (override));
38     MOCK_METHOD(int32_t, Prepare, (), (override));
39     MOCK_METHOD(int32_t, SetRenderFirstFrame, (bool display), (override));
40     MOCK_METHOD(int32_t, SetPlayRange, (int64_t start, int64_t end), (override));
41     MOCK_METHOD(int32_t, SetPlayRangeWithMode, (int64_t start, int64_t end, PlayerSeekMode mode), (override));
42     MOCK_METHOD(int32_t, PrepareAsync, (), (override));
43     MOCK_METHOD(int32_t, Pause, (), (override));
44     MOCK_METHOD(int32_t, Stop, (), (override));
45     MOCK_METHOD(int32_t, Reset, (), (override));
46     MOCK_METHOD(int32_t, Release, (), (override));
47     MOCK_METHOD(int32_t, ReleaseSync, (), (override));
48     MOCK_METHOD(int32_t, SetVolume, (float leftVolume, float rightVolume), (override));
49     MOCK_METHOD(int32_t, SetVolumeMode, (int32_t mode), (override));
50     MOCK_METHOD(int32_t, Seek, (int32_t mSeconds, PlayerSeekMode mode), (override));
51     MOCK_METHOD(int32_t, GetCurrentTime, (int32_t &currentTime), (override));
52     MOCK_METHOD(int32_t, GetPlaybackPosition, (int32_t &playbackPosition), (override));
53     MOCK_METHOD(int32_t, GetVideoTrackInfo, (std::vector<Format> &videoTrack), (override));
54     MOCK_METHOD(int32_t, GetAudioTrackInfo, (std::vector<Format> &audioTrack), (override));
55     MOCK_METHOD(int32_t, GetVideoWidth, (), (override));
56     MOCK_METHOD(int32_t, GetVideoHeight, (), (override));
57     MOCK_METHOD(int32_t, GetDuration, (int32_t &duration), (override));
58     MOCK_METHOD(int32_t, GetPlaybackInfo, (Format &playbackInfo), (override));
59     MOCK_METHOD(int32_t, SetPlaybackSpeed, (PlaybackRateMode mode), (override));
60     MOCK_METHOD(int32_t, SetPlaybackRate, (float rate), (override));
61     MOCK_METHOD(int32_t,
62         SetMediaSource, (const std::shared_ptr<AVMediaSource> &mediaSource, AVPlayStrategy strategy), (override));
63     MOCK_METHOD(int32_t, SelectBitRate, (uint32_t bitRate), (override));
64     MOCK_METHOD(int32_t, GetPlaybackSpeed, (PlaybackRateMode &mode), (override));
65     MOCK_METHOD(int32_t,
66         SetDecryptConfig, (const sptr<DrmStandard::IMediaKeySessionService> &keySessionProxy, bool svp), (override));
67 
68 #ifdef SUPPORT_VIDEO
69     MOCK_METHOD(int32_t, SetVideoSurface, (sptr<Surface> surface), (override));
70 #endif
71 
72     MOCK_METHOD(bool, IsPlaying, (), (override));
73     MOCK_METHOD(bool, IsLooping, (), (override));
74     MOCK_METHOD(int32_t, SetLooping, (bool loop), (override));
75     MOCK_METHOD(int32_t, SetParameter, (const Format &param), (override));
76     MOCK_METHOD(int32_t, SetPlayerCallback, (const std::shared_ptr<PlayerCallback> &callback), (override));
77     MOCK_METHOD(int32_t, SelectTrack, (int32_t index, PlayerSwitchMode mode), (override));
78     MOCK_METHOD(int32_t, DeselectTrack, (int32_t index), (override));
79     MOCK_METHOD(int32_t, GetCurrentTrack, (int32_t trackType, int32_t &index), (override));
80     MOCK_METHOD(int32_t, GetSubtitleTrackInfo, (std::vector<Format> &subtitleTrack), (override));
81     MOCK_METHOD(int32_t, SetPlaybackStrategy, (AVPlayStrategy playbackStrategy), (override));
82     MOCK_METHOD(int32_t, SetMediaMuted, (MediaType mediaType, bool isMuted), (override));
83     MOCK_METHOD(int32_t, SetSuperResolution, (bool enabled), (override));
84     MOCK_METHOD(int32_t, SetVideoWindowSize, (int32_t width, int32_t height), (override));
85     MOCK_METHOD(int32_t, SetMaxAmplitudeCbStatus, (bool status), (override));
86     MOCK_METHOD(int32_t, SetDeviceChangeCbStatus, (bool status), (override));
87     MOCK_METHOD(int32_t, GetApiVersion, (int32_t &apiVersion), (override));
88     MOCK_METHOD(bool, IsSeekContinuousSupported, (), (override));
89     MOCK_METHOD(int32_t, SetSeiMessageCbStatus, (bool status, const std::vector<int32_t> &payloadTypes), (override));
90     MOCK_METHOD(int32_t, SetStartFrameRateOptEnabled, (bool enabled), (override));
91     MOCK_METHOD(int32_t, SetReopenFd, (int32_t fd), (override));
92     MOCK_METHOD(int32_t, EnableCameraPostprocessing, (), (override));
93 };
94 } // namespace Media
95 } // namespace OHOS
96 #endif