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