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

Side by Side Diff: media/renderers/renderer_impl_unittest.cc

Issue 1068593003: Introduce TimeSource notifications to the VideoRenderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Single call. Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 SetAudioRendererInitializeExpectations(PIPELINE_OK); 313 SetAudioRendererInitializeExpectations(PIPELINE_OK);
314 SetVideoRendererInitializeExpectations(PIPELINE_ERROR_INITIALIZATION_FAILED); 314 SetVideoRendererInitializeExpectations(PIPELINE_ERROR_INITIALIZATION_FAILED);
315 InitializeAndExpect(PIPELINE_ERROR_INITIALIZATION_FAILED); 315 InitializeAndExpect(PIPELINE_ERROR_INITIALIZATION_FAILED);
316 } 316 }
317 317
318 TEST_F(RendererImplTest, StartPlayingFrom) { 318 TEST_F(RendererImplTest, StartPlayingFrom) {
319 InitializeWithAudioAndVideo(); 319 InitializeWithAudioAndVideo();
320 Play(); 320 Play();
321 } 321 }
322 322
323 TEST_F(RendererImplTest, StartPlayingFromWithPlaybackRate) {
324 InitializeWithAudioAndVideo();
325
326 // Play with a zero playback rate shouldn't start time.
327 Play();
328 Mock::VerifyAndClearExpectations(video_renderer_);
329
330 // Positive playback rate when ticking should start time.
331 EXPECT_CALL(*video_renderer_, OnTimeStateChanged(true));
332 SetPlaybackRate(1.0);
333 Mock::VerifyAndClearExpectations(video_renderer_);
334
335 // Double notifications shouldn't be sent.
336 SetPlaybackRate(1.0);
337 Mock::VerifyAndClearExpectations(video_renderer_);
338
339 // Zero playback rate should stop time.
340 EXPECT_CALL(*video_renderer_, OnTimeStateChanged(false));
341 SetPlaybackRate(0.0);
342 Mock::VerifyAndClearExpectations(video_renderer_);
343
344 // Double notifications shouldn't be sent.
345 SetPlaybackRate(0.0);
346 Mock::VerifyAndClearExpectations(video_renderer_);
347
348 // Starting playback and flushing should cause time to stop.
349 EXPECT_CALL(*video_renderer_, OnTimeStateChanged(true));
350 EXPECT_CALL(*video_renderer_, OnTimeStateChanged(false));
351 SetPlaybackRate(1.0);
352 Flush(false);
353
354 // A positive playback rate when playback isn't started should do nothing.
355 SetPlaybackRate(1.0);
356 }
357
323 TEST_F(RendererImplTest, FlushAfterInitialization) { 358 TEST_F(RendererImplTest, FlushAfterInitialization) {
324 InitializeWithAudioAndVideo(); 359 InitializeWithAudioAndVideo();
325 Flush(true); 360 Flush(true);
326 } 361 }
327 362
328 TEST_F(RendererImplTest, FlushAfterPlay) { 363 TEST_F(RendererImplTest, FlushAfterPlay) {
329 InitializeWithAudioAndVideo(); 364 InitializeWithAudioAndVideo();
330 Play(); 365 Play();
331 Flush(false); 366 Flush(false);
332 } 367 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 Mock::VerifyAndClearExpectations(&time_source_); 561 Mock::VerifyAndClearExpectations(&time_source_);
527 562
528 EXPECT_CALL(time_source_, StopTicking()); 563 EXPECT_CALL(time_source_, StopTicking());
529 audio_buffering_state_cb_.Run(BUFFERING_HAVE_NOTHING); 564 audio_buffering_state_cb_.Run(BUFFERING_HAVE_NOTHING);
530 565
531 // Nothing else should primed on the message loop. 566 // Nothing else should primed on the message loop.
532 base::RunLoop().RunUntilIdle(); 567 base::RunLoop().RunUntilIdle();
533 } 568 }
534 569
535 } // namespace media 570 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698