Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: media/test/pipeline_integration_test_base.h

Issue 1761603002: media: Handle "encrypted" event in pipeline_integration_fuzzertest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Starts the pipeline with |data| (with |size| bytes). The |data| will be 78 // Starts the pipeline with |data| (with |size| bytes). The |data| will be
79 // valid throughtout the lifetime of this test. 79 // valid throughtout the lifetime of this test.
80 PipelineStatus Start(const uint8_t* data, size_t size, uint8_t test_type); 80 PipelineStatus Start(const uint8_t* data, size_t size, uint8_t test_type);
81 81
82 void Play(); 82 void Play();
83 void Pause(); 83 void Pause();
84 bool Seek(base::TimeDelta seek_time); 84 bool Seek(base::TimeDelta seek_time);
85 bool Suspend(); 85 bool Suspend();
86 bool Resume(base::TimeDelta seek_time); 86 bool Resume(base::TimeDelta seek_time);
87 void Stop(); 87 void Stop();
88
89 // Fails the test with |status|.
90 void FailTest(PipelineStatus status);
91
88 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time); 92 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time);
89
90 bool WaitUntilOnEnded(); 93 bool WaitUntilOnEnded();
91 PipelineStatus WaitUntilEndedOrError(); 94 PipelineStatus WaitUntilEndedOrError();
92 95
93 // Returns the MD5 hash of all video frames seen. Should only be called once 96 // Returns the MD5 hash of all video frames seen. Should only be called once
94 // after playback completes. First time hashes should be generated with 97 // after playback completes. First time hashes should be generated with
95 // --video-threads=1 to ensure correctness. Pipeline must have been started 98 // --video-threads=1 to ensure correctness. Pipeline must have been started
96 // with hashing enabled. 99 // with hashing enabled.
97 std::string GetVideoHash(); 100 std::string GetVideoHash();
98 101
99 // Returns the hash of all audio frames seen. Should only be called once 102 // Returns the hash of all audio frames seen. Should only be called once
100 // after playback completes. Pipeline must have been started with hashing 103 // after playback completes. Pipeline must have been started with hashing
101 // enabled. 104 // enabled.
102 std::string GetAudioHash(); 105 std::string GetAudioHash();
103 106
104 // Returns the time taken to render the complete audio file. 107 // Returns the time taken to render the complete audio file.
105 // Pipeline must have been started with clockless playback enabled. 108 // Pipeline must have been started with clockless playback enabled.
106 base::TimeDelta GetAudioTime(); 109 base::TimeDelta GetAudioTime();
107 110
111 // Sets a callback to handle EME "encrypted" event. Must be called to test
112 // potentially encrypted media.
113 void set_encrypted_media_init_data_cb(
114 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) {
115 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
116 }
117
108 protected: 118 protected:
109 base::MessageLoop message_loop_; 119 base::MessageLoop message_loop_;
110 base::MD5Context md5_context_; 120 base::MD5Context md5_context_;
111 bool hashing_enabled_; 121 bool hashing_enabled_;
112 bool clockless_playback_; 122 bool clockless_playback_;
113 scoped_ptr<Demuxer> demuxer_; 123 scoped_ptr<Demuxer> demuxer_;
114 scoped_ptr<DataSource> data_source_; 124 scoped_ptr<DataSource> data_source_;
115 scoped_ptr<PipelineImpl> pipeline_; 125 scoped_ptr<PipelineImpl> pipeline_;
116 scoped_refptr<NullAudioSink> audio_sink_; 126 scoped_refptr<NullAudioSink> audio_sink_;
117 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; 127 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_;
(...skipping 12 matching lines...) Expand all
130 uint8_t test_type); 140 uint8_t test_type);
131 141
132 PipelineStatus StartWithFile(const std::string& filename, 142 PipelineStatus StartWithFile(const std::string& filename,
133 CdmContext* cdm_context, 143 CdmContext* cdm_context,
134 uint8_t test_type); 144 uint8_t test_type);
135 145
136 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); 146 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status);
137 void OnStatusCallback(PipelineStatus status); 147 void OnStatusCallback(PipelineStatus status);
138 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, 148 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type,
139 const std::vector<uint8_t>& init_data); 149 const std::vector<uint8_t>& init_data);
140 void set_encrypted_media_init_data_cb(
141 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) {
142 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
143 }
144 150
145 void OnEnded(); 151 void OnEnded();
146 void OnError(PipelineStatus status); 152 void OnError(PipelineStatus status);
147 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); 153 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time);
148 154
149 // Creates Demuxer and sets |demuxer_|. 155 // Creates Demuxer and sets |demuxer_|.
150 void CreateDemuxer(scoped_ptr<DataSource> data_source); 156 void CreateDemuxer(scoped_ptr<DataSource> data_source);
151 157
152 // Creates and returns a Renderer. 158 // Creates and returns a Renderer.
153 virtual scoped_ptr<Renderer> CreateRenderer(); 159 virtual scoped_ptr<Renderer> CreateRenderer();
154 160
155 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); 161 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame);
156 162
157 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); 163 MOCK_METHOD1(OnMetadata, void(PipelineMetadata));
158 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState)); 164 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState));
159 MOCK_METHOD1(DecryptorAttached, void(bool)); 165 MOCK_METHOD1(DecryptorAttached, void(bool));
160 MOCK_METHOD2(OnAddTextTrack, 166 MOCK_METHOD2(OnAddTextTrack,
161 void(const TextTrackConfig& config, 167 void(const TextTrackConfig& config,
162 const AddTextTrackDoneCB& done_cb)); 168 const AddTextTrackDoneCB& done_cb));
163 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 169 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
164 }; 170 };
165 171
166 } // namespace media 172 } // namespace media
167 173
168 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ 174 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_
OLDNEW
« no previous file with comments | « media/test/pipeline_integration_fuzzertest.cc ('k') | media/test/pipeline_integration_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698