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

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

Issue 568113003: Switch back to using VideoRenderer::StartPlayingFrom(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix + rebase Created 6 years, 3 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/filters/renderer_impl.cc ('k') | media/filters/video_renderer_impl.h » ('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 <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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 CreateAudioAndVideoStream(); 165 CreateAudioAndVideoStream();
166 SetAudioRendererInitializeExpectations(PIPELINE_OK); 166 SetAudioRendererInitializeExpectations(PIPELINE_OK);
167 SetVideoRendererInitializeExpectations(PIPELINE_OK); 167 SetVideoRendererInitializeExpectations(PIPELINE_OK);
168 InitializeAndExpect(PIPELINE_OK); 168 InitializeAndExpect(PIPELINE_OK);
169 } 169 }
170 170
171 void Play() { 171 void Play() {
172 DCHECK(audio_stream_ || video_stream_); 172 DCHECK(audio_stream_ || video_stream_);
173 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); 173 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH));
174 174
175 base::TimeDelta start_time(
176 base::TimeDelta::FromMilliseconds(kStartPlayingTimeInMs));
177
175 if (audio_stream_) { 178 if (audio_stream_) {
176 EXPECT_CALL(time_source_, 179 EXPECT_CALL(time_source_, SetMediaTime(start_time));
177 SetMediaTime(base::TimeDelta::FromMilliseconds(
178 kStartPlayingTimeInMs)));
179 EXPECT_CALL(time_source_, StartTicking()); 180 EXPECT_CALL(time_source_, StartTicking());
180 EXPECT_CALL(*audio_renderer_, StartPlaying()) 181 EXPECT_CALL(*audio_renderer_, StartPlaying())
181 .WillOnce(SetBufferingState(&audio_buffering_state_cb_, 182 .WillOnce(SetBufferingState(&audio_buffering_state_cb_,
182 BUFFERING_HAVE_ENOUGH)); 183 BUFFERING_HAVE_ENOUGH));
183 } 184 }
184 185
185 if (video_stream_) { 186 if (video_stream_) {
186 EXPECT_CALL(*video_renderer_, StartPlaying()) 187 EXPECT_CALL(*video_renderer_, StartPlayingFrom(start_time))
187 .WillOnce(SetBufferingState(&video_buffering_state_cb_, 188 .WillOnce(SetBufferingState(&video_buffering_state_cb_,
188 BUFFERING_HAVE_ENOUGH)); 189 BUFFERING_HAVE_ENOUGH));
189 } 190 }
190 191
191 renderer_impl_->StartPlayingFrom( 192 renderer_impl_->StartPlayingFrom(start_time);
192 base::TimeDelta::FromMilliseconds(kStartPlayingTimeInMs));
193 base::RunLoop().RunUntilIdle(); 193 base::RunLoop().RunUntilIdle();
194 } 194 }
195 195
196 void Flush(bool underflowed) { 196 void Flush(bool underflowed) {
197 if (audio_stream_) { 197 if (audio_stream_) {
198 if (!underflowed) 198 if (!underflowed)
199 EXPECT_CALL(time_source_, StopTicking()); 199 EXPECT_CALL(time_source_, StopTicking());
200 EXPECT_CALL(*audio_renderer_, Flush(_)) 200 EXPECT_CALL(*audio_renderer_, Flush(_))
201 .WillOnce(DoAll(SetBufferingState(&audio_buffering_state_cb_, 201 .WillOnce(DoAll(SetBufferingState(&audio_buffering_state_cb_,
202 BUFFERING_HAVE_NOTHING), 202 BUFFERING_HAVE_NOTHING),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 InitializeWithAudio(); 425 InitializeWithAudio();
426 Play(); 426 Play();
427 Flush(false); 427 Flush(false);
428 428
429 EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_DECODE)); 429 EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_DECODE));
430 audio_error_cb_.Run(PIPELINE_ERROR_DECODE); 430 audio_error_cb_.Run(PIPELINE_ERROR_DECODE);
431 base::RunLoop().RunUntilIdle(); 431 base::RunLoop().RunUntilIdle();
432 } 432 }
433 433
434 } // namespace media 434 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/renderer_impl.cc ('k') | media/filters/video_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698