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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void SetPlaybackRate(float playback_rate) { | 223 void SetPlaybackRate(float playback_rate) { |
224 EXPECT_CALL(time_source_, SetPlaybackRate(playback_rate)); | 224 EXPECT_CALL(time_source_, SetPlaybackRate(playback_rate)); |
225 renderer_impl_->SetPlaybackRate(playback_rate); | 225 renderer_impl_->SetPlaybackRate(playback_rate); |
226 base::RunLoop().RunUntilIdle(); | 226 base::RunLoop().RunUntilIdle(); |
227 } | 227 } |
228 | 228 |
229 int64 GetMediaTimeMs() { | 229 int64 GetMediaTimeMs() { |
230 return renderer_impl_->GetMediaTime().InMilliseconds(); | 230 return renderer_impl_->GetMediaTime().InMilliseconds(); |
231 } | 231 } |
232 | 232 |
233 bool IsMediaTimeAdvancing(float playback_rate) { | 233 bool IsMediaTimeAdvancing(double playback_rate) { |
234 int64 start_time_ms = GetMediaTimeMs(); | 234 int64 start_time_ms = GetMediaTimeMs(); |
235 const int64 time_to_advance_ms = 100; | 235 const int64 time_to_advance_ms = 100; |
236 | 236 |
237 test_tick_clock_.Advance( | 237 test_tick_clock_.Advance( |
238 base::TimeDelta::FromMilliseconds(time_to_advance_ms)); | 238 base::TimeDelta::FromMilliseconds(time_to_advance_ms)); |
239 | 239 |
240 if (GetMediaTimeMs() == start_time_ms + time_to_advance_ms * playback_rate) | 240 if (GetMediaTimeMs() == start_time_ms + time_to_advance_ms * playback_rate) |
241 return true; | 241 return true; |
242 | 242 |
243 DCHECK_EQ(start_time_ms, GetMediaTimeMs()); | 243 DCHECK_EQ(start_time_ms, GetMediaTimeMs()); |
244 return false; | 244 return false; |
245 } | 245 } |
246 | 246 |
247 bool IsMediaTimeAdvancing() { | 247 bool IsMediaTimeAdvancing() { |
248 return IsMediaTimeAdvancing(1.0f); | 248 return IsMediaTimeAdvancing(1.0); |
249 } | 249 } |
250 | 250 |
251 // Fixture members. | 251 // Fixture members. |
252 base::MessageLoop message_loop_; | 252 base::MessageLoop message_loop_; |
253 StrictMock<CallbackHelper> callbacks_; | 253 StrictMock<CallbackHelper> callbacks_; |
254 base::SimpleTestTickClock test_tick_clock_; | 254 base::SimpleTestTickClock test_tick_clock_; |
255 | 255 |
256 scoped_ptr<StrictMock<MockDemuxer> > demuxer_; | 256 scoped_ptr<StrictMock<MockDemuxer> > demuxer_; |
257 StrictMock<MockVideoRenderer>* video_renderer_; | 257 StrictMock<MockVideoRenderer>* video_renderer_; |
258 StrictMock<MockAudioRenderer>* audio_renderer_; | 258 StrictMock<MockAudioRenderer>* audio_renderer_; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 Mock::VerifyAndClearExpectations(&time_source_); | 561 Mock::VerifyAndClearExpectations(&time_source_); |
562 | 562 |
563 EXPECT_CALL(time_source_, StopTicking()); | 563 EXPECT_CALL(time_source_, StopTicking()); |
564 audio_buffering_state_cb_.Run(BUFFERING_HAVE_NOTHING); | 564 audio_buffering_state_cb_.Run(BUFFERING_HAVE_NOTHING); |
565 | 565 |
566 // Nothing else should primed on the message loop. | 566 // Nothing else should primed on the message loop. |
567 base::RunLoop().RunUntilIdle(); | 567 base::RunLoop().RunUntilIdle(); |
568 } | 568 } |
569 | 569 |
570 } // namespace media | 570 } // namespace media |
OLD | NEW |