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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Filter implementation. | 207 // Filter implementation. |
208 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 208 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
209 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 209 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
210 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); | 210 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); |
211 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 211 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
212 | 212 |
213 // AudioDecoder implementation. | 213 // AudioDecoder implementation. |
214 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, | 214 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, |
215 const base::Closure& callback, | 215 const base::Closure& callback, |
216 const StatisticsCallback& stats_callback)); | 216 const StatisticsCallback& stats_callback)); |
| 217 MOCK_METHOD1(Read, void(const ReadCB& callback)); |
217 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); | 218 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); |
218 MOCK_METHOD0(bits_per_channel, int(void)); | 219 MOCK_METHOD0(bits_per_channel, int(void)); |
219 MOCK_METHOD0(channel_layout, ChannelLayout(void)); | 220 MOCK_METHOD0(channel_layout, ChannelLayout(void)); |
220 MOCK_METHOD0(samples_per_second, int(void)); | 221 MOCK_METHOD0(samples_per_second, int(void)); |
221 | 222 |
222 void ConsumeAudioSamplesForTest(scoped_refptr<Buffer> buffer) { | |
223 AudioDecoder::ConsumeAudioSamples(buffer); | |
224 } | |
225 | |
226 protected: | 223 protected: |
227 virtual ~MockAudioDecoder(); | 224 virtual ~MockAudioDecoder(); |
228 | 225 |
229 private: | 226 private: |
230 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); | 227 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); |
231 }; | 228 }; |
232 | 229 |
233 class MockVideoRenderer : public VideoRenderer { | 230 class MockVideoRenderer : public VideoRenderer { |
234 public: | 231 public: |
235 MockVideoRenderer(); | 232 MockVideoRenderer(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 public: | 348 public: |
352 MockStatisticsCallback(); | 349 MockStatisticsCallback(); |
353 ~MockStatisticsCallback(); | 350 ~MockStatisticsCallback(); |
354 | 351 |
355 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 352 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
356 }; | 353 }; |
357 | 354 |
358 } // namespace media | 355 } // namespace media |
359 | 356 |
360 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 357 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |