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

Unified Diff: media/filters/video_renderer_base_unittest.cc

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 | « media/filters/audio_renderer_base_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_base_unittest.cc
diff --git a/media/filters/video_renderer_base_unittest.cc b/media/filters/video_renderer_base_unittest.cc
index b6a5c6b82f44f13bda69c321d6fecfb3b616d739..9735b5fb356d34db809e4883ec151d0b1f6afc25 100644
--- a/media/filters/video_renderer_base_unittest.cc
+++ b/media/filters/video_renderer_base_unittest.cc
@@ -16,6 +16,7 @@ using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::NotNull;
using ::testing::Return;
+using ::testing::ReturnRef;
using ::testing::StrictMock;
namespace media {
@@ -42,13 +43,20 @@ class VideoRendererBaseTest : public ::testing::Test {
public:
VideoRendererBaseTest()
: renderer_(new MockVideoRendererBase()),
- decoder_(new MockVideoDecoder(mime_type::kUncompressedVideo, kWidth,
- kHeight)) {
+ decoder_(new MockVideoDecoder()) {
renderer_->set_host(&host_);
// Queue all reads from the decoder.
EXPECT_CALL(*decoder_, Read(NotNull()))
.WillRepeatedly(Invoke(this, &VideoRendererBaseTest::EnqueueCallback));
+
+ // Sets the essential media format keys for this decoder.
+ decoder_media_format_.SetAsString(MediaFormat::kMimeType,
+ mime_type::kUncompressedVideo);
+ decoder_media_format_.SetAsInteger(MediaFormat::kWidth, kWidth);
+ decoder_media_format_.SetAsInteger(MediaFormat::kHeight, kHeight);
+ EXPECT_CALL(*decoder_, media_format())
+ .WillRepeatedly(ReturnRef(decoder_media_format_));
}
virtual ~VideoRendererBaseTest() {
@@ -68,6 +76,7 @@ class VideoRendererBaseTest : public ::testing::Test {
scoped_refptr<MockVideoDecoder> decoder_;
StrictMock<MockFilterHost> host_;
StrictMock<MockFilterCallback> callback_;
+ MediaFormat decoder_media_format_;
// Receives asynchronous read requests sent to |decoder_|.
std::deque<Callback1<VideoFrame*>::Type*> read_queue_;
@@ -88,7 +97,10 @@ TEST_F(VideoRendererBaseTest, Initialize_BadMediaFormat) {
InSequence s;
// Don't set a media format.
+ MediaFormat media_format;
scoped_refptr<MockVideoDecoder> bad_decoder = new MockVideoDecoder();
+ EXPECT_CALL(*bad_decoder, media_format())
+ .WillRepeatedly(ReturnRef(media_format));
// We expect to receive an error.
EXPECT_CALL(host_, SetError(PIPELINE_ERROR_INITIALIZATION_FAILED));
« no previous file with comments | « media/filters/audio_renderer_base_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698