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

Unified Diff: media/base/mock_filters.h

Issue 404016: Replace hard-coded media_format() methods with Google Mock methods declared in mock_filters.h. (Closed)
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl_unittest.cc ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/mock_filters.h
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index e140818693fa331e42802a02e6cf1445df6fdcc5..ca60179af80a00f22100433145143ff11e4a7293 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -101,7 +101,7 @@ class MockDataSource : public DataSource {
// DataSource implementation.
MOCK_METHOD2(Initialize, void(const std::string& url,
FilterCallback* callback));
- const MediaFormat& media_format() { return media_format_; }
+ MOCK_METHOD0(media_format, const MediaFormat&());
MOCK_METHOD4(Read, void(int64 position, size_t size, uint8* data,
DataSource::ReadCallback* callback));
MOCK_METHOD1(GetSize, bool(int64* size_out));
@@ -111,8 +111,6 @@ class MockDataSource : public DataSource {
virtual ~MockDataSource() {}
private:
- MediaFormat media_format_;
-
DISALLOW_COPY_AND_ASSIGN(MockDataSource);
};
@@ -143,14 +141,8 @@ class MockDemuxerStream : public DemuxerStream {
public:
MockDemuxerStream() {}
- // Sets the mime type of this object's media format, which is usually checked
- // to determine the type of decoder to create.
- explicit MockDemuxerStream(const std::string& mime_type) {
- media_format_.SetAsString(MediaFormat::kMimeType, mime_type);
- }
-
// DemuxerStream implementation.
- const MediaFormat& media_format() { return media_format_; }
+ MOCK_METHOD0(media_format, const MediaFormat&());
MOCK_METHOD1(Read, void(Callback1<Buffer*>::Type* read_callback));
MOCK_METHOD1(QueryInterface, void*(const char* interface_id));
@@ -167,13 +159,6 @@ class MockVideoDecoder : public VideoDecoder {
public:
MockVideoDecoder() {}
- // Sets the essential media format keys for this decoder.
- MockVideoDecoder(const std::string& mime_type, int width, int height) {
- media_format_.SetAsString(MediaFormat::kMimeType, mime_type);
- media_format_.SetAsInteger(MediaFormat::kWidth, width);
- media_format_.SetAsInteger(MediaFormat::kHeight, height);
- }
-
// MediaFilter implementation.
MOCK_METHOD0(Stop, void());
MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
@@ -183,15 +168,13 @@ class MockVideoDecoder : public VideoDecoder {
// VideoDecoder implementation.
MOCK_METHOD2(Initialize, void(DemuxerStream* stream,
FilterCallback* callback));
- const MediaFormat& media_format() { return media_format_; }
+ MOCK_METHOD0(media_format, const MediaFormat&());
MOCK_METHOD1(Read, void(Callback1<VideoFrame*>::Type* read_callback));
protected:
virtual ~MockVideoDecoder() {}
private:
- MediaFormat media_format_;
-
DISALLOW_COPY_AND_ASSIGN(MockVideoDecoder);
};
@@ -199,15 +182,6 @@ class MockAudioDecoder : public AudioDecoder {
public:
MockAudioDecoder() {}
- // Sets the essential media format keys for this decoder.
- MockAudioDecoder(int channels, int sample_rate, int sample_bits) {
- media_format_.SetAsString(MediaFormat::kMimeType,
- mime_type::kUncompressedAudio);
- media_format_.SetAsInteger(MediaFormat::kChannels, channels);
- media_format_.SetAsInteger(MediaFormat::kSampleRate, sample_rate);
- media_format_.SetAsInteger(MediaFormat::kSampleBits, sample_bits);
- }
-
// MediaFilter implementation.
MOCK_METHOD0(Stop, void());
MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
@@ -217,15 +191,13 @@ class MockAudioDecoder : public AudioDecoder {
// AudioDecoder implementation.
MOCK_METHOD2(Initialize, void(DemuxerStream* stream,
FilterCallback* callback));
- const MediaFormat& media_format() { return media_format_; }
+ MOCK_METHOD0(media_format, const MediaFormat&());
MOCK_METHOD1(Read, void(Callback1<Buffer*>::Type* read_callback));
protected:
virtual ~MockAudioDecoder() {}
private:
- MediaFormat media_format_;
-
DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder);
};
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl_unittest.cc ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698