Delete unused downloads page asset.
[chromium-blink-merge.git] / media / base / mock_filters.h
blob99e113b27ee1d518c730580f5aecfb882838422b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_MOCK_FILTERS_H_
6 #define MEDIA_BASE_MOCK_FILTERS_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "media/base/audio_decoder.h"
12 #include "media/base/audio_decoder_config.h"
13 #include "media/base/audio_renderer.h"
14 #include "media/base/decoder_buffer.h"
15 #include "media/base/decryptor.h"
16 #include "media/base/demuxer.h"
17 #include "media/base/pipeline_status.h"
18 #include "media/base/renderer.h"
19 #include "media/base/text_track.h"
20 #include "media/base/time_source.h"
21 #include "media/base/video_decoder.h"
22 #include "media/base/video_decoder_config.h"
23 #include "media/base/video_frame.h"
24 #include "media/base/video_renderer.h"
25 #include "testing/gmock/include/gmock/gmock.h"
27 namespace media {
29 class MockDemuxer : public Demuxer {
30 public:
31 MockDemuxer();
32 virtual ~MockDemuxer();
34 // Demuxer implementation.
35 virtual std::string GetDisplayName() const;
36 MOCK_METHOD3(Initialize,
37 void(DemuxerHost* host, const PipelineStatusCB& cb, bool));
38 MOCK_METHOD1(SetPlaybackRate, void(double playback_rate));
39 MOCK_METHOD2(Seek, void(base::TimeDelta time, const PipelineStatusCB& cb));
40 MOCK_METHOD0(Stop, void());
41 MOCK_METHOD0(OnAudioRendererDisabled, void());
42 MOCK_METHOD1(GetStream, DemuxerStream*(DemuxerStream::Type));
43 MOCK_CONST_METHOD0(GetStartTime, base::TimeDelta());
44 MOCK_CONST_METHOD0(GetTimelineOffset, base::Time());
46 private:
47 DISALLOW_COPY_AND_ASSIGN(MockDemuxer);
50 class MockDemuxerStream : public DemuxerStream {
51 public:
52 explicit MockDemuxerStream(DemuxerStream::Type type);
53 virtual ~MockDemuxerStream();
55 // DemuxerStream implementation.
56 Type type() const override;
57 Liveness liveness() const override;
58 MOCK_METHOD1(Read, void(const ReadCB& read_cb));
59 AudioDecoderConfig audio_decoder_config() override;
60 VideoDecoderConfig video_decoder_config() override;
61 MOCK_METHOD0(EnableBitstreamConverter, void());
62 MOCK_METHOD0(SupportsConfigChanges, bool());
64 void set_audio_decoder_config(const AudioDecoderConfig& config);
65 void set_video_decoder_config(const VideoDecoderConfig& config);
66 void set_liveness(Liveness liveness);
68 VideoRotation video_rotation() override;
70 private:
71 Type type_;
72 Liveness liveness_;
73 AudioDecoderConfig audio_decoder_config_;
74 VideoDecoderConfig video_decoder_config_;
76 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream);
79 class MockVideoDecoder : public VideoDecoder {
80 public:
81 MockVideoDecoder();
82 virtual ~MockVideoDecoder();
84 // VideoDecoder implementation.
85 virtual std::string GetDisplayName() const;
86 MOCK_METHOD4(Initialize,
87 void(const VideoDecoderConfig& config,
88 bool low_delay,
89 const InitCB& init_cb,
90 const OutputCB& output_cb));
91 MOCK_METHOD2(Decode, void(const scoped_refptr<DecoderBuffer>& buffer,
92 const DecodeCB&));
93 MOCK_METHOD1(Reset, void(const base::Closure&));
94 MOCK_CONST_METHOD0(HasAlpha, bool());
96 private:
97 DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder);
100 class MockAudioDecoder : public AudioDecoder {
101 public:
102 MockAudioDecoder();
103 virtual ~MockAudioDecoder();
105 // AudioDecoder implementation.
106 virtual std::string GetDisplayName() const;
107 MOCK_METHOD3(Initialize,
108 void(const AudioDecoderConfig& config,
109 const InitCB& init_cb,
110 const OutputCB& output_cb));
111 MOCK_METHOD2(Decode,
112 void(const scoped_refptr<DecoderBuffer>& buffer,
113 const DecodeCB&));
114 MOCK_METHOD1(Reset, void(const base::Closure&));
116 private:
117 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder);
120 class MockVideoRenderer : public VideoRenderer {
121 public:
122 MockVideoRenderer();
123 virtual ~MockVideoRenderer();
125 // VideoRenderer implementation.
126 MOCK_METHOD9(Initialize,
127 void(DemuxerStream* stream,
128 const PipelineStatusCB& init_cb,
129 const SetDecryptorReadyCB& set_decryptor_ready_cb,
130 const StatisticsCB& statistics_cb,
131 const BufferingStateCB& buffering_state_cb,
132 const base::Closure& ended_cb,
133 const PipelineStatusCB& error_cb,
134 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
135 const base::Closure& waiting_for_decryption_key_cb));
136 MOCK_METHOD1(Flush, void(const base::Closure& callback));
137 MOCK_METHOD1(StartPlayingFrom, void(base::TimeDelta));
138 MOCK_METHOD1(OnTimeStateChanged, void(bool));
140 private:
141 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer);
144 class MockAudioRenderer : public AudioRenderer {
145 public:
146 MockAudioRenderer();
147 virtual ~MockAudioRenderer();
149 // AudioRenderer implementation.
150 MOCK_METHOD8(Initialize,
151 void(DemuxerStream* stream,
152 const PipelineStatusCB& init_cb,
153 const SetDecryptorReadyCB& set_decryptor_ready_cb,
154 const StatisticsCB& statistics_cb,
155 const BufferingStateCB& buffering_state_cb,
156 const base::Closure& ended_cb,
157 const PipelineStatusCB& error_cb,
158 const base::Closure& waiting_for_decryption_key_cb));
159 MOCK_METHOD0(GetTimeSource, TimeSource*());
160 MOCK_METHOD1(Flush, void(const base::Closure& callback));
161 MOCK_METHOD0(StartPlaying, void());
162 MOCK_METHOD1(SetVolume, void(float volume));
164 private:
165 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer);
168 class MockRenderer : public Renderer {
169 public:
170 MockRenderer();
171 virtual ~MockRenderer();
173 // Renderer implementation.
174 MOCK_METHOD7(Initialize,
175 void(DemuxerStreamProvider* demuxer_stream_provider,
176 const PipelineStatusCB& init_cb,
177 const StatisticsCB& statistics_cb,
178 const BufferingStateCB& buffering_state_cb,
179 const base::Closure& ended_cb,
180 const PipelineStatusCB& error_cb,
181 const base::Closure& waiting_for_decryption_key_cb));
182 MOCK_METHOD1(Flush, void(const base::Closure& flush_cb));
183 MOCK_METHOD1(StartPlayingFrom, void(base::TimeDelta timestamp));
184 MOCK_METHOD1(SetPlaybackRate, void(double playback_rate));
185 MOCK_METHOD1(SetVolume, void(float volume));
186 MOCK_METHOD0(GetMediaTime, base::TimeDelta());
187 MOCK_METHOD0(HasAudio, bool());
188 MOCK_METHOD0(HasVideo, bool());
189 MOCK_METHOD2(SetCdm,
190 void(CdmContext* cdm_context,
191 const CdmAttachedCB& cdm_attached_cb));
193 private:
194 DISALLOW_COPY_AND_ASSIGN(MockRenderer);
197 class MockTimeSource : public TimeSource {
198 public:
199 MockTimeSource();
200 virtual ~MockTimeSource();
202 // TimeSource implementation.
203 MOCK_METHOD0(StartTicking, void());
204 MOCK_METHOD0(StopTicking, void());
205 MOCK_METHOD1(SetPlaybackRate, void(double));
206 MOCK_METHOD1(SetMediaTime, void(base::TimeDelta));
207 MOCK_METHOD0(CurrentMediaTime, base::TimeDelta());
208 MOCK_METHOD2(GetWallClockTimes,
209 bool(const std::vector<base::TimeDelta>&,
210 std::vector<base::TimeTicks>*));
212 private:
213 DISALLOW_COPY_AND_ASSIGN(MockTimeSource);
216 class MockTextTrack : public TextTrack {
217 public:
218 MockTextTrack();
219 virtual ~MockTextTrack();
221 MOCK_METHOD5(addWebVTTCue, void(const base::TimeDelta& start,
222 const base::TimeDelta& end,
223 const std::string& id,
224 const std::string& content,
225 const std::string& settings));
227 private:
228 DISALLOW_COPY_AND_ASSIGN(MockTextTrack);
231 class MockDecryptor : public Decryptor {
232 public:
233 MockDecryptor();
234 virtual ~MockDecryptor();
236 MOCK_METHOD2(RegisterNewKeyCB, void(StreamType stream_type,
237 const NewKeyCB& new_key_cb));
238 MOCK_METHOD3(Decrypt, void(StreamType stream_type,
239 const scoped_refptr<DecoderBuffer>& encrypted,
240 const DecryptCB& decrypt_cb));
241 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type));
242 MOCK_METHOD2(InitializeAudioDecoder,
243 void(const AudioDecoderConfig& config,
244 const DecoderInitCB& init_cb));
245 MOCK_METHOD2(InitializeVideoDecoder,
246 void(const VideoDecoderConfig& config,
247 const DecoderInitCB& init_cb));
248 MOCK_METHOD2(DecryptAndDecodeAudio,
249 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
250 const AudioDecodeCB& audio_decode_cb));
251 MOCK_METHOD2(DecryptAndDecodeVideo,
252 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
253 const VideoDecodeCB& video_decode_cb));
254 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type));
255 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type));
257 private:
258 DISALLOW_COPY_AND_ASSIGN(MockDecryptor);
261 } // namespace media
263 #endif // MEDIA_BASE_MOCK_FILTERS_H_