OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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. |
11 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks | 11 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks |
12 | 12 |
13 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ | 13 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ |
14 #define MEDIA_BASE_MOCK_FILTERS_H_ | 14 #define MEDIA_BASE_MOCK_FILTERS_H_ |
15 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "base/callback.h" | 18 #include "base/callback.h" |
| 19 #include "media/base/audio_decoder.h" |
19 #include "media/base/audio_decoder_config.h" | 20 #include "media/base/audio_decoder_config.h" |
20 #include "media/base/demuxer.h" | 21 #include "media/base/demuxer.h" |
21 #include "media/base/filters.h" | 22 #include "media/base/filters.h" |
22 #include "media/base/filter_collection.h" | 23 #include "media/base/filter_collection.h" |
23 #include "media/base/pipeline.h" | 24 #include "media/base/pipeline.h" |
24 #include "media/base/video_decoder_config.h" | 25 #include "media/base/video_decoder_config.h" |
25 #include "media/base/video_frame.h" | 26 #include "media/base/video_frame.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
27 | 28 |
28 namespace media { | 29 namespace media { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 virtual ~MockVideoDecoder(); | 197 virtual ~MockVideoDecoder(); |
197 | 198 |
198 private: | 199 private: |
199 DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder); | 200 DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder); |
200 }; | 201 }; |
201 | 202 |
202 class MockAudioDecoder : public AudioDecoder { | 203 class MockAudioDecoder : public AudioDecoder { |
203 public: | 204 public: |
204 MockAudioDecoder(); | 205 MockAudioDecoder(); |
205 | 206 |
206 // Filter implementation. | |
207 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | |
208 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | |
209 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); | |
210 MOCK_METHOD0(OnAudioRendererDisabled, void()); | |
211 | |
212 // AudioDecoder implementation. | 207 // AudioDecoder implementation. |
213 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, | 208 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, |
214 const PipelineStatusCB& callback, | 209 const PipelineStatusCB& callback, |
215 const StatisticsCallback& stats_callback)); | 210 const StatisticsCallback& stats_callback)); |
216 MOCK_METHOD1(Read, void(const ReadCB& callback)); | 211 MOCK_METHOD1(Read, void(const ReadCB& callback)); |
217 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); | 212 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); |
218 MOCK_METHOD0(bits_per_channel, int(void)); | 213 MOCK_METHOD0(bits_per_channel, int(void)); |
219 MOCK_METHOD0(channel_layout, ChannelLayout(void)); | 214 MOCK_METHOD0(channel_layout, ChannelLayout(void)); |
220 MOCK_METHOD0(samples_per_second, int(void)); | 215 MOCK_METHOD0(samples_per_second, int(void)); |
221 | 216 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 public: | 345 public: |
351 MockStatisticsCallback(); | 346 MockStatisticsCallback(); |
352 ~MockStatisticsCallback(); | 347 ~MockStatisticsCallback(); |
353 | 348 |
354 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 349 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
355 }; | 350 }; |
356 | 351 |
357 } // namespace media | 352 } // namespace media |
358 | 353 |
359 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 354 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |