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

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
« no previous file with comments | « media/test/pipeline_integration_fuzzertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
88 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time); 89 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time);
89
90 bool WaitUntilOnEnded(); 90 bool WaitUntilOnEnded();
91 PipelineStatus WaitUntilEndedOrError(); 91 PipelineStatus WaitUntilEndedOrError();
92 92
93 // Sets |pipeline_status_| to an error status and stops the message loop.
94 void OnError(PipelineStatus status);
95
xhwang 2016/03/03 06:23:42 I moved these to "public" so that they can be call
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 void set_encrypted_media_init_data_cb(
112 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) {
113 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
114 }
115
108 protected: 116 protected:
109 base::MessageLoop message_loop_; 117 base::MessageLoop message_loop_;
110 base::MD5Context md5_context_; 118 base::MD5Context md5_context_;
111 bool hashing_enabled_; 119 bool hashing_enabled_;
112 bool clockless_playback_; 120 bool clockless_playback_;
113 scoped_ptr<Demuxer> demuxer_; 121 scoped_ptr<Demuxer> demuxer_;
114 scoped_ptr<DataSource> data_source_; 122 scoped_ptr<DataSource> data_source_;
115 scoped_ptr<PipelineImpl> pipeline_; 123 scoped_ptr<PipelineImpl> pipeline_;
116 scoped_refptr<NullAudioSink> audio_sink_; 124 scoped_refptr<NullAudioSink> audio_sink_;
117 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_; 125 scoped_refptr<ClocklessAudioSink> clockless_audio_sink_;
(...skipping 12 matching lines...) Expand all
130 uint8_t test_type); 138 uint8_t test_type);
131 139
132 PipelineStatus StartWithFile(const std::string& filename, 140 PipelineStatus StartWithFile(const std::string& filename,
133 CdmContext* cdm_context, 141 CdmContext* cdm_context,
134 uint8_t test_type); 142 uint8_t test_type);
135 143
136 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); 144 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status);
137 void OnStatusCallback(PipelineStatus status); 145 void OnStatusCallback(PipelineStatus status);
138 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, 146 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type,
139 const std::vector<uint8_t>& init_data); 147 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 148
145 void OnEnded(); 149 void OnEnded();
146 void OnError(PipelineStatus status);
147 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); 150 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time);
148 151
149 // Creates Demuxer and sets |demuxer_|. 152 // Creates Demuxer and sets |demuxer_|.
150 void CreateDemuxer(scoped_ptr<DataSource> data_source); 153 void CreateDemuxer(scoped_ptr<DataSource> data_source);
151 154
152 // Creates and returns a Renderer. 155 // Creates and returns a Renderer.
153 virtual scoped_ptr<Renderer> CreateRenderer(); 156 virtual scoped_ptr<Renderer> CreateRenderer();
154 157
155 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); 158 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame);
156 159
157 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); 160 MOCK_METHOD1(OnMetadata, void(PipelineMetadata));
158 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState)); 161 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState));
159 MOCK_METHOD1(DecryptorAttached, void(bool)); 162 MOCK_METHOD1(DecryptorAttached, void(bool));
160 MOCK_METHOD2(OnAddTextTrack, 163 MOCK_METHOD2(OnAddTextTrack,
161 void(const TextTrackConfig& config, 164 void(const TextTrackConfig& config,
162 const AddTextTrackDoneCB& done_cb)); 165 const AddTextTrackDoneCB& done_cb));
163 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 166 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
164 }; 167 };
165 168
166 } // namespace media 169 } // namespace media
167 170
168 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ 171 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_
OLDNEW
« no previous file with comments | « media/test/pipeline_integration_fuzzertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698