| 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. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 public: | 226 public: |
| 227 MockVideoRenderer(); | 227 MockVideoRenderer(); |
| 228 | 228 |
| 229 // Filter implementation. | 229 // Filter implementation. |
| 230 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 230 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
| 231 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 231 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
| 232 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); | 232 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); |
| 233 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 233 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
| 234 | 234 |
| 235 // VideoRenderer implementation. | 235 // VideoRenderer implementation. |
| 236 MOCK_METHOD4(Initialize, void(VideoDecoder* decoder, | 236 MOCK_METHOD4(Initialize, void(const scoped_refptr<VideoDecoder>& decoder, |
| 237 const PipelineStatusCB& callback, | 237 const PipelineStatusCB& pipeline_status_cb, |
| 238 const StatisticsCB& statistics_cb, | 238 const StatisticsCB& statistics_cb, |
| 239 const VideoTimeCB& time_cb)); | 239 const VideoTimeCB& video_time_cb)); |
| 240 | 240 |
| 241 MOCK_METHOD0(HasEnded, bool()); | 241 MOCK_METHOD0(HasEnded, bool()); |
| 242 | 242 |
| 243 // TODO(scherkus): although VideoRendererBase defines this method, this really | 243 // TODO(scherkus): although VideoRendererBase defines this method, this really |
| 244 // shouldn't be here OR should be renamed. | 244 // shouldn't be here OR should be renamed. |
| 245 MOCK_METHOD1(ConsumeVideoFrame, void(scoped_refptr<VideoFrame> frame)); | 245 MOCK_METHOD1(ConsumeVideoFrame, void(scoped_refptr<VideoFrame> frame)); |
| 246 | 246 |
| 247 protected: | 247 protected: |
| 248 virtual ~MockVideoRenderer(); | 248 virtual ~MockVideoRenderer(); |
| 249 | 249 |
| 250 private: | 250 private: |
| 251 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); | 251 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 class MockAudioRenderer : public AudioRenderer { | 254 class MockAudioRenderer : public AudioRenderer { |
| 255 public: | 255 public: |
| 256 MockAudioRenderer(); | 256 MockAudioRenderer(); |
| 257 | 257 |
| 258 // Filter implementation. | 258 // Filter implementation. |
| 259 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 259 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
| 260 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 260 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
| 261 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); | 261 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); |
| 262 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 262 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
| 263 | 263 |
| 264 // AudioRenderer implementation. | 264 // AudioRenderer implementation. |
| 265 MOCK_METHOD4(Initialize, void(const scoped_refptr<AudioDecoder>& decoder, | 265 MOCK_METHOD4(Initialize, void(const scoped_refptr<AudioDecoder>& decoder, |
| 266 const PipelineStatusCB& init_callback, | 266 const PipelineStatusCB& init_cb, |
| 267 const base::Closure& underflow_callback, | 267 const base::Closure& underflow_cb, |
| 268 const AudioTimeCB& time_cb)); | 268 const AudioTimeCB& time_cb)); |
| 269 MOCK_METHOD0(HasEnded, bool()); | 269 MOCK_METHOD0(HasEnded, bool()); |
| 270 MOCK_METHOD1(SetVolume, void(float volume)); | 270 MOCK_METHOD1(SetVolume, void(float volume)); |
| 271 | 271 |
| 272 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); | 272 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); |
| 273 | 273 |
| 274 protected: | 274 protected: |
| 275 virtual ~MockAudioRenderer(); | 275 virtual ~MockAudioRenderer(); |
| 276 | 276 |
| 277 private: | 277 private: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 public: | 346 public: |
| 347 MockStatisticsCB(); | 347 MockStatisticsCB(); |
| 348 ~MockStatisticsCB(); | 348 ~MockStatisticsCB(); |
| 349 | 349 |
| 350 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 350 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
| 351 }; | 351 }; |
| 352 | 352 |
| 353 } // namespace media | 353 } // namespace media |
| 354 | 354 |
| 355 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 355 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |