From 8126602e26f6f632d846aeb570c8fdfe9e67bfcf Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Tue, 22 Jan 2013 22:45:59 +0000 Subject: [PATCH] Fix frame_editing_unittest.cc The test fails since it's assuming out/testfile.yuv exists when running the test. Just opening the file at a later time than the SetUp function seems to break the test so that's not a viable solution. This CL uses a simple workaround that simply truncates the file before opening it, which works. BUG=none TEST=tools_unittests in Debug+Release on Mac, Win and Linux + memcheck, tsan, asan. Review URL: https://webrtc-codereview.appspot.com/1067004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3401 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/tools/frame_editing/frame_editing_unittest.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webrtc/tools/frame_editing/frame_editing_unittest.cc b/webrtc/tools/frame_editing/frame_editing_unittest.cc index 22fa6d76e2..5e9b827248 100644 --- a/webrtc/tools/frame_editing/frame_editing_unittest.cc +++ b/webrtc/tools/frame_editing/frame_editing_unittest.cc @@ -11,6 +11,7 @@ #include #include +#include #include "gtest/gtest.h" #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" @@ -32,8 +33,15 @@ class FrameEditingTest : public ::testing::Test { virtual void SetUp() { original_fid_ = fopen(kRefVideo.c_str(), "rb"); ASSERT_TRUE(original_fid_ != NULL); + + // Ensure the output file exists on disk. + std::ofstream(kTestVideo.c_str(), std::ios::out); + // Open the output file for reading. + // TODO(holmer): Figure out why this file has to be opened here (test fails + // if it's opened after the write operation performed in EditFrames). edited_fid_ = fopen(kTestVideo.c_str(), "rb"); ASSERT_TRUE(edited_fid_ != NULL); + original_buffer_.reset(new int[kFrameSize]); edited_buffer_.reset(new int[kFrameSize]); num_frames_read_ = 0;