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

Side by Side Diff: media/base/mock_filters.h

Issue 7867051: Introduce AudioDecoderConfig to migrate away from GetAVStream(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: samples_per_second Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « media/base/media_log.cc ('k') | media/base/pipeline_status.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // A new breed of mock media filters, this time using gmock! Feel free to add 5 // A new breed of mock media filters, this time using gmock! Feel free to add
6 // actions if you need interesting side-effects (i.e., copying data to the 6 // actions if you need interesting side-effects (i.e., copying data to the
7 // buffer passed into MockDataSource::Read()). 7 // buffer passed into MockDataSource::Read()).
8 // 8 //
9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock 9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock
10 // filters to fail the test or do nothing when an unexpected method is called. 10 // filters to fail the test or do nothing when an unexpected method is called.
11 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks 11 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks
12 12
13 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ 13 #ifndef MEDIA_BASE_MOCK_FILTERS_H_
14 #define MEDIA_BASE_MOCK_FILTERS_H_ 14 #define MEDIA_BASE_MOCK_FILTERS_H_
15 15
16 #include <string> 16 #include <string>
17 17
18 #include "media/base/audio_decoder_config.h"
18 #include "media/base/demuxer.h" 19 #include "media/base/demuxer.h"
19 #include "media/base/filters.h" 20 #include "media/base/filters.h"
20 #include "media/base/filter_collection.h" 21 #include "media/base/filter_collection.h"
21 #include "media/base/pipeline.h" 22 #include "media/base/pipeline.h"
22 #include "media/base/video_frame.h" 23 #include "media/base/video_frame.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 25
25 namespace media { 26 namespace media {
26 27
27 // Use this template to test for object destruction by setting expectations on 28 // Use this template to test for object destruction by setting expectations on
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 }; 154 };
154 155
155 class MockDemuxerStream : public DemuxerStream { 156 class MockDemuxerStream : public DemuxerStream {
156 public: 157 public:
157 MockDemuxerStream(); 158 MockDemuxerStream();
158 159
159 // DemuxerStream implementation. 160 // DemuxerStream implementation.
160 MOCK_METHOD0(type, Type()); 161 MOCK_METHOD0(type, Type());
161 MOCK_METHOD1(Read, void(const ReadCallback& read_callback)); 162 MOCK_METHOD1(Read, void(const ReadCallback& read_callback));
162 MOCK_METHOD0(GetAVStream, AVStream*()); 163 MOCK_METHOD0(GetAVStream, AVStream*());
164 MOCK_METHOD0(audio_decoder_config, const AudioDecoderConfig&());
163 MOCK_METHOD0(EnableBitstreamConverter, void()); 165 MOCK_METHOD0(EnableBitstreamConverter, void());
164 166
165 protected: 167 protected:
166 virtual ~MockDemuxerStream(); 168 virtual ~MockDemuxerStream();
167 169
168 private: 170 private:
169 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream); 171 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream);
170 }; 172 };
171 173
172 class MockVideoDecoder : public VideoDecoder { 174 class MockVideoDecoder : public VideoDecoder {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); 209 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb));
208 MOCK_METHOD0(OnAudioRendererDisabled, void()); 210 MOCK_METHOD0(OnAudioRendererDisabled, void());
209 211
210 // AudioDecoder implementation. 212 // AudioDecoder implementation.
211 MOCK_METHOD3(Initialize, void(DemuxerStream* stream, 213 MOCK_METHOD3(Initialize, void(DemuxerStream* stream,
212 FilterCallback* callback, 214 FilterCallback* callback,
213 StatisticsCallback* stats_callback)); 215 StatisticsCallback* stats_callback));
214 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>)); 216 MOCK_METHOD1(ProduceAudioSamples, void(scoped_refptr<Buffer>));
215 MOCK_METHOD0(bits_per_channel, int(void)); 217 MOCK_METHOD0(bits_per_channel, int(void));
216 MOCK_METHOD0(channel_layout, ChannelLayout(void)); 218 MOCK_METHOD0(channel_layout, ChannelLayout(void));
217 MOCK_METHOD0(sample_rate, int(void)); 219 MOCK_METHOD0(samples_per_second, int(void));
218 220
219 void ConsumeAudioSamplesForTest(scoped_refptr<Buffer> buffer) { 221 void ConsumeAudioSamplesForTest(scoped_refptr<Buffer> buffer) {
220 AudioDecoder::ConsumeAudioSamples(buffer); 222 AudioDecoder::ConsumeAudioSamples(buffer);
221 } 223 }
222 224
223 protected: 225 protected:
224 virtual ~MockAudioDecoder(); 226 virtual ~MockAudioDecoder();
225 227
226 private: 228 private:
227 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); 229 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 public: 353 public:
352 MockStatisticsCallback(); 354 MockStatisticsCallback();
353 ~MockStatisticsCallback(); 355 ~MockStatisticsCallback();
354 356
355 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); 357 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics));
356 }; 358 };
357 359
358 } // namespace media 360 } // namespace media
359 361
360 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 362 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/media_log.cc ('k') | media/base/pipeline_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698