OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |