| 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. | 6 // actions if you need interesting side-effects. |
| 7 // | 7 // |
| 8 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock | 8 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock |
| 9 // filters to fail the test or do nothing when an unexpected method is called. | 9 // filters to fail the test or do nothing when an unexpected method is called. |
| 10 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks | 10 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 private: | 270 private: |
| 271 scoped_refptr<MockDemuxer> demuxer_; | 271 scoped_refptr<MockDemuxer> demuxer_; |
| 272 scoped_refptr<MockVideoDecoder> video_decoder_; | 272 scoped_refptr<MockVideoDecoder> video_decoder_; |
| 273 scoped_refptr<MockAudioDecoder> audio_decoder_; | 273 scoped_refptr<MockAudioDecoder> audio_decoder_; |
| 274 scoped_refptr<MockVideoRenderer> video_renderer_; | 274 scoped_refptr<MockVideoRenderer> video_renderer_; |
| 275 scoped_refptr<MockAudioRenderer> audio_renderer_; | 275 scoped_refptr<MockAudioRenderer> audio_renderer_; |
| 276 | 276 |
| 277 DISALLOW_COPY_AND_ASSIGN(MockFilterCollection); | 277 DISALLOW_COPY_AND_ASSIGN(MockFilterCollection); |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 // Helper gmock action that calls SetError() on behalf of the provided filter. | |
| 281 ACTION_P2(SetError, filter, error) { | |
| 282 filter->host()->SetError(error); | |
| 283 } | |
| 284 | |
| 285 ACTION(RunClosure) { | 280 ACTION(RunClosure) { |
| 286 arg0.Run(); | 281 arg0.Run(); |
| 287 } | 282 } |
| 288 | 283 |
| 289 // Helper mock statistics callback. | 284 // Helper mock statistics callback. |
| 290 class MockStatisticsCB { | 285 class MockStatisticsCB { |
| 291 public: | 286 public: |
| 292 MockStatisticsCB(); | 287 MockStatisticsCB(); |
| 293 ~MockStatisticsCB(); | 288 ~MockStatisticsCB(); |
| 294 | 289 |
| 295 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 290 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
| 296 }; | 291 }; |
| 297 | 292 |
| 298 } // namespace media | 293 } // namespace media |
| 299 | 294 |
| 300 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 295 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |