| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 MockAudioRenderer* audio_renderer() const { return audio_renderer_; } | 286 MockAudioRenderer* audio_renderer() const { return audio_renderer_; } |
| 287 | 287 |
| 288 MediaFilterCollection* filter_collection() const { | 288 MediaFilterCollection* filter_collection() const { |
| 289 return filter_collection(true); | 289 return filter_collection(true); |
| 290 } | 290 } |
| 291 | 291 |
| 292 MediaFilterCollection* filter_collection(bool include_data_source) const { | 292 MediaFilterCollection* filter_collection(bool include_data_source) const { |
| 293 MediaFilterCollection* collection = new MediaFilterCollection(); | 293 MediaFilterCollection* collection = new MediaFilterCollection(); |
| 294 | 294 |
| 295 if (include_data_source) { | 295 if (include_data_source) { |
| 296 collection->AddDataSource(data_source_); | 296 collection->AddFilter(data_source_); |
| 297 } | 297 } |
| 298 collection->AddDemuxer(demuxer_); | 298 collection->AddFilter(demuxer_); |
| 299 collection->AddVideoDecoder(video_decoder_); | 299 collection->AddFilter(video_decoder_); |
| 300 collection->AddAudioDecoder(audio_decoder_); | 300 collection->AddFilter(audio_decoder_); |
| 301 collection->AddVideoRenderer(video_renderer_); | 301 collection->AddFilter(video_renderer_); |
| 302 collection->AddAudioRenderer(audio_renderer_); | 302 collection->AddFilter(audio_renderer_); |
| 303 return collection; | 303 return collection; |
| 304 } | 304 } |
| 305 | 305 |
| 306 private: | 306 private: |
| 307 scoped_refptr<MockDataSource> data_source_; | 307 scoped_refptr<MockDataSource> data_source_; |
| 308 scoped_refptr<MockDemuxer> demuxer_; | 308 scoped_refptr<MockDemuxer> demuxer_; |
| 309 scoped_refptr<MockVideoDecoder> video_decoder_; | 309 scoped_refptr<MockVideoDecoder> video_decoder_; |
| 310 scoped_refptr<MockAudioDecoder> audio_decoder_; | 310 scoped_refptr<MockAudioDecoder> audio_decoder_; |
| 311 scoped_refptr<MockVideoRenderer> video_renderer_; | 311 scoped_refptr<MockVideoRenderer> video_renderer_; |
| 312 scoped_refptr<MockAudioRenderer> audio_renderer_; | 312 scoped_refptr<MockAudioRenderer> audio_renderer_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 // Helper gmock action that calls DisableAudioRenderer() on behalf of the | 355 // Helper gmock action that calls DisableAudioRenderer() on behalf of the |
| 356 // provided filter. | 356 // provided filter. |
| 357 ACTION_P(DisableAudioRenderer, filter) { | 357 ACTION_P(DisableAudioRenderer, filter) { |
| 358 filter->host()->DisableAudioRenderer(); | 358 filter->host()->DisableAudioRenderer(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace media | 361 } // namespace media |
| 362 | 362 |
| 363 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 363 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |