Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / media / base / mock_filters.h
blob31358758079e8d8d99db0c5b5633bf870cfeff87
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(double 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_METHOD9(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 base::Closure& ended_cb,
131 const PipelineStatusCB& error_cb,
132 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
133 const base::Closure& waiting_for_decryption_key_cb));
134 MOCK_METHOD1(Flush, void(const base::Closure& callback));
135 MOCK_METHOD1(StartPlayingFrom, void(base::TimeDelta));
136 MOCK_METHOD1(OnTimeStateChanged, void(bool));
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_METHOD7(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 base::Closure& ended_cb,
178 const PipelineStatusCB& error_cb,
179 const base::Closure& waiting_for_decryption_key_cb));
180 MOCK_METHOD1(Flush, void(const base::Closure& flush_cb));
181 MOCK_METHOD1(StartPlayingFrom, void(base::TimeDelta timestamp));
182 MOCK_METHOD1(SetPlaybackRate, void(double playback_rate));
183 MOCK_METHOD1(SetVolume, void(float volume));
184 MOCK_METHOD0(GetMediaTime, base::TimeDelta());
185 MOCK_METHOD0(HasAudio, bool());
186 MOCK_METHOD0(HasVideo, bool());
187 MOCK_METHOD2(SetCdm,
188 void(CdmContext* cdm_context,
189 const CdmAttachedCB& cdm_attached_cb));
191 private:
192 DISALLOW_COPY_AND_ASSIGN(MockRenderer);
195 class MockTimeSource : public TimeSource {
196 public:
197 MockTimeSource();
198 virtual ~MockTimeSource();
200 // TimeSource implementation.
201 MOCK_METHOD0(StartTicking, void());
202 MOCK_METHOD0(StopTicking, void());
203 MOCK_METHOD1(SetPlaybackRate, void(double));
204 MOCK_METHOD1(SetMediaTime, void(base::TimeDelta));
205 MOCK_METHOD0(CurrentMediaTime, base::TimeDelta());
206 MOCK_METHOD2(GetWallClockTimes,
207 bool(const std::vector<base::TimeDelta>&,
208 std::vector<base::TimeTicks>*));
210 private:
211 DISALLOW_COPY_AND_ASSIGN(MockTimeSource);
214 class MockTextTrack : public TextTrack {
215 public:
216 MockTextTrack();
217 virtual ~MockTextTrack();
219 MOCK_METHOD5(addWebVTTCue, void(const base::TimeDelta& start,
220 const base::TimeDelta& end,
221 const std::string& id,
222 const std::string& content,
223 const std::string& settings));
225 private:
226 DISALLOW_COPY_AND_ASSIGN(MockTextTrack);
229 class MockDecryptor : public Decryptor {
230 public:
231 MockDecryptor();
232 virtual ~MockDecryptor();
234 MOCK_METHOD2(RegisterNewKeyCB, void(StreamType stream_type,
235 const NewKeyCB& new_key_cb));
236 MOCK_METHOD3(Decrypt, void(StreamType stream_type,
237 const scoped_refptr<DecoderBuffer>& encrypted,
238 const DecryptCB& decrypt_cb));
239 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type));
240 MOCK_METHOD2(InitializeAudioDecoder,
241 void(const AudioDecoderConfig& config,
242 const DecoderInitCB& init_cb));
243 MOCK_METHOD2(InitializeVideoDecoder,
244 void(const VideoDecoderConfig& config,
245 const DecoderInitCB& init_cb));
246 MOCK_METHOD2(DecryptAndDecodeAudio,
247 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
248 const AudioDecodeCB& audio_decode_cb));
249 MOCK_METHOD2(DecryptAndDecodeVideo,
250 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
251 const VideoDecodeCB& video_decode_cb));
252 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type));
253 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type));
255 private:
256 DISALLOW_COPY_AND_ASSIGN(MockDecryptor);
259 } // namespace media
261 #endif // MEDIA_BASE_MOCK_FILTERS_H_