Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: media/base/mock_filters.h

Issue 9155003: Fix media timeline so that thumb never exceeds buffered data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 public: 231 public:
232 MockVideoRenderer(); 232 MockVideoRenderer();
233 233
234 // Filter implementation. 234 // Filter implementation.
235 MOCK_METHOD1(Stop, void(const base::Closure& callback)); 235 MOCK_METHOD1(Stop, void(const base::Closure& callback));
236 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 236 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
237 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); 237 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb));
238 MOCK_METHOD0(OnAudioRendererDisabled, void()); 238 MOCK_METHOD0(OnAudioRendererDisabled, void());
239 239
240 // VideoRenderer implementation. 240 // VideoRenderer implementation.
241 MOCK_METHOD3(Initialize, void(VideoDecoder* decoder, 241 MOCK_METHOD4(Initialize, void(VideoDecoder* decoder,
242 const base::Closure& callback, 242 const base::Closure& init_callback,
243 const StatisticsCallback& stats_callback)); 243 const StatisticsCallback& stats_callback,
244 const VideoTimeCB& time_cb));
245
244 MOCK_METHOD0(HasEnded, bool()); 246 MOCK_METHOD0(HasEnded, bool());
245 247
246 // TODO(scherkus): although VideoRendererBase defines this method, this really 248 // TODO(scherkus): although VideoRendererBase defines this method, this really
247 // shouldn't be here OR should be renamed. 249 // shouldn't be here OR should be renamed.
248 MOCK_METHOD1(ConsumeVideoFrame, void(scoped_refptr<VideoFrame> frame)); 250 MOCK_METHOD1(ConsumeVideoFrame, void(scoped_refptr<VideoFrame> frame));
249 251
250 protected: 252 protected:
251 virtual ~MockVideoRenderer(); 253 virtual ~MockVideoRenderer();
252 254
253 private: 255 private:
254 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); 256 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer);
255 }; 257 };
256 258
257 class MockAudioRenderer : public AudioRenderer { 259 class MockAudioRenderer : public AudioRenderer {
258 public: 260 public:
259 MockAudioRenderer(); 261 MockAudioRenderer();
260 262
261 // Filter implementation. 263 // Filter implementation.
262 MOCK_METHOD1(Stop, void(const base::Closure& callback)); 264 MOCK_METHOD1(Stop, void(const base::Closure& callback));
263 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 265 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
264 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); 266 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb));
265 MOCK_METHOD0(OnAudioRendererDisabled, void()); 267 MOCK_METHOD0(OnAudioRendererDisabled, void());
266 268
267 // AudioRenderer implementation. 269 // AudioRenderer implementation.
268 MOCK_METHOD3(Initialize, void(AudioDecoder* decoder, 270 MOCK_METHOD4(Initialize, void(AudioDecoder* decoder,
269 const base::Closure& init_callback, 271 const base::Closure& init_callback,
270 const base::Closure& underflow_callback)); 272 const base::Closure& underflow_callback,
273 const AudioTimeCB& time_cb));
271 MOCK_METHOD0(HasEnded, bool()); 274 MOCK_METHOD0(HasEnded, bool());
272 MOCK_METHOD1(SetVolume, void(float volume)); 275 MOCK_METHOD1(SetVolume, void(float volume));
273 276
274 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); 277 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio));
275 278
276 protected: 279 protected:
277 virtual ~MockAudioRenderer(); 280 virtual ~MockAudioRenderer();
278 281
279 private: 282 private:
280 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); 283 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 }; 317 };
315 318
316 // Helper gmock functions that immediately executes and destroys the 319 // Helper gmock functions that immediately executes and destroys the
317 // Closure on behalf of the provided filter. Can be used when mocking 320 // Closure on behalf of the provided filter. Can be used when mocking
318 // the Initialize() and Seek() methods. 321 // the Initialize() and Seek() methods.
319 void RunFilterCallback(::testing::Unused, const base::Closure& callback); 322 void RunFilterCallback(::testing::Unused, const base::Closure& callback);
320 void RunFilterStatusCB(::testing::Unused, const FilterStatusCB& cb); 323 void RunFilterStatusCB(::testing::Unused, const FilterStatusCB& cb);
321 void RunPipelineStatusCB(PipelineStatus status, const PipelineStatusCB& cb); 324 void RunPipelineStatusCB(PipelineStatus status, const PipelineStatusCB& cb);
322 void RunFilterCallback3(::testing::Unused, const base::Closure& callback, 325 void RunFilterCallback3(::testing::Unused, const base::Closure& callback,
323 ::testing::Unused); 326 ::testing::Unused);
327 void RunFilterCallback4(::testing::Unused, const base::Closure& callback,
328 ::testing::Unused, ::testing::Unused);
324 329
325 // Helper gmock function that immediately executes the Closure on behalf of the 330 // Helper gmock function that immediately executes the Closure on behalf of the
326 // provided filter. Can be used when mocking the Stop() method. 331 // provided filter. Can be used when mocking the Stop() method.
327 void RunStopFilterCallback(const base::Closure& callback); 332 void RunStopFilterCallback(const base::Closure& callback);
328 333
329 // Helper gmock action that calls SetError() on behalf of the provided filter. 334 // Helper gmock action that calls SetError() on behalf of the provided filter.
330 ACTION_P2(SetError, filter, error) { 335 ACTION_P2(SetError, filter, error) {
331 filter->host()->SetError(error); 336 filter->host()->SetError(error);
332 } 337 }
333 338
(...skipping 14 matching lines...) Expand all
348 public: 353 public:
349 MockStatisticsCallback(); 354 MockStatisticsCallback();
350 ~MockStatisticsCallback(); 355 ~MockStatisticsCallback();
351 356
352 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); 357 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics));
353 }; 358 };
354 359
355 } // namespace media 360 } // namespace media
356 361
357 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 362 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698