summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2016-08-08 14:43:14 -0700
committerJames Zern <jzern@google.com>2016-08-08 14:43:14 -0700
commit475e9d26e0e612cf2fd2fe650f67add316a53718 (patch)
tree3541881030a142060a1baeb2fb4f865ce548572a /test
parent9e9722bc79656b5b5bec914ba611f5d65c1212e0 (diff)
downloadlibvpx-475e9d26e0e612cf2fd2fe650f67add316a53718.tar
libvpx-475e9d26e0e612cf2fd2fe650f67add316a53718.tar.gz
libvpx-475e9d26e0e612cf2fd2fe650f67add316a53718.tar.bz2
libvpx-475e9d26e0e612cf2fd2fe650f67add316a53718.zip
tests: use scoped_ptr for local video source vars
prevents leak warnings on ASSERT*() failures Change-Id: I1d3edbdbb18dbbe3b17691971348a8121cf09afa
Diffstat (limited to 'test')
-rw-r--r--test/external_frame_buffer_test.cc11
-rw-r--r--test/invalid_file_test.cc10
-rw-r--r--test/test_vector_test.cc10
-rw-r--r--test/vp9_encoder_parms_get_to_decoder.cc9
-rw-r--r--test/vp9_end_to_end_test.cc16
5 files changed, 27 insertions, 29 deletions
diff --git a/test/external_frame_buffer_test.cc b/test/external_frame_buffer_test.cc
index 93ac8ccfe..f9686695a 100644
--- a/test/external_frame_buffer_test.cc
+++ b/test/external_frame_buffer_test.cc
@@ -350,7 +350,6 @@ class ExternalFrameBufferTest : public ::testing::Test {
// Otherwise, the test failed.
TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
const std::string filename = GET_PARAM(kVideoNameParam);
- libvpx_test::CompressedVideoSource *video = NULL;
// Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
// #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
@@ -365,18 +364,19 @@ TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
#endif
// Open compressed video file.
+ testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
if (filename.substr(filename.length() - 3, 3) == "ivf") {
- video = new libvpx_test::IVFVideoSource(filename);
+ video.reset(new libvpx_test::IVFVideoSource(filename));
} else {
#if CONFIG_WEBM_IO
- video = new libvpx_test::WebMVideoSource(filename);
+ video.reset(new libvpx_test::WebMVideoSource(filename));
#else
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
filename.c_str());
return;
#endif
}
- ASSERT_TRUE(video != NULL);
+ ASSERT_TRUE(video.get() != NULL);
video->Init();
// Construct md5 file name.
@@ -384,8 +384,7 @@ TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
OpenMD5File(md5_filename);
// Decode frame, and check the md5 matching.
- ASSERT_NO_FATAL_FAILURE(RunLoop(video));
- delete video;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
}
#if CONFIG_WEBM_IO
diff --git a/test/invalid_file_test.cc b/test/invalid_file_test.cc
index dc62153b1..d5dc8405e 100644
--- a/test/invalid_file_test.cc
+++ b/test/invalid_file_test.cc
@@ -84,23 +84,24 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
void RunTest() {
const DecodeParam input = GET_PARAM(1);
- libvpx_test::CompressedVideoSource *video = NULL;
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
cfg.threads = input.threads;
const std::string filename = input.filename;
// Open compressed video file.
+ testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
if (filename.substr(filename.length() - 3, 3) == "ivf") {
- video = new libvpx_test::IVFVideoSource(filename);
+ video.reset(new libvpx_test::IVFVideoSource(filename));
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
#if CONFIG_WEBM_IO
- video = new libvpx_test::WebMVideoSource(filename);
+ video.reset(new libvpx_test::WebMVideoSource(filename));
#else
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
filename.c_str());
return;
#endif
}
+ ASSERT_TRUE(video.get() != NULL);
video->Init();
// Construct result file name. The file holds a list of expected integer
@@ -110,8 +111,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
OpenResFile(res_filename);
// Decode frame, and check the md5 matching.
- ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg));
- delete video;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
}
private:
diff --git a/test/test_vector_test.cc b/test/test_vector_test.cc
index 755142041..6d4315740 100644
--- a/test/test_vector_test.cc
+++ b/test/test_vector_test.cc
@@ -94,7 +94,6 @@ TEST_P(TestVectorTest, MD5Match) {
const std::string filename = std::tr1::get<kFileName>(input);
const int threads = std::tr1::get<kThreads>(input);
const int mode = std::tr1::get<kDecodeMode>(input);
- libvpx_test::CompressedVideoSource *video = NULL;
vpx_codec_flags_t flags = 0;
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
char str[256];
@@ -119,17 +118,19 @@ TEST_P(TestVectorTest, MD5Match) {
SCOPED_TRACE(str);
// Open compressed video file.
+ testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
if (filename.substr(filename.length() - 3, 3) == "ivf") {
- video = new libvpx_test::IVFVideoSource(filename);
+ video.reset(new libvpx_test::IVFVideoSource(filename));
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
#if CONFIG_WEBM_IO
- video = new libvpx_test::WebMVideoSource(filename);
+ video.reset(new libvpx_test::WebMVideoSource(filename));
#else
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
filename.c_str());
return;
#endif
}
+ ASSERT_TRUE(video.get() != NULL);
video->Init();
// Construct md5 file name.
@@ -141,8 +142,7 @@ TEST_P(TestVectorTest, MD5Match) {
set_flags(flags);
// Decode frame, and check the md5 matching.
- ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg));
- delete video;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
}
// Test VP8 decode in serial mode with single thread.
diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc
index b5ca1a350..53dc8c9fe 100644
--- a/test/vp9_encoder_parms_get_to_decoder.cc
+++ b/test/vp9_encoder_parms_get_to_decoder.cc
@@ -140,12 +140,11 @@ class VpxEncoderParmsGetToDecoder
TEST_P(VpxEncoderParmsGetToDecoder, BitstreamParms) {
init_flags_ = VPX_CODEC_USE_PSNR;
- libvpx_test::VideoSource *const video =
- new libvpx_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames);
- ASSERT_TRUE(video != NULL);
+ testing::internal::scoped_ptr<libvpx_test::VideoSource> video(
+ new libvpx_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames));
+ ASSERT_TRUE(video.get() != NULL);
- ASSERT_NO_FATAL_FAILURE(RunLoop(video));
- delete video;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
}
VP9_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
diff --git a/test/vp9_end_to_end_test.cc b/test/vp9_end_to_end_test.cc
index 168368f5f..955f567ce 100644
--- a/test/vp9_end_to_end_test.cc
+++ b/test/vp9_end_to_end_test.cc
@@ -154,20 +154,20 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
init_flags_ = VPX_CODEC_USE_PSNR;
if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
- libvpx_test::VideoSource *video;
+ testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
if (is_extension_y4m(test_video_param_.filename)) {
- video =
- new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0, kFrames);
+ video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
+ kFrames));
} else {
- video = new libvpx_test::YUVVideoSource(test_video_param_.filename,
- test_video_param_.fmt, kWidth,
- kHeight, kFramerate, 1, 0, kFrames);
+ video.reset(new libvpx_test::YUVVideoSource(
+ test_video_param_.filename, test_video_param_.fmt, kWidth, kHeight,
+ kFramerate, 1, 0, kFrames));
}
+ ASSERT_TRUE(video.get() != NULL);
- ASSERT_NO_FATAL_FAILURE(RunLoop(video));
+ ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
const double psnr = GetAveragePsnr();
EXPECT_GT(psnr, GetPsnrThreshold());
- delete (video);
}
VP9_INSTANTIATE_TEST_CASE(EndToEndTestLarge,