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