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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/codec/video_encoder_vpx.h" 5 #include "remoting/codec/video_encoder_vpx.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // Encode a frame, to give the encoder a chance to crash if misconfigured. 107 // Encode a frame, to give the encoder a chance to crash if misconfigured.
108 encoder->SetLosslessEncode(true); 108 encoder->SetLosslessEncode(true);
109 encoder->SetLosslessColor(true); 109 encoder->SetLosslessColor(true);
110 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); 110 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
111 EXPECT_TRUE(packet); 111 EXPECT_TRUE(packet);
112 } 112 }
113 113
114 // Test that calling Encode with a differently-sized media::ScreenCaptureData 114 // Test that calling Encode with a differently-sized media::ScreenCaptureData
115 // does not leak memory. 115 // does not leak memory.
116 TEST(VideoEncoderVp8Test, TestSizeChangeNoLeak) { 116 TEST(VideoEncoderVpxTest, TestSizeChangeNoLeak) {
117 int height = 1000; 117 webrtc::DesktopSize frame_size(1000, 1000);
118 int width = 1000;
119 118
120 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); 119 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
121 120
122 scoped_ptr<webrtc::DesktopFrame> frame( 121 // Create first frame & encode it.
123 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); 122 scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
124 123 frame->mutable_updated_region()->SetRect(
124 webrtc::DesktopRect::MakeSize(frame_size));
125 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); 125 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
126 EXPECT_TRUE(packet); 126 EXPECT_TRUE(packet);
127 127
128 height /= 2; 128 // Halve the size of the frame, and updated region, and encode again.
129 frame.reset( 129 frame_size.set(frame_size.width(), frame_size.height() / 2);
130 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); 130 frame = CreateTestFrame(frame_size);
131 frame->mutable_updated_region()->SetRect(
132 webrtc::DesktopRect::MakeSize(frame_size));
131 packet = encoder->Encode(*frame); 133 packet = encoder->Encode(*frame);
132 EXPECT_TRUE(packet); 134 EXPECT_TRUE(packet);
133 } 135 }
134 136
135 // Test that the DPI information is correctly propagated from the 137 // Test that the DPI information is correctly propagated from the
136 // media::ScreenCaptureData to the VideoPacket. 138 // media::ScreenCaptureData to the VideoPacket.
137 TEST(VideoEncoderVp8Test, TestDpiPropagation) { 139 TEST(VideoEncoderVpxTest, TestDpiPropagation) {
138 int height = 32; 140 webrtc::DesktopSize frame_size(32, 32);
139 int width = 32;
140 141
141 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); 142 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
142 143
143 scoped_ptr<webrtc::DesktopFrame> frame( 144 scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
144 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height)));
145 frame->set_dpi(webrtc::DesktopVector(96, 97)); 145 frame->set_dpi(webrtc::DesktopVector(96, 97));
146 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); 146 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
147 EXPECT_EQ(packet->format().x_dpi(), 96); 147 EXPECT_EQ(packet->format().x_dpi(), 96);
148 EXPECT_EQ(packet->format().y_dpi(), 97); 148 EXPECT_EQ(packet->format().y_dpi(), 97);
149 } 149 }
150 150
151 } // namespace remoting 151 } // namespace remoting
OLDNEW
« 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