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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 MOCK_METHOD1(Stop, void(FilterCallback* callback)); | 165 MOCK_METHOD1(Stop, void(FilterCallback* callback)); |
166 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 166 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
167 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); | 167 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); |
168 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 168 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
169 | 169 |
170 // VideoDecoder implementation. | 170 // VideoDecoder implementation. |
171 MOCK_METHOD2(Initialize, void(DemuxerStream* stream, | 171 MOCK_METHOD2(Initialize, void(DemuxerStream* stream, |
172 FilterCallback* callback)); | 172 FilterCallback* callback)); |
173 MOCK_METHOD0(media_format, const MediaFormat&()); | 173 MOCK_METHOD0(media_format, const MediaFormat&()); |
174 MOCK_METHOD1(FillThisBuffer, void(scoped_refptr<VideoFrame>)); | 174 MOCK_METHOD1(FillThisBuffer, void(scoped_refptr<VideoFrame>)); |
| 175 MOCK_METHOD0(ProvidesBuffer, bool()); |
175 | 176 |
176 protected: | 177 protected: |
177 virtual ~MockVideoDecoder() {} | 178 virtual ~MockVideoDecoder() {} |
178 | 179 |
179 private: | 180 private: |
180 DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder); | 181 DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder); |
181 }; | 182 }; |
182 | 183 |
183 class MockAudioDecoder : public AudioDecoder { | 184 class MockAudioDecoder : public AudioDecoder { |
184 public: | 185 public: |
(...skipping 30 matching lines...) Expand all Loading... |
215 // MediaFilter implementation. | 216 // MediaFilter implementation. |
216 MOCK_METHOD1(Stop, void(FilterCallback* callback)); | 217 MOCK_METHOD1(Stop, void(FilterCallback* callback)); |
217 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 218 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
218 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); | 219 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); |
219 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 220 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
220 | 221 |
221 // VideoRenderer implementation. | 222 // VideoRenderer implementation. |
222 MOCK_METHOD2(Initialize, void(VideoDecoder* decoder, | 223 MOCK_METHOD2(Initialize, void(VideoDecoder* decoder, |
223 FilterCallback* callback)); | 224 FilterCallback* callback)); |
224 MOCK_METHOD0(HasEnded, bool()); | 225 MOCK_METHOD0(HasEnded, bool()); |
| 226 MOCK_METHOD1(FillThisBufferDone, void(scoped_refptr<VideoFrame> frame)); |
225 | 227 |
226 protected: | 228 protected: |
227 virtual ~MockVideoRenderer() {} | 229 virtual ~MockVideoRenderer() {} |
228 | 230 |
229 private: | 231 private: |
230 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); | 232 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); |
231 }; | 233 }; |
232 | 234 |
233 class MockAudioRenderer : public AudioRenderer { | 235 class MockAudioRenderer : public AudioRenderer { |
234 public: | 236 public: |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 361 |
360 // Helper gmock action that calls DisableAudioRenderer() on behalf of the | 362 // Helper gmock action that calls DisableAudioRenderer() on behalf of the |
361 // provided filter. | 363 // provided filter. |
362 ACTION_P(DisableAudioRenderer, filter) { | 364 ACTION_P(DisableAudioRenderer, filter) { |
363 filter->host()->DisableAudioRenderer(); | 365 filter->host()->DisableAudioRenderer(); |
364 } | 366 } |
365 | 367 |
366 } // namespace media | 368 } // namespace media |
367 | 369 |
368 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 370 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |