| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class DummyTickClock : public base::TickClock { | 38 class DummyTickClock : public base::TickClock { |
| 39 public: | 39 public: |
| 40 DummyTickClock() : now_() {} | 40 DummyTickClock() : now_() {} |
| 41 ~DummyTickClock() override {} | 41 ~DummyTickClock() override {} |
| 42 base::TimeTicks NowTicks() override; | 42 base::TimeTicks NowTicks() override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 base::TimeTicks now_; | 45 base::TimeTicks now_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 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 |
| 48 // Integration tests for Pipeline. Real demuxers, real decoders, and | 62 // Integration tests for Pipeline. Real demuxers, real decoders, and |
| 49 // base renderer implementations are used to verify pipeline functionality. The | 63 // base renderer implementations are used to verify pipeline functionality. The |
| 50 // renderers used in these tests rely heavily on the AudioRendererBase & | 64 // renderers used in these tests rely heavily on the AudioRendererBase & |
| 51 // VideoRendererImpl implementations which contain a majority of the code used | 65 // VideoRendererImpl implementations which contain a majority of the code used |
| 52 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in | 66 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in |
| 53 // the browser. The renderers in this test don't actually write data to a | 67 // the browser. The renderers in this test don't actually write data to a |
| 54 // display or audio device. Both of these devices are simulated since they have | 68 // display or audio device. Both of these devices are simulated since they have |
| 55 // little effect on verifying pipeline behavior and allow tests to run faster | 69 // little effect on verifying pipeline behavior and allow tests to run faster |
| 56 // than real-time. | 70 // than real-time. |
| 57 class PipelineIntegrationTestBase { | 71 class PipelineIntegrationTestBase { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 protected: | 112 protected: |
| 99 base::MessageLoop message_loop_; | 113 base::MessageLoop message_loop_; |
| 100 base::MD5Context md5_context_; | 114 base::MD5Context md5_context_; |
| 101 bool hashing_enabled_; | 115 bool hashing_enabled_; |
| 102 bool clockless_playback_; | 116 bool clockless_playback_; |
| 103 scoped_ptr<Demuxer> demuxer_; | 117 scoped_ptr<Demuxer> demuxer_; |
| 104 scoped_ptr<DataSource> data_source_; | 118 scoped_ptr<DataSource> data_source_; |
| 105 scoped_ptr<Pipeline> pipeline_; | 119 scoped_ptr<Pipeline> pipeline_; |
| 106 scoped_refptr<NullAudioSink> audio_sink_; | 120 scoped_refptr<NullAudioSink> audio_sink_; |
| 107 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; | 121 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; |
| 122 testing::NiceMock<MockVideoRendererSink> video_sink_; |
| 108 bool ended_; | 123 bool ended_; |
| 109 PipelineStatus pipeline_status_; | 124 PipelineStatus pipeline_status_; |
| 110 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 125 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 111 VideoFrame::Format last_video_frame_format_; | 126 VideoFrame::Format last_video_frame_format_; |
| 112 DummyTickClock dummy_clock_; | 127 DummyTickClock dummy_clock_; |
| 113 AudioHardwareConfig hardware_config_; | 128 AudioHardwareConfig hardware_config_; |
| 114 PipelineMetadata metadata_; | 129 PipelineMetadata metadata_; |
| 115 | 130 |
| 116 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); | 131 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); |
| 117 void OnStatusCallback(PipelineStatus status); | 132 void OnStatusCallback(PipelineStatus status); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 139 MOCK_METHOD1(DecryptorAttached, void(bool)); | 154 MOCK_METHOD1(DecryptorAttached, void(bool)); |
| 140 MOCK_METHOD2(OnAddTextTrack, | 155 MOCK_METHOD2(OnAddTextTrack, |
| 141 void(const TextTrackConfig& config, | 156 void(const TextTrackConfig& config, |
| 142 const AddTextTrackDoneCB& done_cb)); | 157 const AddTextTrackDoneCB& done_cb)); |
| 143 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); | 158 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); |
| 144 }; | 159 }; |
| 145 | 160 |
| 146 } // namespace media | 161 } // namespace media |
| 147 | 162 |
| 148 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ | 163 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ |
| OLD | NEW |