| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 private: | 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); | 54 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 RendererImplTest() | 57 RendererImplTest() |
| 58 : demuxer_(new StrictMock<MockDemuxer>()), | 58 : demuxer_(new StrictMock<MockDemuxer>()), |
| 59 video_renderer_(new StrictMock<MockVideoRenderer>()), | 59 video_renderer_(new StrictMock<MockVideoRenderer>()), |
| 60 audio_renderer_(new StrictMock<MockAudioRenderer>()), | 60 audio_renderer_(new StrictMock<MockAudioRenderer>()), |
| 61 renderer_impl_( | 61 renderer_impl_( |
| 62 new RendererImpl(message_loop_.message_loop_proxy(), | 62 new RendererImpl(message_loop_.message_loop_proxy(), |
| 63 demuxer_.get(), | |
| 64 scoped_ptr<AudioRenderer>(audio_renderer_), | 63 scoped_ptr<AudioRenderer>(audio_renderer_), |
| 65 scoped_ptr<VideoRenderer>(video_renderer_))) { | 64 scoped_ptr<VideoRenderer>(video_renderer_))) { |
| 66 // SetDemuxerExpectations() adds overriding expectations for expected | 65 // SetDemuxerExpectations() adds overriding expectations for expected |
| 67 // non-NULL streams. | 66 // non-NULL streams. |
| 68 DemuxerStream* null_pointer = NULL; | 67 DemuxerStream* null_pointer = NULL; |
| 69 EXPECT_CALL(*demuxer_, GetStream(_)) | 68 EXPECT_CALL(*demuxer_, GetStream(_)) |
| 70 .WillRepeatedly(Return(null_pointer)); | 69 .WillRepeatedly(Return(null_pointer)); |
| 71 EXPECT_CALL(*demuxer_, GetLiveness()) | 70 EXPECT_CALL(*demuxer_, GetLiveness()) |
| 72 .WillRepeatedly(Return(Demuxer::LIVENESS_UNKNOWN)); | 71 .WillRepeatedly(Return(Demuxer::LIVENESS_UNKNOWN)); |
| 73 } | 72 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 EXPECT_CALL(callbacks_, OnError(start_status)); | 110 EXPECT_CALL(callbacks_, OnError(start_status)); |
| 112 | 111 |
| 113 EXPECT_CALL(callbacks_, OnInitialize()); | 112 EXPECT_CALL(callbacks_, OnInitialize()); |
| 114 | 113 |
| 115 if (start_status == PIPELINE_OK && audio_stream_) { | 114 if (start_status == PIPELINE_OK && audio_stream_) { |
| 116 EXPECT_CALL(*audio_renderer_, GetTimeSource()) | 115 EXPECT_CALL(*audio_renderer_, GetTimeSource()) |
| 117 .WillOnce(Return(&time_source_)); | 116 .WillOnce(Return(&time_source_)); |
| 118 } | 117 } |
| 119 | 118 |
| 120 renderer_impl_->Initialize( | 119 renderer_impl_->Initialize( |
| 120 demuxer_.get(), |
| 121 base::Bind(&CallbackHelper::OnInitialize, | 121 base::Bind(&CallbackHelper::OnInitialize, |
| 122 base::Unretained(&callbacks_)), | 122 base::Unretained(&callbacks_)), |
| 123 base::Bind(&CallbackHelper::OnUpdateStatistics, | 123 base::Bind(&CallbackHelper::OnUpdateStatistics, |
| 124 base::Unretained(&callbacks_)), | 124 base::Unretained(&callbacks_)), |
| 125 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), | 125 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), |
| 126 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), | 126 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), |
| 127 base::Bind(&CallbackHelper::OnBufferingStateChange, | 127 base::Bind(&CallbackHelper::OnBufferingStateChange, |
| 128 base::Unretained(&callbacks_))); | 128 base::Unretained(&callbacks_))); |
| 129 base::RunLoop().RunUntilIdle(); | 129 base::RunLoop().RunUntilIdle(); |
| 130 } | 130 } |
| (...skipping 294 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 |