| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |