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