| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ | 5 #ifndef MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ |
| 6 #define MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ | 6 #define MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "base/md5.h" | 8 #include "base/md5.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "media/audio/clockless_audio_sink.h" | 10 #include "media/audio/clockless_audio_sink.h" |
| 11 #include "media/audio/null_audio_sink.h" | 11 #include "media/audio/null_audio_sink.h" |
| 12 #include "media/base/audio_hardware_config.h" | 12 #include "media/base/audio_hardware_config.h" |
| 13 #include "media/base/demuxer.h" | 13 #include "media/base/demuxer.h" |
| 14 #include "media/base/media_keys.h" | 14 #include "media/base/media_keys.h" |
| 15 #include "media/base/null_video_sink.h" |
| 15 #include "media/base/pipeline.h" | 16 #include "media/base/pipeline.h" |
| 16 #include "media/base/text_track.h" | 17 #include "media/base/text_track.h" |
| 17 #include "media/base/text_track_config.h" | 18 #include "media/base/text_track_config.h" |
| 18 #include "media/base/video_frame.h" | 19 #include "media/base/video_frame.h" |
| 19 #include "media/renderers/video_renderer_impl.h" | 20 #include "media/renderers/video_renderer_impl.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class FilePath; | 24 class FilePath; |
| 24 } | 25 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 class DummyTickClock : public base::TickClock { | 39 class DummyTickClock : public base::TickClock { |
| 39 public: | 40 public: |
| 40 DummyTickClock() : now_() {} | 41 DummyTickClock() : now_() {} |
| 41 ~DummyTickClock() override {} | 42 ~DummyTickClock() override {} |
| 42 base::TimeTicks NowTicks() override; | 43 base::TimeTicks NowTicks() override; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 base::TimeTicks now_; | 46 base::TimeTicks now_; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // TODO(dalecurtis): Mocks won't be useful for the new rendering path, we'll | |
| 49 // need fake callback generators like we have for the audio path. | |
| 50 // http://crbug.com/473424 | |
| 51 class MockVideoRendererSink : public VideoRendererSink { | |
| 52 public: | |
| 53 MockVideoRendererSink(); | |
| 54 ~MockVideoRendererSink() override; | |
| 55 | |
| 56 MOCK_METHOD1(Start, void(VideoRendererSink::RenderCallback*)); | |
| 57 MOCK_METHOD0(Stop, void()); | |
| 58 MOCK_METHOD1(PaintFrameUsingOldRenderingPath, | |
| 59 void(const scoped_refptr<VideoFrame>&)); | |
| 60 }; | |
| 61 | |
| 62 // Integration tests for Pipeline. Real demuxers, real decoders, and | 49 // Integration tests for Pipeline. Real demuxers, real decoders, and |
| 63 // base renderer implementations are used to verify pipeline functionality. The | 50 // base renderer implementations are used to verify pipeline functionality. The |
| 64 // renderers used in these tests rely heavily on the AudioRendererBase & | 51 // renderers used in these tests rely heavily on the AudioRendererBase & |
| 65 // VideoRendererImpl implementations which contain a majority of the code used | 52 // VideoRendererImpl implementations which contain a majority of the code used |
| 66 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in | 53 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in |
| 67 // the browser. The renderers in this test don't actually write data to a | 54 // the browser. The renderers in this test don't actually write data to a |
| 68 // display or audio device. Both of these devices are simulated since they have | 55 // display or audio device. Both of these devices are simulated since they have |
| 69 // little effect on verifying pipeline behavior and allow tests to run faster | 56 // little effect on verifying pipeline behavior and allow tests to run faster |
| 70 // than real-time. | 57 // than real-time. |
| 71 class PipelineIntegrationTestBase { | 58 class PipelineIntegrationTestBase { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 protected: | 99 protected: |
| 113 base::MessageLoop message_loop_; | 100 base::MessageLoop message_loop_; |
| 114 base::MD5Context md5_context_; | 101 base::MD5Context md5_context_; |
| 115 bool hashing_enabled_; | 102 bool hashing_enabled_; |
| 116 bool clockless_playback_; | 103 bool clockless_playback_; |
| 117 scoped_ptr<Demuxer> demuxer_; | 104 scoped_ptr<Demuxer> demuxer_; |
| 118 scoped_ptr<DataSource> data_source_; | 105 scoped_ptr<DataSource> data_source_; |
| 119 scoped_ptr<Pipeline> pipeline_; | 106 scoped_ptr<Pipeline> pipeline_; |
| 120 scoped_refptr<NullAudioSink> audio_sink_; | 107 scoped_refptr<NullAudioSink> audio_sink_; |
| 121 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; | 108 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; |
| 122 testing::NiceMock<MockVideoRendererSink> video_sink_; | 109 scoped_ptr<NullVideoSink> video_sink_; |
| 123 bool ended_; | 110 bool ended_; |
| 124 PipelineStatus pipeline_status_; | 111 PipelineStatus pipeline_status_; |
| 125 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 112 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 126 VideoFrame::Format last_video_frame_format_; | 113 VideoFrame::Format last_video_frame_format_; |
| 127 DummyTickClock dummy_clock_; | 114 DummyTickClock dummy_clock_; |
| 128 AudioHardwareConfig hardware_config_; | 115 AudioHardwareConfig hardware_config_; |
| 129 PipelineMetadata metadata_; | 116 PipelineMetadata metadata_; |
| 130 | 117 |
| 131 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); | 118 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); |
| 132 void OnStatusCallback(PipelineStatus status); | 119 void OnStatusCallback(PipelineStatus status); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 154 MOCK_METHOD1(DecryptorAttached, void(bool)); | 141 MOCK_METHOD1(DecryptorAttached, void(bool)); |
| 155 MOCK_METHOD2(OnAddTextTrack, | 142 MOCK_METHOD2(OnAddTextTrack, |
| 156 void(const TextTrackConfig& config, | 143 void(const TextTrackConfig& config, |
| 157 const AddTextTrackDoneCB& done_cb)); | 144 const AddTextTrackDoneCB& done_cb)); |
| 158 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); | 145 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); |
| 159 }; | 146 }; |
| 160 | 147 |
| 161 } // namespace media | 148 } // namespace media |
| 162 | 149 |
| 163 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ | 150 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ |
| OLD | NEW |