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

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

Issue 2237243002: CL for perf tryjob on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « media/renderers/renderer_impl.cc ('k') | tools/run-perf-test.cfg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 void Play() { 168 void Play() {
169 DCHECK(audio_stream_ || video_stream_); 169 DCHECK(audio_stream_ || video_stream_);
170 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); 170 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH));
171 171
172 base::TimeDelta start_time( 172 base::TimeDelta start_time(
173 base::TimeDelta::FromMilliseconds(kStartPlayingTimeInMs)); 173 base::TimeDelta::FromMilliseconds(kStartPlayingTimeInMs));
174 EXPECT_CALL(time_source_, SetMediaTime(start_time)); 174 EXPECT_CALL(time_source_, SetMediaTime(start_time));
175 EXPECT_CALL(time_source_, StartTicking()); 175 EXPECT_CALL(time_source_, StartTicking());
176 EXPECT_CALL(time_source_, CurrentMediaTime(_)).Times(::testing::AtLeast(1));
177 EXPECT_CALL(callbacks_, OnTimeUpdate(_, _, _)).Times(::testing::AtLeast(1));
176 178
177 if (audio_stream_) { 179 if (audio_stream_) {
178 EXPECT_CALL(*audio_renderer_, StartPlaying()) 180 EXPECT_CALL(*audio_renderer_, StartPlaying())
179 .WillOnce(SetBufferingState(&audio_renderer_client_, 181 .WillOnce(SetBufferingState(&audio_renderer_client_,
180 BUFFERING_HAVE_ENOUGH)); 182 BUFFERING_HAVE_ENOUGH));
181 } 183 }
182 184
183 if (video_stream_) { 185 if (video_stream_) {
184 EXPECT_CALL(*video_renderer_, StartPlayingFrom(start_time)) 186 EXPECT_CALL(*video_renderer_, StartPlayingFrom(start_time))
185 .WillOnce(SetBufferingState(&video_renderer_client_, 187 .WillOnce(SetBufferingState(&video_renderer_client_,
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 // Set a zero threshold such that the underflow will be executed on the next 623 // Set a zero threshold such that the underflow will be executed on the next
622 // run of the message loop. 624 // run of the message loop.
623 renderer_impl_->set_video_underflow_threshold_for_testing(base::TimeDelta()); 625 renderer_impl_->set_video_underflow_threshold_for_testing(base::TimeDelta());
624 626
625 // Underflow should be delayed when both audio and video are present and video 627 // Underflow should be delayed when both audio and video are present and video
626 // underflows. 628 // underflows.
627 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)); 629 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING));
628 video_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING); 630 video_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING);
629 Mock::VerifyAndClearExpectations(&time_source_); 631 Mock::VerifyAndClearExpectations(&time_source_);
630 632
633 EXPECT_CALL(time_source_, CurrentMediaTime(_));
631 EXPECT_CALL(time_source_, StopTicking()); 634 EXPECT_CALL(time_source_, StopTicking());
632 base::RunLoop().RunUntilIdle(); 635 base::RunLoop().RunUntilIdle();
633 } 636 }
634 637
635 TEST_F(RendererImplTest, VideoUnderflowWithAudioVideoRecovers) { 638 TEST_F(RendererImplTest, VideoUnderflowWithAudioVideoRecovers) {
636 InitializeWithAudioAndVideo(); 639 InitializeWithAudioAndVideo();
637 Play(); 640 Play();
638 641
639 // Set a zero threshold such that the underflow will be executed on the next 642 // Set a zero threshold such that the underflow will be executed on the next
640 // run of the message loop. 643 // run of the message loop.
(...skipping 20 matching lines...) Expand all
661 renderer_impl_->set_video_underflow_threshold_for_testing(base::TimeDelta()); 664 renderer_impl_->set_video_underflow_threshold_for_testing(base::TimeDelta());
662 665
663 // Underflow should be delayed when both audio and video are present and video 666 // Underflow should be delayed when both audio and video are present and video
664 // underflows. 667 // underflows.
665 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)) 668 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
666 .Times(0); 669 .Times(0);
667 video_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING); 670 video_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING);
668 Mock::VerifyAndClearExpectations(&time_source_); 671 Mock::VerifyAndClearExpectations(&time_source_);
669 672
670 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)); 673 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING));
674 EXPECT_CALL(time_source_, CurrentMediaTime(_));
671 EXPECT_CALL(time_source_, StopTicking()); 675 EXPECT_CALL(time_source_, StopTicking());
672 audio_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING); 676 audio_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING);
673 677
674 // Nothing else should primed on the message loop. 678 // Nothing else should primed on the message loop.
675 base::RunLoop().RunUntilIdle(); 679 base::RunLoop().RunUntilIdle();
676 } 680 }
677 681
678 TEST_F(RendererImplTest, VideoUnderflowWithAudioFlush) { 682 TEST_F(RendererImplTest, VideoUnderflowWithAudioFlush) {
679 InitializeWithAudioAndVideo(); 683 InitializeWithAudioAndVideo();
680 Play(); 684 Play();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 EXPECT_CALL(*audio_renderer_, Flush(_)).WillOnce(RunClosure<0>()); 739 EXPECT_CALL(*audio_renderer_, Flush(_)).WillOnce(RunClosure<0>());
736 EXPECT_CALL(*audio_renderer_, StartPlaying()).Times(1); 740 EXPECT_CALL(*audio_renderer_, StartPlaying()).Times(1);
737 audio_stream_status_change_cb.Run(false, time0); 741 audio_stream_status_change_cb.Run(false, time0);
738 742
739 EXPECT_CALL(*video_renderer_, Flush(_)).WillOnce(RunClosure<0>()); 743 EXPECT_CALL(*video_renderer_, Flush(_)).WillOnce(RunClosure<0>());
740 EXPECT_CALL(*video_renderer_, StartPlayingFrom(_)).Times(1); 744 EXPECT_CALL(*video_renderer_, StartPlayingFrom(_)).Times(1);
741 video_stream_status_change_cb.Run(false, time0); 745 video_stream_status_change_cb.Run(false, time0);
742 } 746 }
743 747
744 } // namespace media 748 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/renderer_impl.cc ('k') | tools/run-perf-test.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698