Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: webrtc/test/testsupport/yuv_frame_writer_unittest.cc

Issue 2708103002: Revert of Add optional visualization file writers to VideoProcessor tests. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/testsupport/yuv_frame_writer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include <memory>
12
13 #include "webrtc/test/gtest.h"
14 #include "webrtc/test/testsupport/fileutils.h"
15 #include "webrtc/test/testsupport/frame_writer.h"
16
17 namespace webrtc {
18 namespace test {
19
20 namespace {
21 const size_t kFrameWidth = 50;
22 const size_t kFrameHeight = 20;
23 const size_t kFrameLength = 3 * kFrameWidth * kFrameHeight / 2; // I420.
24 } // namespace
25
26 class YuvFrameWriterTest : public testing::Test {
27 protected:
28 YuvFrameWriterTest() = default;
29 ~YuvFrameWriterTest() override = default;
30
31 void SetUp() override {
32 temp_filename_ = webrtc::test::TempFilename(webrtc::test::OutputPath(),
33 "yuv_frame_writer_unittest");
34 frame_writer_.reset(
35 new YuvFrameWriterImpl(temp_filename_, kFrameWidth, kFrameHeight));
36 ASSERT_TRUE(frame_writer_->Init());
37 }
38
39 void TearDown() override { remove(temp_filename_.c_str()); }
40
41 std::unique_ptr<FrameWriter> frame_writer_;
42 std::string temp_filename_;
43 };
44
45 TEST_F(YuvFrameWriterTest, InitSuccess) {}
46
47 TEST_F(YuvFrameWriterTest, FrameLength) {
48 EXPECT_EQ(kFrameLength, frame_writer_->FrameLength());
49 }
50
51 TEST_F(YuvFrameWriterTest, WriteFrame) {
52 uint8_t buffer[kFrameLength];
53 memset(buffer, 9, kFrameLength); // Write lots of 9s to the buffer.
54 bool result = frame_writer_->WriteFrame(buffer);
55 ASSERT_TRUE(result);
56
57 frame_writer_->Close();
58 EXPECT_EQ(kFrameLength, GetFileSize(temp_filename_));
59 }
60
61 TEST_F(YuvFrameWriterTest, WriteFrameUninitialized) {
62 uint8_t buffer[kFrameLength];
63 YuvFrameWriterImpl frame_writer(temp_filename_, kFrameWidth, kFrameHeight);
64 EXPECT_FALSE(frame_writer.WriteFrame(buffer));
65 }
66
67 } // namespace test
68 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/testsupport/yuv_frame_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698