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

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) 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 public: 230 public:
231 MockVideoRenderer(); 231 MockVideoRenderer();
232 232
233 // Filter implementation. 233 // Filter implementation.
234 MOCK_METHOD1(Stop, void(const base::Closure& callback)); 234 MOCK_METHOD1(Stop, void(const base::Closure& callback));
235 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 235 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
236 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); 236 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb));
237 MOCK_METHOD0(OnAudioRendererDisabled, void()); 237 MOCK_METHOD0(OnAudioRendererDisabled, void());
238 238
239 // VideoRenderer implementation. 239 // VideoRenderer implementation.
240 MOCK_METHOD3(Initialize, void(VideoDecoder* decoder, 240 MOCK_METHOD4(Initialize, void(VideoDecoder* decoder,
241 const base::Closure& callback, 241 const base::Closure& init_callback,
242 const StatisticsCallback& stats_callback)); 242 const StatisticsCallback& stats_callback,
243 const VideoTimeCB& time_cb));
244
243 MOCK_METHOD0(HasEnded, bool()); 245 MOCK_METHOD0(HasEnded, bool());
244 246
245 // TODO(scherkus): although VideoRendererBase defines this method, this really 247 // TODO(scherkus): although VideoRendererBase defines this method, this really
246 // shouldn't be here OR should be renamed. 248 // shouldn't be here OR should be renamed.
247 MOCK_METHOD1(ConsumeVideoFrame, void(scoped_refptr<VideoFrame> frame)); 249 MOCK_METHOD1(ConsumeVideoFrame, void(scoped_refptr<VideoFrame> frame));
248 250
249 protected: 251 protected:
250 virtual ~MockVideoRenderer(); 252 virtual ~MockVideoRenderer();
251 253
252 private: 254 private:
253 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); 255 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer);
254 }; 256 };
255 257
256 class MockAudioRenderer : public AudioRenderer { 258 class MockAudioRenderer : public AudioRenderer {
257 public: 259 public:
258 MockAudioRenderer(); 260 MockAudioRenderer();
259 261
260 // Filter implementation. 262 // Filter implementation.
261 MOCK_METHOD1(Stop, void(const base::Closure& callback)); 263 MOCK_METHOD1(Stop, void(const base::Closure& callback));
262 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 264 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
263 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); 265 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb));
264 MOCK_METHOD0(OnAudioRendererDisabled, void()); 266 MOCK_METHOD0(OnAudioRendererDisabled, void());
265 267
266 // AudioRenderer implementation. 268 // AudioRenderer implementation.
267 MOCK_METHOD3(Initialize, void(AudioDecoder* decoder, 269 MOCK_METHOD4(Initialize, void(AudioDecoder* decoder,
268 const base::Closure& init_callback, 270 const base::Closure& init_callback,
269 const base::Closure& underflow_callback)); 271 const base::Closure& underflow_callback,
272 const AudioTimeCB& time_cb));
270 MOCK_METHOD0(HasEnded, bool()); 273 MOCK_METHOD0(HasEnded, bool());
271 MOCK_METHOD1(SetVolume, void(float volume)); 274 MOCK_METHOD1(SetVolume, void(float volume));
272 275
273 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); 276 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio));
274 277
275 protected: 278 protected:
276 virtual ~MockAudioRenderer(); 279 virtual ~MockAudioRenderer();
277 280
278 private: 281 private:
279 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); 282 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 }; 315 };
313 316
314 // Helper gmock functions that immediately executes and destroys the 317 // Helper gmock functions that immediately executes and destroys the
315 // Closure on behalf of the provided filter. Can be used when mocking 318 // Closure on behalf of the provided filter. Can be used when mocking
316 // the Initialize() and Seek() methods. 319 // the Initialize() and Seek() methods.
317 void RunFilterCallback(::testing::Unused, const base::Closure& callback); 320 void RunFilterCallback(::testing::Unused, const base::Closure& callback);
318 void RunFilterStatusCB(::testing::Unused, const FilterStatusCB& cb); 321 void RunFilterStatusCB(::testing::Unused, const FilterStatusCB& cb);
319 void RunPipelineStatusCB(PipelineStatus status, const PipelineStatusCB& cb); 322 void RunPipelineStatusCB(PipelineStatus status, const PipelineStatusCB& cb);
320 void RunFilterCallback3(::testing::Unused, const base::Closure& callback, 323 void RunFilterCallback3(::testing::Unused, const base::Closure& callback,
321 ::testing::Unused); 324 ::testing::Unused);
325 void RunFilterCallback4(::testing::Unused, const base::Closure& callback,
326 ::testing::Unused, ::testing::Unused);
322 327
323 // Helper gmock function that immediately executes the Closure on behalf of the 328 // Helper gmock function that immediately executes the Closure on behalf of the
324 // provided filter. Can be used when mocking the Stop() method. 329 // provided filter. Can be used when mocking the Stop() method.
325 void RunStopFilterCallback(const base::Closure& callback); 330 void RunStopFilterCallback(const base::Closure& callback);
326 331
327 // Helper gmock action that calls SetError() on behalf of the provided filter. 332 // Helper gmock action that calls SetError() on behalf of the provided filter.
328 ACTION_P2(SetError, filter, error) { 333 ACTION_P2(SetError, filter, error) {
329 filter->host()->SetError(error); 334 filter->host()->SetError(error);
330 } 335 }
331 336
(...skipping 14 matching lines...) Expand all
346 public: 351 public:
347 MockStatisticsCallback(); 352 MockStatisticsCallback();
348 ~MockStatisticsCallback(); 353 ~MockStatisticsCallback();
349 354
350 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); 355 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics));
351 }; 356 };
352 357
353 } // namespace media 358 } // namespace media
354 359
355 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 360 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698