Remove obsolete for_web_contents parameter in FontRenderParamsQuery.
[chromium-blink-merge.git] / media / base / mock_filters.h
blobc4249c500632f2d608e9dc0806780cbe27cbac6a
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 MOCK_METHOD3(Initialize,
36 void(DemuxerHost* host, const PipelineStatusCB& cb, bool));
37 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
38 MOCK_METHOD2(Seek, void(base::TimeDelta time, const PipelineStatusCB& cb));
39 MOCK_METHOD0(Stop, void());
40 MOCK_METHOD0(OnAudioRendererDisabled, void());
41 MOCK_METHOD1(GetStream, DemuxerStream*(DemuxerStream::Type));
42 MOCK_CONST_METHOD0(GetStartTime, base::TimeDelta());
43 MOCK_CONST_METHOD0(GetTimelineOffset, base::Time());
45 private:
46 DISALLOW_COPY_AND_ASSIGN(MockDemuxer);
49 class MockDemuxerStream : public DemuxerStream {
50 public:
51 explicit MockDemuxerStream(DemuxerStream::Type type);
52 virtual ~MockDemuxerStream();
54 // DemuxerStream implementation.
55 Type type() const override;
56 Liveness liveness() const override;
57 MOCK_METHOD1(Read, void(const ReadCB& read_cb));
58 AudioDecoderConfig audio_decoder_config() override;
59 VideoDecoderConfig video_decoder_config() override;
60 MOCK_METHOD0(EnableBitstreamConverter, void());
61 MOCK_METHOD0(SupportsConfigChanges, bool());
63 void set_audio_decoder_config(const AudioDecoderConfig& config);
64 void set_video_decoder_config(const VideoDecoderConfig& config);
65 void set_liveness(Liveness liveness);
67 VideoRotation video_rotation() override;
69 private:
70 Type type_;
71 Liveness liveness_;
72 AudioDecoderConfig audio_decoder_config_;
73 VideoDecoderConfig video_decoder_config_;
75 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream);
78 class MockVideoDecoder : public VideoDecoder {
79 public:
80 MockVideoDecoder();
81 virtual ~MockVideoDecoder();
83 // VideoDecoder implementation.
84 virtual std::string GetDisplayName() const;
85 MOCK_METHOD4(Initialize, void(const VideoDecoderConfig& config,
86 bool low_delay,
87 const PipelineStatusCB& status_cb,
88 const OutputCB& output_cb));
89 MOCK_METHOD2(Decode, void(const scoped_refptr<DecoderBuffer>& buffer,
90 const DecodeCB&));
91 MOCK_METHOD1(Reset, void(const base::Closure&));
92 MOCK_CONST_METHOD0(HasAlpha, bool());
94 private:
95 DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder);
98 class MockAudioDecoder : public AudioDecoder {
99 public:
100 MockAudioDecoder();
101 virtual ~MockAudioDecoder();
103 // AudioDecoder implementation.
104 virtual std::string GetDisplayName() const;
105 MOCK_METHOD3(Initialize,
106 void(const AudioDecoderConfig& config,
107 const PipelineStatusCB& status_cb,
108 const OutputCB& output_cb));
109 MOCK_METHOD2(Decode,
110 void(const scoped_refptr<DecoderBuffer>& buffer,
111 const DecodeCB&));
112 MOCK_METHOD1(Reset, void(const base::Closure&));
114 private:
115 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder);
118 class MockVideoRenderer : public VideoRenderer {
119 public:
120 MockVideoRenderer();
121 virtual ~MockVideoRenderer();
123 // VideoRenderer implementation.
124 MOCK_METHOD10(Initialize,
125 void(DemuxerStream* stream,
126 const PipelineStatusCB& init_cb,
127 const SetDecryptorReadyCB& set_decryptor_ready_cb,
128 const StatisticsCB& statistics_cb,
129 const BufferingStateCB& buffering_state_cb,
130 const PaintCB& paint_cb,
131 const base::Closure& ended_cb,
132 const PipelineStatusCB& error_cb,
133 const WallClockTimeCB& wall_clock_time_cb,
134 const base::Closure& waiting_for_decryption_key_cb));
135 MOCK_METHOD1(Flush, void(const base::Closure& callback));
136 MOCK_METHOD1(StartPlayingFrom, void(base::TimeDelta));
138 private:
139 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer);
142 class MockAudioRenderer : public AudioRenderer {
143 public:
144 MockAudioRenderer();
145 virtual ~MockAudioRenderer();
147 // AudioRenderer implementation.
148 MOCK_METHOD8(Initialize,
149 void(DemuxerStream* stream,
150 const PipelineStatusCB& init_cb,
151 const SetDecryptorReadyCB& set_decryptor_ready_cb,
152 const StatisticsCB& statistics_cb,
153 const BufferingStateCB& buffering_state_cb,
154 const base::Closure& ended_cb,
155 const PipelineStatusCB& error_cb,
156 const base::Closure& waiting_for_decryption_key_cb));
157 MOCK_METHOD0(GetTimeSource, TimeSource*());
158 MOCK_METHOD1(Flush, void(const base::Closure& callback));
159 MOCK_METHOD0(StartPlaying, void());
160 MOCK_METHOD1(SetVolume, void(float volume));
162 private:
163 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer);
166 class MockRenderer : public Renderer {
167 public:
168 MockRenderer();
169 virtual ~MockRenderer();
171 // Renderer implementation.
172 MOCK_METHOD8(Initialize,
173 void(DemuxerStreamProvider* demuxer_stream_provider,
174 const PipelineStatusCB& init_cb,
175 const StatisticsCB& statistics_cb,
176 const BufferingStateCB& buffering_state_cb,
177 const PaintCB& paint_cb,
178 const base::Closure& ended_cb,
179 const PipelineStatusCB& error_cb,
180 const base::Closure& waiting_for_decryption_key_cb));
181 MOCK_METHOD1(Flush, void(const base::Closure& flush_cb));
182 MOCK_METHOD1(StartPlayingFrom, void(base::TimeDelta timestamp));
183 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
184 MOCK_METHOD1(SetVolume, void(float volume));
185 MOCK_METHOD0(GetMediaTime, base::TimeDelta());
186 MOCK_METHOD0(HasAudio, bool());
187 MOCK_METHOD0(HasVideo, bool());
188 MOCK_METHOD2(SetCdm,
189 void(CdmContext* cdm_context,
190 const CdmAttachedCB& cdm_attached_cb));
192 private:
193 DISALLOW_COPY_AND_ASSIGN(MockRenderer);
196 class MockTimeSource : public TimeSource {
197 public:
198 MockTimeSource();
199 virtual ~MockTimeSource();
201 // TimeSource implementation.
202 MOCK_METHOD0(StartTicking, void());
203 MOCK_METHOD0(StopTicking, void());
204 MOCK_METHOD1(SetPlaybackRate, void(float));
205 MOCK_METHOD1(SetMediaTime, void(base::TimeDelta));
206 MOCK_METHOD0(CurrentMediaTime, base::TimeDelta());
207 MOCK_METHOD1(GetWallClockTime, base::TimeTicks(base::TimeDelta));
209 private:
210 DISALLOW_COPY_AND_ASSIGN(MockTimeSource);
213 class MockTextTrack : public TextTrack {
214 public:
215 MockTextTrack();
216 virtual ~MockTextTrack();
218 MOCK_METHOD5(addWebVTTCue, void(const base::TimeDelta& start,
219 const base::TimeDelta& end,
220 const std::string& id,
221 const std::string& content,
222 const std::string& settings));
224 private:
225 DISALLOW_COPY_AND_ASSIGN(MockTextTrack);
228 class MockDecryptor : public Decryptor {
229 public:
230 MockDecryptor();
231 virtual ~MockDecryptor();
233 MOCK_METHOD2(RegisterNewKeyCB, void(StreamType stream_type,
234 const NewKeyCB& new_key_cb));
235 MOCK_METHOD3(Decrypt, void(StreamType stream_type,
236 const scoped_refptr<DecoderBuffer>& encrypted,
237 const DecryptCB& decrypt_cb));
238 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type));
239 MOCK_METHOD2(InitializeAudioDecoder,
240 void(const AudioDecoderConfig& config,
241 const DecoderInitCB& init_cb));
242 MOCK_METHOD2(InitializeVideoDecoder,
243 void(const VideoDecoderConfig& config,
244 const DecoderInitCB& init_cb));
245 MOCK_METHOD2(DecryptAndDecodeAudio,
246 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
247 const AudioDecodeCB& audio_decode_cb));
248 MOCK_METHOD2(DecryptAndDecodeVideo,
249 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
250 const VideoDecodeCB& video_decode_cb));
251 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type));
252 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type));
254 private:
255 DISALLOW_COPY_AND_ASSIGN(MockDecryptor);
258 } // namespace media
260 #endif // MEDIA_BASE_MOCK_FILTERS_H_