| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 scoped_ptr<AudioRenderer>(audio_renderer_), | 63 scoped_ptr<AudioRenderer>(audio_renderer_), |
| 64 scoped_ptr<VideoRenderer>(video_renderer_))) { | 64 scoped_ptr<VideoRenderer>(video_renderer_))) { |
| 65 // SetDemuxerExpectations() adds overriding expectations for expected | 65 // SetDemuxerExpectations() adds overriding expectations for expected |
| 66 // non-NULL streams. | 66 // non-NULL streams. |
| 67 DemuxerStream* null_pointer = NULL; | 67 DemuxerStream* null_pointer = NULL; |
| 68 EXPECT_CALL(*demuxer_, GetStream(_)) | 68 EXPECT_CALL(*demuxer_, GetStream(_)) |
| 69 .WillRepeatedly(Return(null_pointer)); | 69 .WillRepeatedly(Return(null_pointer)); |
| 70 EXPECT_CALL(*demuxer_, GetLiveness()) | |
| 71 .WillRepeatedly(Return(Demuxer::LIVENESS_UNKNOWN)); | |
| 72 } | 70 } |
| 73 | 71 |
| 74 virtual ~RendererImplTest() { | 72 virtual ~RendererImplTest() { |
| 75 renderer_impl_.reset(); | 73 renderer_impl_.reset(); |
| 76 base::RunLoop().RunUntilIdle(); | 74 base::RunLoop().RunUntilIdle(); |
| 77 } | 75 } |
| 78 | 76 |
| 79 protected: | 77 protected: |
| 80 typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector; | 78 typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector; |
| 81 | 79 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 Initialize(audio_stream_.get(), _, _, _, _, _)) | 90 Initialize(audio_stream_.get(), _, _, _, _, _)) |
| 93 .WillOnce(DoAll(SaveArg<3>(&audio_buffering_state_cb_), | 91 .WillOnce(DoAll(SaveArg<3>(&audio_buffering_state_cb_), |
| 94 SaveArg<4>(&audio_ended_cb_), | 92 SaveArg<4>(&audio_ended_cb_), |
| 95 SaveArg<5>(&audio_error_cb_), | 93 SaveArg<5>(&audio_error_cb_), |
| 96 RunCallback<1>(status))); | 94 RunCallback<1>(status))); |
| 97 } | 95 } |
| 98 | 96 |
| 99 // Sets up expectations to allow the video renderer to initialize. | 97 // Sets up expectations to allow the video renderer to initialize. |
| 100 void SetVideoRendererInitializeExpectations(PipelineStatus status) { | 98 void SetVideoRendererInitializeExpectations(PipelineStatus status) { |
| 101 EXPECT_CALL(*video_renderer_, | 99 EXPECT_CALL(*video_renderer_, |
| 102 Initialize(video_stream_.get(), _, _, _, _, _, _, _)) | 100 Initialize(video_stream_.get(), _, _, _, _, _, _)) |
| 103 .WillOnce(DoAll(SaveArg<4>(&video_buffering_state_cb_), | 101 .WillOnce(DoAll(SaveArg<3>(&video_buffering_state_cb_), |
| 104 SaveArg<5>(&video_ended_cb_), | 102 SaveArg<4>(&video_ended_cb_), |
| 105 RunCallback<2>(status))); | 103 RunCallback<1>(status))); |
| 106 } | 104 } |
| 107 | 105 |
| 108 void InitializeAndExpect(PipelineStatus start_status) { | 106 void InitializeAndExpect(PipelineStatus start_status) { |
| 109 if (start_status != PIPELINE_OK) | 107 if (start_status != PIPELINE_OK) |
| 110 EXPECT_CALL(callbacks_, OnError(start_status)); | 108 EXPECT_CALL(callbacks_, OnError(start_status)); |
| 111 | 109 |
| 112 EXPECT_CALL(callbacks_, OnInitialize()); | 110 EXPECT_CALL(callbacks_, OnInitialize()); |
| 113 | 111 |
| 114 if (start_status == PIPELINE_OK && audio_stream_) { | 112 if (start_status == PIPELINE_OK && audio_stream_) { |
| 115 EXPECT_CALL(*audio_renderer_, GetTimeSource()) | 113 EXPECT_CALL(*audio_renderer_, GetTimeSource()) |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 InitializeWithAudio(); | 423 InitializeWithAudio(); |
| 426 Play(); | 424 Play(); |
| 427 Flush(false); | 425 Flush(false); |
| 428 | 426 |
| 429 EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_DECODE)); | 427 EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_DECODE)); |
| 430 audio_error_cb_.Run(PIPELINE_ERROR_DECODE); | 428 audio_error_cb_.Run(PIPELINE_ERROR_DECODE); |
| 431 base::RunLoop().RunUntilIdle(); | 429 base::RunLoop().RunUntilIdle(); |
| 432 } | 430 } |
| 433 | 431 |
| 434 } // namespace media | 432 } // namespace media |
| OLD | NEW |