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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 }; | 281 }; |
282 | 282 |
283 // FilterFactory that returns canned instances of mock filters. You can set | 283 // FilterFactory that returns canned instances of mock filters. You can set |
284 // expectations on the filters and then pass the collection into a pipeline. | 284 // expectations on the filters and then pass the collection into a pipeline. |
285 class MockFilterCollection { | 285 class MockFilterCollection { |
286 public: | 286 public: |
287 MockFilterCollection(); | 287 MockFilterCollection(); |
288 virtual ~MockFilterCollection(); | 288 virtual ~MockFilterCollection(); |
289 | 289 |
290 // Mock accessors. | 290 // Mock accessors. |
291 MockDemuxer* demuxer() const { return demuxer_; } | 291 MockDemuxer* demuxer() const { return demuxer_.get(); } |
292 MockVideoDecoder* video_decoder() const { return video_decoder_; } | 292 MockVideoDecoder* video_decoder() const { return video_decoder_.get(); } |
293 MockAudioDecoder* audio_decoder() const { return audio_decoder_; } | 293 MockAudioDecoder* audio_decoder() const { return audio_decoder_.get(); } |
294 MockVideoRenderer* video_renderer() const { return video_renderer_; } | 294 MockVideoRenderer* video_renderer() const { return video_renderer_.get(); } |
295 MockAudioRenderer* audio_renderer() const { return audio_renderer_; } | 295 MockAudioRenderer* audio_renderer() const { return audio_renderer_.get(); } |
296 | 296 |
297 // Creates the FilterCollection containing the mocks. | 297 // Creates the FilterCollection containing the mocks. |
298 scoped_ptr<FilterCollection> Create(); | 298 scoped_ptr<FilterCollection> Create(); |
299 | 299 |
300 private: | 300 private: |
301 scoped_refptr<MockDemuxer> demuxer_; | 301 scoped_refptr<MockDemuxer> demuxer_; |
302 scoped_refptr<MockVideoDecoder> video_decoder_; | 302 scoped_refptr<MockVideoDecoder> video_decoder_; |
303 scoped_refptr<MockAudioDecoder> audio_decoder_; | 303 scoped_refptr<MockAudioDecoder> audio_decoder_; |
304 scoped_refptr<MockVideoRenderer> video_renderer_; | 304 scoped_refptr<MockVideoRenderer> video_renderer_; |
305 scoped_refptr<MockAudioRenderer> audio_renderer_; | 305 scoped_refptr<MockAudioRenderer> audio_renderer_; |
(...skipping 10 matching lines...) Expand all Loading... |
316 public: | 316 public: |
317 MockStatisticsCB(); | 317 MockStatisticsCB(); |
318 ~MockStatisticsCB(); | 318 ~MockStatisticsCB(); |
319 | 319 |
320 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 320 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
321 }; | 321 }; |
322 | 322 |
323 } // namespace media | 323 } // namespace media |
324 | 324 |
325 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 325 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |