Chromium Code Reviews| Index: media/test/pipeline_integration_test_base.h |
| diff --git a/media/test/pipeline_integration_test_base.h b/media/test/pipeline_integration_test_base.h |
| index 580e963c658f7b0261a6b2e6c7e2b392a352a88f..5b5105f6b6ed8f3428fc076da861aeff58f94f26 100644 |
| --- a/media/test/pipeline_integration_test_base.h |
| +++ b/media/test/pipeline_integration_test_base.h |
| @@ -48,6 +48,22 @@ class DummyTickClock : public base::TickClock { |
| base::TimeTicks now_; |
| }; |
| +class PipelineTestRendererFactory { |
| + public: |
| + virtual ~PipelineTestRendererFactory() {} |
| + // Creates and returns a Renderer. |
| + virtual std::unique_ptr<Renderer> CreateRenderer( |
| + ScopedVector<VideoDecoder> prepend_video_decoders = |
| + ScopedVector<VideoDecoder>(), |
| + ScopedVector<AudioDecoder> prepend_audio_decoders = |
| + ScopedVector<AudioDecoder>()) = 0; |
| +}; |
| + |
| +enum PipelineType { |
| + Media, // Test the general media pipeline. |
| + MediaRemoting, // Test Media Remoting pipeline. |
| +}; |
| + |
| // Integration tests for Pipeline. Real demuxers, real decoders, and |
| // base renderer implementations are used to verify pipeline functionality. The |
| // renderers used in these tests rely heavily on the AudioRendererBase & |
| @@ -129,30 +145,11 @@ class PipelineIntegrationTestBase : public Pipeline::Client { |
| encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; |
| } |
| - protected: |
| - base::MessageLoop message_loop_; |
| - base::MD5Context md5_context_; |
| - bool hashing_enabled_; |
| - bool clockless_playback_; |
| - |
| - // TaskScheduler is used only for FFmpegDemuxer. |
| - std::unique_ptr<base::test::ScopedTaskScheduler> task_scheduler_; |
| - std::unique_ptr<Demuxer> demuxer_; |
| - std::unique_ptr<DataSource> data_source_; |
| - std::unique_ptr<PipelineImpl> pipeline_; |
| - scoped_refptr<NullAudioSink> audio_sink_; |
| - scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; |
| - std::unique_ptr<NullVideoSink> video_sink_; |
| - bool ended_; |
| - PipelineStatus pipeline_status_; |
| - Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| - VideoPixelFormat last_video_frame_format_; |
| - ColorSpace last_video_frame_color_space_; |
| - DummyTickClock dummy_clock_; |
| - PipelineMetadata metadata_; |
| - scoped_refptr<VideoFrame> last_frame_; |
| - base::TimeDelta current_duration_; |
| + std::unique_ptr<Renderer> CreateRenderer( |
| + ScopedVector<VideoDecoder> prepend_video_decoders, |
| + ScopedVector<AudioDecoder> prepend_audio_decoders); |
| + protected: |
| PipelineStatus StartInternal( |
| std::unique_ptr<DataSource> data_source, |
| CdmContext* cdm_context, |
| @@ -183,13 +180,6 @@ class PipelineIntegrationTestBase : public Pipeline::Client { |
| // Creates Demuxer and sets |demuxer_|. |
| void CreateDemuxer(std::unique_ptr<DataSource> data_source); |
| - // Creates and returns a Renderer. |
| - virtual std::unique_ptr<Renderer> CreateRenderer( |
| - ScopedVector<VideoDecoder> prepend_video_decoders = |
| - ScopedVector<VideoDecoder>(), |
| - ScopedVector<AudioDecoder> prepend_audio_decoders = |
| - ScopedVector<AudioDecoder>()); |
| - |
| void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); |
| void CheckDuration(); |
| @@ -197,6 +187,9 @@ class PipelineIntegrationTestBase : public Pipeline::Client { |
| // Return the media start time from |demuxer_|. |
| base::TimeDelta GetStartTime(); |
| + // When testing media remoting pipeline, create a RemotingTestRendererFactory. |
| + void MaybeCreateRemotingRendererFactory(PipelineType type); |
|
miu
2017/04/03 21:05:01
Suggestion for making it a bit clearer what's goin
xjz
2017/04/04 01:07:56
Done. Called it in tests' ctors.
|
| + |
| MOCK_METHOD1(DecryptorAttached, void(bool)); |
| // Pipeline::Client overrides. |
| void OnError(PipelineStatus status) override; |
| @@ -211,6 +204,33 @@ class PipelineIntegrationTestBase : public Pipeline::Client { |
| MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size&)); |
| MOCK_METHOD1(OnVideoOpacityChange, void(bool)); |
| MOCK_METHOD0(OnVideoAverageKeyframeDistanceUpdate, void()); |
| + |
| + base::MessageLoop message_loop_; |
| + base::MD5Context md5_context_; |
| + bool hashing_enabled_; |
| + bool clockless_playback_; |
| + |
| + // TaskScheduler is used only for FFmpegDemuxer. |
| + std::unique_ptr<base::test::ScopedTaskScheduler> task_scheduler_; |
| + std::unique_ptr<Demuxer> demuxer_; |
| + std::unique_ptr<DataSource> data_source_; |
| + std::unique_ptr<PipelineImpl> pipeline_; |
| + scoped_refptr<NullAudioSink> audio_sink_; |
| + scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; |
| + std::unique_ptr<NullVideoSink> video_sink_; |
| + bool ended_; |
| + PipelineStatus pipeline_status_; |
| + Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| + VideoPixelFormat last_video_frame_format_; |
| + ColorSpace last_video_frame_color_space_; |
| + DummyTickClock dummy_clock_; |
| + PipelineMetadata metadata_; |
| + scoped_refptr<VideoFrame> last_frame_; |
| + base::TimeDelta current_duration_; |
| + std::unique_ptr<PipelineTestRendererFactory> renderer_factory_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(PipelineIntegrationTestBase); |
| }; |
| } // namespace media |