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_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ | 5 #ifndef MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
6 #define MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ | 6 #define MEDIA_FILTERS_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 14 matching lines...) Expand all Loading... |
25 namespace media { | 25 namespace media { |
26 | 26 |
27 class Decryptor; | 27 class Decryptor; |
28 | 28 |
29 // Empty MD5 hash string. Used to verify empty video tracks. | 29 // Empty MD5 hash string. Used to verify empty video tracks. |
30 extern const char kNullVideoHash[]; | 30 extern const char kNullVideoHash[]; |
31 | 31 |
32 // Empty hash string. Used to verify empty audio tracks. | 32 // Empty hash string. Used to verify empty audio tracks. |
33 extern const char kNullAudioHash[]; | 33 extern const char kNullAudioHash[]; |
34 | 34 |
35 // Dummy tick clock which advances extremely quickly (1 minute every time | |
36 // NowTicks() is called). | |
37 class DummyTickClock : public base::TickClock { | |
38 public: | |
39 DummyTickClock() : now_() {} | |
40 virtual ~DummyTickClock() {} | |
41 virtual base::TimeTicks NowTicks() OVERRIDE; | |
42 private: | |
43 base::TimeTicks now_; | |
44 }; | |
45 | |
46 // Integration tests for Pipeline. Real demuxers, real decoders, and | 35 // Integration tests for Pipeline. Real demuxers, real decoders, and |
47 // base renderer implementations are used to verify pipeline functionality. The | 36 // base renderer implementations are used to verify pipeline functionality. The |
48 // renderers used in these tests rely heavily on the AudioRendererBase & | 37 // renderers used in these tests rely heavily on the AudioRendererBase & |
49 // VideoRendererImpl implementations which contain a majority of the code used | 38 // VideoRendererImpl implementations which contain a majority of the code used |
50 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in | 39 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in |
51 // the browser. The renderers in this test don't actually write data to a | 40 // the browser. The renderers in this test don't actually write data to a |
52 // display or audio device. Both of these devices are simulated since they have | 41 // display or audio device. Both of these devices are simulated since they have |
53 // little effect on verifying pipeline behavior and allow tests to run faster | 42 // little effect on verifying pipeline behavior and allow tests to run faster |
54 // than real-time. | 43 // than real-time. |
55 class PipelineIntegrationTestBase { | 44 class PipelineIntegrationTestBase { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool clockless_playback_; | 91 bool clockless_playback_; |
103 scoped_ptr<Demuxer> demuxer_; | 92 scoped_ptr<Demuxer> demuxer_; |
104 scoped_ptr<DataSource> data_source_; | 93 scoped_ptr<DataSource> data_source_; |
105 scoped_ptr<Pipeline> pipeline_; | 94 scoped_ptr<Pipeline> pipeline_; |
106 scoped_refptr<NullAudioSink> audio_sink_; | 95 scoped_refptr<NullAudioSink> audio_sink_; |
107 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; | 96 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; |
108 bool ended_; | 97 bool ended_; |
109 PipelineStatus pipeline_status_; | 98 PipelineStatus pipeline_status_; |
110 Demuxer::NeedKeyCB need_key_cb_; | 99 Demuxer::NeedKeyCB need_key_cb_; |
111 VideoFrame::Format last_video_frame_format_; | 100 VideoFrame::Format last_video_frame_format_; |
112 DummyTickClock dummy_clock_; | |
113 AudioHardwareConfig hardware_config_; | 101 AudioHardwareConfig hardware_config_; |
114 PipelineMetadata metadata_; | 102 PipelineMetadata metadata_; |
115 | 103 |
116 void OnStatusCallbackChecked(PipelineStatus expected_status, | 104 void OnStatusCallbackChecked(PipelineStatus expected_status, |
117 PipelineStatus status); | 105 PipelineStatus status); |
118 void OnStatusCallback(PipelineStatus status); | 106 void OnStatusCallback(PipelineStatus status); |
119 PipelineStatusCB QuitOnStatusCB(PipelineStatus expected_status); | 107 PipelineStatusCB QuitOnStatusCB(PipelineStatus expected_status); |
120 void DemuxerNeedKeyCB(const std::string& type, | 108 void DemuxerNeedKeyCB(const std::string& type, |
121 const std::vector<uint8>& init_data); | 109 const std::vector<uint8>& init_data); |
122 void set_need_key_cb(const Demuxer::NeedKeyCB& need_key_cb) { | 110 void set_need_key_cb(const Demuxer::NeedKeyCB& need_key_cb) { |
(...skipping 10 matching lines...) Expand all Loading... |
133 const DecryptorReadyCB& decryptor_ready_cb); | 121 const DecryptorReadyCB& decryptor_ready_cb); |
134 void OnVideoRendererPaint(const scoped_refptr<VideoFrame>& frame); | 122 void OnVideoRendererPaint(const scoped_refptr<VideoFrame>& frame); |
135 | 123 |
136 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); | 124 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); |
137 MOCK_METHOD0(OnPrerollCompleted, void()); | 125 MOCK_METHOD0(OnPrerollCompleted, void()); |
138 }; | 126 }; |
139 | 127 |
140 } // namespace media | 128 } // namespace media |
141 | 129 |
142 #endif // MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ | 130 #endif // MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
OLD | NEW |