OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // A new breed of mock media filters, this time using gmock! Feel free to add | 5 // A new breed of mock media filters, this time using gmock! Feel free to add |
6 // actions if you need interesting side-effects (i.e., copying data to the | 6 // actions if you need interesting side-effects (i.e., copying data to the |
7 // buffer passed into MockDataSource::Read()). | 7 // buffer passed into MockDataSource::Read()). |
8 // | 8 // |
9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock | 9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock |
10 // filters to fail the test or do nothing when an unexpected method is called. | 10 // filters to fail the test or do nothing when an unexpected method is called. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // Filter implementation. | 205 // Filter implementation. |
206 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 206 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
207 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 207 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
208 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); | 208 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); |
209 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 209 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
210 | 210 |
211 // AudioDecoder implementation. | 211 // AudioDecoder implementation. |
212 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, | 212 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, |
213 const base::Closure& callback, | 213 const base::Closure& callback, |
214 const StatisticsCallback& stats_callback)); | 214 const StatisticsCallback& stats_callback)); |
| 215 MOCK_METHOD1(Read, void(const ReadCB& callback)); |
215 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); | 216 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); |
216 MOCK_METHOD0(bits_per_channel, int(void)); | 217 MOCK_METHOD0(bits_per_channel, int(void)); |
217 MOCK_METHOD0(channel_layout, ChannelLayout(void)); | 218 MOCK_METHOD0(channel_layout, ChannelLayout(void)); |
218 MOCK_METHOD0(samples_per_second, int(void)); | 219 MOCK_METHOD0(samples_per_second, int(void)); |
219 | 220 |
220 void ConsumeAudioSamplesForTest(scoped_refptr<Buffer> buffer) { | |
221 AudioDecoder::ConsumeAudioSamples(buffer); | |
222 } | |
223 | |
224 protected: | 221 protected: |
225 virtual ~MockAudioDecoder(); | 222 virtual ~MockAudioDecoder(); |
226 | 223 |
227 private: | 224 private: |
228 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); | 225 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); |
229 }; | 226 }; |
230 | 227 |
231 class MockVideoRenderer : public VideoRenderer { | 228 class MockVideoRenderer : public VideoRenderer { |
232 public: | 229 public: |
233 MockVideoRenderer(); | 230 MockVideoRenderer(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 public: | 346 public: |
350 MockStatisticsCallback(); | 347 MockStatisticsCallback(); |
351 ~MockStatisticsCallback(); | 348 ~MockStatisticsCallback(); |
352 | 349 |
353 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 350 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
354 }; | 351 }; |
355 | 352 |
356 } // namespace media | 353 } // namespace media |
357 | 354 |
358 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 355 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |