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 <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Integration tests for Pipeline. Real demuxers, real decoders, and | 53 // Integration tests for Pipeline. Real demuxers, real decoders, and |
54 // base renderer implementations are used to verify pipeline functionality. The | 54 // base renderer implementations are used to verify pipeline functionality. The |
55 // renderers used in these tests rely heavily on the AudioRendererBase & | 55 // renderers used in these tests rely heavily on the AudioRendererBase & |
56 // VideoRendererImpl implementations which contain a majority of the code used | 56 // VideoRendererImpl implementations which contain a majority of the code used |
57 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in | 57 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in |
58 // the browser. The renderers in this test don't actually write data to a | 58 // the browser. The renderers in this test don't actually write data to a |
59 // display or audio device. Both of these devices are simulated since they have | 59 // display or audio device. Both of these devices are simulated since they have |
60 // little effect on verifying pipeline behavior and allow tests to run faster | 60 // little effect on verifying pipeline behavior and allow tests to run faster |
61 // than real-time. | 61 // than real-time. |
62 class PipelineIntegrationTestBase { | 62 class PipelineIntegrationTestBase : public Pipeline::Client { |
63 public: | 63 public: |
64 PipelineIntegrationTestBase(); | 64 PipelineIntegrationTestBase(); |
65 virtual ~PipelineIntegrationTestBase(); | 65 virtual ~PipelineIntegrationTestBase(); |
66 | 66 |
67 // Test types for advanced testing and benchmarking (e.g., underflow is | 67 // Test types for advanced testing and benchmarking (e.g., underflow is |
68 // disabled to ensure consistent hashes). May be combined using the bitwise | 68 // disabled to ensure consistent hashes). May be combined using the bitwise |
69 // or operator (and as such must have values that are powers of two). | 69 // or operator (and as such must have values that are powers of two). |
70 enum TestTypeFlags { kNormal = 0, kHashed = 1, kClockless = 2 }; | 70 enum TestTypeFlags { kNormal = 0, kHashed = 1, kClockless = 2 }; |
71 | 71 |
72 // Starts the pipeline with a file specified by |filename|, optionally with a | 72 // Starts the pipeline with a file specified by |filename|, optionally with a |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 CdmContext* cdm_context, | 144 CdmContext* cdm_context, |
145 uint8_t test_type); | 145 uint8_t test_type); |
146 | 146 |
147 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); | 147 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); |
148 void OnStatusCallback(PipelineStatus status); | 148 void OnStatusCallback(PipelineStatus status); |
149 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, | 149 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, |
150 const std::vector<uint8_t>& init_data); | 150 const std::vector<uint8_t>& init_data); |
151 | 151 |
152 void DemuxerMediaTracksUpdatedCB(std::unique_ptr<MediaTracks> tracks); | 152 void DemuxerMediaTracksUpdatedCB(std::unique_ptr<MediaTracks> tracks); |
153 | 153 |
154 void OnEnded(); | |
155 void OnError(PipelineStatus status); | |
156 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); | 154 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); |
157 | 155 |
158 // Creates Demuxer and sets |demuxer_|. | 156 // Creates Demuxer and sets |demuxer_|. |
159 void CreateDemuxer(std::unique_ptr<DataSource> data_source); | 157 void CreateDemuxer(std::unique_ptr<DataSource> data_source); |
160 | 158 |
161 // Creates and returns a Renderer. | 159 // Creates and returns a Renderer. |
162 virtual std::unique_ptr<Renderer> CreateRenderer(); | 160 virtual std::unique_ptr<Renderer> CreateRenderer(); |
163 | 161 |
164 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); | 162 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); |
165 | 163 |
| 164 MOCK_METHOD1(DecryptorAttached, void(bool)); |
| 165 // Pipeline::Client overrides. |
| 166 void OnError(PipelineStatus status) override; |
| 167 void OnEnded() override; |
166 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); | 168 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); |
167 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState)); | 169 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState)); |
168 MOCK_METHOD1(DecryptorAttached, void(bool)); | 170 MOCK_METHOD0(OnDurationChange, void()); |
169 MOCK_METHOD2(OnAddTextTrack, | 171 MOCK_METHOD2(OnAddTextTrack, |
170 void(const TextTrackConfig& config, | 172 void(const TextTrackConfig& config, |
171 const AddTextTrackDoneCB& done_cb)); | 173 const AddTextTrackDoneCB& done_cb)); |
172 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); | 174 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); |
173 }; | 175 }; |
174 | 176 |
175 } // namespace media | 177 } // namespace media |
176 | 178 |
177 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ | 179 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ |
OLD | NEW |