diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-06 21:16:45 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-06 21:16:45 +0000 |
commit | cb6f584dd106ab452e5f76b82fa09c40e5428ffc (patch) | |
tree | 02d2bc3ddd36ef90bf90b1625528420a84097616 /media | |
parent | 21a3785836bac48f12af3175415df61b8dfdab56 (diff) | |
download | chromium_src-cb6f584dd106ab452e5f76b82fa09c40e5428ffc.zip chromium_src-cb6f584dd106ab452e5f76b82fa09c40e5428ffc.tar.gz chromium_src-cb6f584dd106ab452e5f76b82fa09c40e5428ffc.tar.bz2 |
Moved mock media filter constructors from private to public.
Review URL: http://codereview.chromium.org/40243
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/mock_media_filters.h | 75 | ||||
-rw-r--r-- | media/filters/video_renderer_unittest.cc | 5 |
2 files changed, 32 insertions, 48 deletions
diff --git a/media/base/mock_media_filters.h b/media/base/mock_media_filters.h index dd6dd3d..079c681 100644 --- a/media/base/mock_media_filters.h +++ b/media/base/mock_media_filters.h @@ -74,6 +74,11 @@ class MockDataSource : public DataSource { const MockFilterConfig*>(config); } + explicit MockDataSource(const MockFilterConfig* config) + : config_(config), + position_(0) { + } + // Implementation of MediaFilter. virtual void Stop() {} @@ -141,14 +146,6 @@ class MockDataSource : public DataSource { } private: - friend class FilterFactoryImpl1<MockDataSource, - const MockFilterConfig*>; - - explicit MockDataSource(const MockFilterConfig* config) - : config_(config), - position_(0) { - } - virtual ~MockDataSource() {} void TaskBehavior() { @@ -181,6 +178,12 @@ class MockDemuxer : public Demuxer { const MockFilterConfig*>(config); } + explicit MockDemuxer(const MockFilterConfig* config) + : config_(config), + mock_audio_stream_(config, true), + mock_video_stream_(config, false) { + } + // Implementation of MediaFilter. virtual void Stop() {} @@ -221,14 +224,6 @@ class MockDemuxer : public Demuxer { } private: - friend class FilterFactoryImpl1<MockDemuxer, const MockFilterConfig*>; - - explicit MockDemuxer(const MockFilterConfig* config) - : config_(config), - mock_audio_stream_(config, true), - mock_video_stream_(config, false) { - } - virtual ~MockDemuxer() {} // Internal class implements DemuxerStream interface. @@ -283,6 +278,11 @@ class MockAudioDecoder : public AudioDecoder { return true; // TODO(ralphl): check for a supported format. } + explicit MockAudioDecoder(const MockFilterConfig* config) { + media_format_.SetAsString(MediaFormat::kMimeType, + config->uncompressed_audio_mime_type); + } + // Implementation of MediaFilter. virtual void Stop() {} @@ -302,13 +302,6 @@ class MockAudioDecoder : public AudioDecoder { } private: - friend class FilterFactoryImpl1<MockAudioDecoder, const MockFilterConfig*>; - - explicit MockAudioDecoder(const MockFilterConfig* config) { - media_format_.SetAsString(MediaFormat::kMimeType, - config->uncompressed_audio_mime_type); - } - virtual ~MockAudioDecoder() {} MediaFormat media_format_; @@ -329,6 +322,8 @@ class MockAudioRenderer : public AudioRenderer { return true; // TODO(ralphl): check for a supported format } + explicit MockAudioRenderer(const MockFilterConfig* config) {} + // Implementation of MediaFilter. virtual void Stop() {} @@ -341,10 +336,6 @@ class MockAudioRenderer : public AudioRenderer { virtual void SetVolume(float volume) {} private: - friend class FilterFactoryImpl1<MockAudioRenderer, const MockFilterConfig*>; - - explicit MockAudioRenderer(const MockFilterConfig* config) {} - virtual ~MockAudioRenderer() {} DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); @@ -432,6 +423,14 @@ class MockVideoDecoder : public VideoDecoder { return true; // TODO(ralphl): check for a supported format. } + explicit MockVideoDecoder(const MockFilterConfig* config) + : config_(config) { + media_format_.SetAsString(MediaFormat::kMimeType, + config->uncompressed_video_mime_type); + media_format_.SetAsInteger(MediaFormat::kWidth, config->video_width); + media_format_.SetAsInteger(MediaFormat::kHeight, config->video_height); + } + // Implementation of MediaFilter. virtual void Stop() {} @@ -451,15 +450,7 @@ class MockVideoDecoder : public VideoDecoder { } private: - friend class FilterFactoryImpl1<MockVideoDecoder, const MockFilterConfig*>; - - explicit MockVideoDecoder(const MockFilterConfig* config) - : config_(config) { - media_format_.SetAsString(MediaFormat::kMimeType, - config->uncompressed_video_mime_type); - media_format_.SetAsInteger(MediaFormat::kWidth, config->video_width); - media_format_.SetAsInteger(MediaFormat::kHeight, config->video_height); - } + virtual ~MockVideoDecoder() {} void DoRead(Assignable<VideoFrame>* buffer) { if (mock_frame_time_ < config_->media_duration) { @@ -481,8 +472,6 @@ class MockVideoDecoder : public VideoDecoder { buffer->Release(); } - virtual ~MockVideoDecoder() {} - MediaFormat media_format_; base::TimeDelta mock_frame_time_; const MockFilterConfig* config_; @@ -503,6 +492,10 @@ class MockVideoRenderer : public VideoRenderer { return true; // TODO(ralphl): check for a supported format } + explicit MockVideoRenderer(const MockFilterConfig* config) + : config_(config) { + } + // Implementation of MediaFilter. virtual void Stop() {} @@ -514,12 +507,6 @@ class MockVideoRenderer : public VideoRenderer { } private: - friend class FilterFactoryImpl1<MockVideoRenderer, const MockFilterConfig*>; - - explicit MockVideoRenderer(const MockFilterConfig* config) - : config_(config) { - } - virtual ~MockVideoRenderer() {} const MockFilterConfig* config_; diff --git a/media/filters/video_renderer_unittest.cc b/media/filters/video_renderer_unittest.cc index 96c04f1..c7f6330 100644 --- a/media/filters/video_renderer_unittest.cc +++ b/media/filters/video_renderer_unittest.cc @@ -19,10 +19,7 @@ using media::TestVideoRenderer; TEST(VideoRenderer, CreateAndPlay) { // Prepare test data. MockFilterConfig config; - scoped_refptr<FilterFactory> factory - = MockVideoDecoder::CreateFactory(&config); - scoped_refptr<MockVideoDecoder> decoder - = factory->Create<MockVideoDecoder>(NULL); + scoped_refptr<MockVideoDecoder> decoder = new MockVideoDecoder(&config); scoped_refptr<TestVideoRenderer> renderer = new TestVideoRenderer(); // Setup our mock pipeline. |