Index: webrtc/test/testsupport/frame_reader_unittest.cc |
diff --git a/webrtc/test/testsupport/frame_reader_unittest.cc b/webrtc/test/testsupport/frame_reader_unittest.cc |
index 25ea9132f2f5ac47eb4a35fd0842806a518d0899..dbd3b293cfcd637cfafdafc27c947f335618c2fc 100644 |
--- a/webrtc/test/testsupport/frame_reader_unittest.cc |
+++ b/webrtc/test/testsupport/frame_reader_unittest.cc |
@@ -12,14 +12,13 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "webrtc/test/testsupport/fileutils.h" |
+#include "webrtc/common_video/include/video_frame_buffer.h" |
namespace webrtc { |
namespace test { |
const std::string kInputFileContents = "baz"; |
-// Setting the kFrameLength value to a value much larger than the |
-// file to test causes the ReadFrame test to fail on Windows. |
-const size_t kFrameLength = 1000; |
+const size_t kFrameLength = 3; |
class FrameReaderTest: public testing::Test { |
protected: |
@@ -33,7 +32,7 @@ class FrameReaderTest: public testing::Test { |
fprintf(dummy, "%s", kInputFileContents.c_str()); |
fclose(dummy); |
- frame_reader_ = new FrameReaderImpl(temp_filename_, kFrameLength); |
+ frame_reader_ = new FrameReaderImpl(temp_filename_, 1, 1); |
ASSERT_TRUE(frame_reader_->Init()); |
} |
void TearDown() { |
@@ -46,25 +45,25 @@ class FrameReaderTest: public testing::Test { |
}; |
TEST_F(FrameReaderTest, InitSuccess) { |
- FrameReaderImpl frame_reader(temp_filename_, kFrameLength); |
+ FrameReaderImpl frame_reader(temp_filename_, 1, 1); |
ASSERT_TRUE(frame_reader.Init()); |
ASSERT_EQ(kFrameLength, frame_reader.FrameLength()); |
- ASSERT_EQ(0, frame_reader.NumberOfFrames()); |
+ ASSERT_EQ(1, frame_reader.NumberOfFrames()); |
} |
TEST_F(FrameReaderTest, ReadFrame) { |
- uint8_t buffer[3]; |
- bool result = frame_reader_->ReadFrame(buffer); |
- ASSERT_FALSE(result); // No more files to read. |
- ASSERT_EQ(kInputFileContents[0], buffer[0]); |
- ASSERT_EQ(kInputFileContents[1], buffer[1]); |
- ASSERT_EQ(kInputFileContents[2], buffer[2]); |
+ rtc::scoped_refptr<VideoFrameBuffer> buffer; |
+ buffer = frame_reader_->ReadFrame(); |
+ ASSERT_TRUE(buffer); |
+ ASSERT_EQ(kInputFileContents[0], buffer->DataY()[0]); |
+ ASSERT_EQ(kInputFileContents[1], buffer->DataU()[0]); |
+ ASSERT_EQ(kInputFileContents[2], buffer->DataV()[0]); |
+ ASSERT_FALSE(frame_reader_->ReadFrame()); // End of file |
} |
TEST_F(FrameReaderTest, ReadFrameUninitialized) { |
- uint8_t buffer[3]; |
- FrameReaderImpl file_reader(temp_filename_, kFrameLength); |
- ASSERT_FALSE(file_reader.ReadFrame(buffer)); |
+ FrameReaderImpl file_reader(temp_filename_, 1, 1); |
+ ASSERT_FALSE(file_reader.ReadFrame()); |
} |
} // namespace test |