OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 const size_t kFrameSize = CalcBufferSize(kI420, kWidth, kHeight); | 27 const size_t kFrameSize = CalcBufferSize(kI420, kWidth, kHeight); |
28 | 28 |
29 class FrameEditingTest : public ::testing::Test { | 29 class FrameEditingTest : public ::testing::Test { |
30 protected: | 30 protected: |
31 virtual void SetUp() { | 31 virtual void SetUp() { |
32 reference_video_ = ResourcePath("foreman_cif", "yuv"); | 32 reference_video_ = ResourcePath("foreman_cif", "yuv"); |
33 test_video_ = webrtc::test::TempFilename(webrtc::test::OutputPath(), | 33 test_video_ = webrtc::test::TempFilename(webrtc::test::OutputPath(), |
34 "frame_editing_unittest.yuv"); | 34 "frame_editing_unittest.yuv"); |
35 | 35 |
36 original_fid_ = fopen(reference_video_.c_str(), "rb"); | 36 original_fid_ = fopen(reference_video_.c_str(), "rb"); |
37 ASSERT_TRUE(original_fid_ != NULL); | 37 ASSERT_TRUE(original_fid_ != nullptr); |
38 | 38 |
39 // Ensure the output file exists on disk. | 39 // Ensure the output file exists on disk. |
40 std::ofstream(test_video_.c_str(), std::ios::out); | 40 std::ofstream(test_video_.c_str(), std::ios::out); |
41 // Open the output file for reading. | 41 // Open the output file for reading. |
42 // TODO(holmer): Figure out why this file has to be opened here (test fails | 42 // TODO(holmer): Figure out why this file has to be opened here (test fails |
43 // if it's opened after the write operation performed in EditFrames). | 43 // if it's opened after the write operation performed in EditFrames). |
44 edited_fid_ = fopen(test_video_.c_str(), "rb"); | 44 edited_fid_ = fopen(test_video_.c_str(), "rb"); |
45 ASSERT_TRUE(edited_fid_ != NULL); | 45 ASSERT_TRUE(edited_fid_ != nullptr); |
46 | 46 |
47 original_buffer_.reset(new int[kFrameSize]); | 47 original_buffer_.reset(new int[kFrameSize]); |
48 edited_buffer_.reset(new int[kFrameSize]); | 48 edited_buffer_.reset(new int[kFrameSize]); |
49 num_frames_read_ = 0; | 49 num_frames_read_ = 0; |
50 } | 50 } |
51 virtual void TearDown() { | 51 virtual void TearDown() { |
52 fclose(original_fid_); | 52 fclose(original_fid_); |
53 fclose(edited_fid_); | 53 fclose(edited_fid_); |
54 remove(test_video_.c_str()); | 54 remove(test_video_.c_str()); |
55 } | 55 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 EXPECT_EQ(kFrameSize, num_bytes_read_); | 207 EXPECT_EQ(kFrameSize, num_bytes_read_); |
208 EXPECT_EQ(0, memcmp(original_buffer_.get(), edited_buffer_.get(), | 208 EXPECT_EQ(0, memcmp(original_buffer_.get(), edited_buffer_.get(), |
209 kFrameSize)); | 209 kFrameSize)); |
210 } | 210 } |
211 } | 211 } |
212 CompareToTheEnd(edited_fid_, original_fid_, &original_buffer_, | 212 CompareToTheEnd(edited_fid_, original_fid_, &original_buffer_, |
213 &edited_buffer_); | 213 &edited_buffer_); |
214 } | 214 } |
215 } // namespace test | 215 } // namespace test |
216 } // namespace webrtc | 216 } // namespace webrtc |
OLD | NEW |