From 6094ed46ebdb978eaafe41bd9611d30b4cd3f812 Mon Sep 17 00:00:00 2001 From: "wez@chromium.org" Date: Sat, 31 May 2014 02:05:58 +0000 Subject: Clean up VideoEncoderVpx tests. - Rename tests from VideoEncoderVp8Test to VideoEncoderVpxTest. - Update tests to use CreateTestFrame(). - Update tests to mark whole frame as "updated" for encoding. Review URL: https://codereview.chromium.org/307963003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273991 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/codec/video_encoder_vpx_unittest.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/remoting/codec/video_encoder_vpx_unittest.cc b/remoting/codec/video_encoder_vpx_unittest.cc index 5d00106..ccef34c 100644 --- a/remoting/codec/video_encoder_vpx_unittest.cc +++ b/remoting/codec/video_encoder_vpx_unittest.cc @@ -113,35 +113,35 @@ TEST(VideoEncoderVpxTest, TestVp8VideoEncoderIgnoreLossy) { // Test that calling Encode with a differently-sized media::ScreenCaptureData // does not leak memory. -TEST(VideoEncoderVp8Test, TestSizeChangeNoLeak) { - int height = 1000; - int width = 1000; +TEST(VideoEncoderVpxTest, TestSizeChangeNoLeak) { + webrtc::DesktopSize frame_size(1000, 1000); scoped_ptr encoder(VideoEncoderVpx::CreateForVP8()); - scoped_ptr frame( - new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); - + // Create first frame & encode it. + scoped_ptr frame(CreateTestFrame(frame_size)); + frame->mutable_updated_region()->SetRect( + webrtc::DesktopRect::MakeSize(frame_size)); scoped_ptr packet = encoder->Encode(*frame); EXPECT_TRUE(packet); - height /= 2; - frame.reset( - new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); + // Halve the size of the frame, and updated region, and encode again. + frame_size.set(frame_size.width(), frame_size.height() / 2); + frame = CreateTestFrame(frame_size); + frame->mutable_updated_region()->SetRect( + webrtc::DesktopRect::MakeSize(frame_size)); packet = encoder->Encode(*frame); EXPECT_TRUE(packet); } // Test that the DPI information is correctly propagated from the // media::ScreenCaptureData to the VideoPacket. -TEST(VideoEncoderVp8Test, TestDpiPropagation) { - int height = 32; - int width = 32; +TEST(VideoEncoderVpxTest, TestDpiPropagation) { + webrtc::DesktopSize frame_size(32, 32); scoped_ptr encoder(VideoEncoderVpx::CreateForVP8()); - scoped_ptr frame( - new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); + scoped_ptr frame(CreateTestFrame(frame_size)); frame->set_dpi(webrtc::DesktopVector(96, 97)); scoped_ptr packet = encoder->Encode(*frame); EXPECT_EQ(packet->format().x_dpi(), 96); -- cgit v1.1