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

Unified Diff: remoting/codec/video_encoder_vpx_unittest.cc

Issue 307963003: Clean up VideoEncoderVpx tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/codec/video_encoder_vpx_unittest.cc
diff --git a/remoting/codec/video_encoder_vpx_unittest.cc b/remoting/codec/video_encoder_vpx_unittest.cc
index 5d001062cff56afeaf5a94db42a5d64c9945842c..ccef34c1ec2c238f4b8a94db08febd607223c029 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<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
- scoped_ptr<webrtc::DesktopFrame> frame(
- new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height)));
-
+ // Create first frame & encode it.
+ scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ frame->mutable_updated_region()->SetRect(
+ webrtc::DesktopRect::MakeSize(frame_size));
scoped_ptr<VideoPacket> 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<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
- scoped_ptr<webrtc::DesktopFrame> frame(
- new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height)));
+ scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
frame->set_dpi(webrtc::DesktopVector(96, 97));
scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
EXPECT_EQ(packet->format().x_dpi(), 96);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698