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

Unified Diff: content/renderer/media/rtc_video_decoder_unittest.cc

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright year. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | media/base/video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_video_decoder_unittest.cc
diff --git a/content/renderer/media/rtc_video_decoder_unittest.cc b/content/renderer/media/rtc_video_decoder_unittest.cc
index 441d9c87a87e6202144ed12e3ef0c903c5c11320..6bfe588fe60d5e2f7e8a70406ee92d0bbd907822 100644
--- a/content/renderer/media/rtc_video_decoder_unittest.cc
+++ b/content/renderer/media/rtc_video_decoder_unittest.cc
@@ -222,6 +222,11 @@ class RTCVideoDecoderTest : public testing::Test {
base::Unretained(&statistics_cb_));
}
+ void RenderFrame() {
+ NullVideoFrame video_frame;
+ decoder_->RenderFrame(&video_frame);
+ }
+
MOCK_METHOD2(FrameReady, void(media::VideoDecoder::DecoderStatus status,
const scoped_refptr<media::VideoFrame>&));
@@ -241,19 +246,31 @@ const int RTCVideoDecoderTest::kWidth = 640;
const int RTCVideoDecoderTest::kHeight = 480;
const PipelineStatistics RTCVideoDecoderTest::kStatistics;
+MATCHER_P2(HasSize, width, height, "") {
+ EXPECT_EQ(arg->data_size().width(), width);
+ EXPECT_EQ(arg->data_size().height(), height);
+ EXPECT_EQ(arg->natural_size().width(), width);
+ EXPECT_EQ(arg->natural_size().height(), height);
+ return (arg->data_size().width() == width) &&
+ (arg->data_size().height() == height) &&
+ (arg->natural_size().width() == width) &&
+ (arg->natural_size().height() == height);
+}
+
TEST_F(RTCVideoDecoderTest, Initialize_Successful) {
InitializeDecoderSuccessfully();
- // Test that the output media format is an uncompressed video surface that
- // matches the dimensions specified by RTC.
- EXPECT_EQ(kWidth, decoder_->natural_size().width());
- EXPECT_EQ(kHeight, decoder_->natural_size().height());
+ EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
+ HasSize(kWidth, kHeight)));
+ decoder_->Read(read_cb_);
+ RenderFrame();
}
TEST_F(RTCVideoDecoderTest, DoReset) {
InitializeDecoderSuccessfully();
- EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk, _));
+ EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
+ scoped_refptr<media::VideoFrame>()));
decoder_->Read(read_cb_);
decoder_->Reset(media::NewExpectedClosure());
@@ -264,11 +281,8 @@ TEST_F(RTCVideoDecoderTest, DoReset) {
TEST_F(RTCVideoDecoderTest, DoRenderFrame) {
InitializeDecoderSuccessfully();
- NullVideoFrame video_frame;
-
- for (size_t i = 0; i < media::limits::kMaxVideoFrames; ++i) {
- decoder_->RenderFrame(&video_frame);
- }
+ for (size_t i = 0; i < media::limits::kMaxVideoFrames; ++i)
+ RenderFrame();
message_loop_.RunAllPending();
EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_);
@@ -277,15 +291,20 @@ TEST_F(RTCVideoDecoderTest, DoRenderFrame) {
TEST_F(RTCVideoDecoderTest, DoSetSize) {
InitializeDecoderSuccessfully();
+ EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
+ HasSize(kWidth, kHeight)));
+ decoder_->Read(read_cb_);
+ RenderFrame();
+ message_loop_.RunAllPending();
+
int new_width = kWidth * 2;
int new_height = kHeight * 2;
- gfx::Size new_natural_size(new_width, new_height);
-
decoder_->SetSize(new_width, new_height);
- EXPECT_EQ(new_width, decoder_->natural_size().width());
- EXPECT_EQ(new_height, decoder_->natural_size().height());
-
+ EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
+ HasSize(new_width, new_height)));
+ decoder_->Read(read_cb_);
+ RenderFrame();
message_loop_.RunAllPending();
}
@@ -294,7 +313,8 @@ TEST_F(RTCVideoDecoderTest, ReadAndShutdown) {
// teardown the pipeline) even when there's no input frame.
InitializeDecoderSuccessfully();
- EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk, _)).Times(2);
+ EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
+ scoped_refptr<media::VideoFrame>())).Times(2);
decoder_->Read(read_cb_);
EXPECT_FALSE(decoder_->shutting_down_);
decoder_->PrepareForShutdownHack();
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | media/base/video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698