Chromium Code Reviews| Index: webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc |
| diff --git a/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc b/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc |
| index f8a4b6979f16a0a4916578345e544b7440c9c838..148c1b8f02d1d3979a8b574e6776e645d46dede7 100644 |
| --- a/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc |
| +++ b/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc |
| @@ -11,6 +11,7 @@ |
| // This test doesn't actually verify the output since it's just printed |
| // to stdout by void functions, but it's still useful as it executes the code. |
| +#include <stdio.h> |
| #include <fstream> |
| #include <string> |
| @@ -38,6 +39,29 @@ class VideoQualityAnalysisTest : public ::testing::Test { |
| }; |
| FILE* VideoQualityAnalysisTest::logfile_ = NULL; |
| +TEST_F(VideoQualityAnalysisTest, MatchExtractedY4mFrame) { |
| + std::string video_file = |
| + webrtc::test::ResourcePath("reference_less_video_test_file", "y4m"); |
| + |
| + std::string extracted_frame_from_video_file = |
| + webrtc::test::ResourcePath("video_quality_analysis_frame", "txt"); |
| + |
| + int frame_height = 720, frame_width = 1280; |
| + int frame_number = 2; |
| + int size = GetI420FrameSize(frame_width, frame_height); |
| + uint8_t* result_frame = new uint8_t[size]; |
|
phoglund
2016/11/25 14:39:07
These leak. I think you can allocate these guys on
|
| + uint8_t* expected_frame = new uint8_t[size]; |
| + |
| + FILE* input_file = fopen(extracted_frame_from_video_file.c_str(), "rb"); |
| + fread(expected_frame, 1, size, input_file); |
| + |
| + ExtractFrameFromY4mFile(video_file.c_str(), |
| + frame_width, frame_height, |
| + frame_number, result_frame); |
| + |
| + EXPECT_EQ(*expected_frame, *result_frame); |
| +} |
| + |
| TEST_F(VideoQualityAnalysisTest, PrintAnalysisResultsEmpty) { |
| ResultsContainer result; |
| PrintAnalysisResults(logfile_, "Empty", &result); |