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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 .WillOnce(DoAll(SetBufferingState(&audio_renderer_client_, | 235 .WillOnce(DoAll(SetBufferingState(&audio_renderer_client_, |
236 BUFFERING_HAVE_NOTHING), | 236 BUFFERING_HAVE_NOTHING), |
237 RunClosure<0>())); | 237 RunClosure<0>())); |
238 } | 238 } |
239 | 239 |
240 if (video_stream_) { | 240 if (video_stream_) { |
241 EXPECT_CALL(*video_renderer_, Flush(_)) | 241 EXPECT_CALL(*video_renderer_, Flush(_)) |
242 .WillOnce(DoAll(SetBufferingState(&video_renderer_client_, | 242 .WillOnce(DoAll(SetBufferingState(&video_renderer_client_, |
243 BUFFERING_HAVE_NOTHING), | 243 BUFFERING_HAVE_NOTHING), |
244 RunClosure<0>())); | 244 RunClosure<0>())); |
245 } | 245 } |
xhwang
2017/04/06 17:42:55
Now it's not guaranteed that Flush() will Flush()
servolk
2017/04/06 17:51:31
Audio/video renderers won't be flushed only when c
| |
246 | 246 |
247 EXPECT_CALL(callbacks_, OnFlushed()); | 247 EXPECT_CALL(callbacks_, OnFlushed()); |
248 | 248 |
249 renderer_impl_->Flush( | 249 renderer_impl_->Flush( |
250 base::Bind(&CallbackHelper::OnFlushed, base::Unretained(&callbacks_))); | 250 base::Bind(&CallbackHelper::OnFlushed, base::Unretained(&callbacks_))); |
251 base::RunLoop().RunUntilIdle(); | 251 base::RunLoop().RunUntilIdle(); |
252 } | 252 } |
253 | 253 |
254 void SetPlaybackRate(double playback_rate) { | 254 void SetPlaybackRate(double playback_rate) { |
255 EXPECT_CALL(time_source_, SetPlaybackRate(playback_rate)); | 255 EXPECT_CALL(time_source_, SetPlaybackRate(playback_rate)); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
485 EXPECT_CALL(*video_renderer_, OnTimeStopped()); | 485 EXPECT_CALL(*video_renderer_, OnTimeStopped()); |
486 SetPlaybackRate(1.0); | 486 SetPlaybackRate(1.0); |
487 Flush(false); | 487 Flush(false); |
488 | 488 |
489 // A positive playback rate when playback isn't started should do nothing. | 489 // A positive playback rate when playback isn't started should do nothing. |
490 SetPlaybackRate(1.0); | 490 SetPlaybackRate(1.0); |
491 } | 491 } |
492 | 492 |
493 TEST_F(RendererImplTest, FlushAfterInitialization) { | 493 TEST_F(RendererImplTest, FlushAfterInitialization) { |
494 InitializeWithAudioAndVideo(); | 494 InitializeWithAudioAndVideo(); |
495 Flush(true); | 495 EXPECT_CALL(callbacks_, OnFlushed()); |
496 renderer_impl_->Flush( | |
497 base::Bind(&CallbackHelper::OnFlushed, base::Unretained(&callbacks_))); | |
498 base::RunLoop().RunUntilIdle(); | |
496 } | 499 } |
497 | 500 |
498 TEST_F(RendererImplTest, FlushAfterPlay) { | 501 TEST_F(RendererImplTest, FlushAfterPlay) { |
499 InitializeWithAudioAndVideo(); | 502 InitializeWithAudioAndVideo(); |
500 Play(); | 503 Play(); |
501 Flush(false); | 504 Flush(false); |
502 } | 505 } |
503 | 506 |
504 TEST_F(RendererImplTest, FlushAfterUnderflow) { | 507 TEST_F(RendererImplTest, FlushAfterUnderflow) { |
505 InitializeWithAudioAndVideo(); | 508 InitializeWithAudioAndVideo(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 // change processing involves Flush + StartPlaying when the Flush is done. The | 845 // change processing involves Flush + StartPlaying when the Flush is done. The |
843 // Flush operation is async in this case, so the second status change will be | 846 // Flush operation is async in this case, so the second status change will be |
844 // postponed by renderer until after processing the first one is finished. But | 847 // postponed by renderer until after processing the first one is finished. But |
845 // we must still get two pairs of Flush/StartPlaying calls eventually. | 848 // we must still get two pairs of Flush/StartPlaying calls eventually. |
846 stream_status_change_cb.Run(video_stream_.get(), false, base::TimeDelta()); | 849 stream_status_change_cb.Run(video_stream_.get(), false, base::TimeDelta()); |
847 stream_status_change_cb.Run(video_stream_.get(), true, base::TimeDelta()); | 850 stream_status_change_cb.Run(video_stream_.get(), true, base::TimeDelta()); |
848 base::RunLoop().Run(); | 851 base::RunLoop().Run(); |
849 } | 852 } |
850 | 853 |
851 } // namespace media | 854 } // namespace media |
OLD | NEW |