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

Side by Side Diff: media/base/video_frame_pool_unittest.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: android Created 4 years, 8 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 | « media/base/video_frame_metadata.cc ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <memory>
7 8
8 #include "media/base/video_frame_pool.h" 9 #include "media/base/video_frame_pool.h"
9 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
10 11
11 namespace media { 12 namespace media {
12 13
13 class VideoFramePoolTest : public ::testing::Test { 14 class VideoFramePoolTest : public ::testing::Test {
14 public: 15 public:
15 VideoFramePoolTest() : pool_(new VideoFramePool()) {} 16 VideoFramePoolTest() : pool_(new VideoFramePool()) {}
16 17
(...skipping 15 matching lines...) Expand all
32 EXPECT_EQ(natural_size, frame->natural_size()); 33 EXPECT_EQ(natural_size, frame->natural_size());
33 34
34 return frame; 35 return frame;
35 } 36 }
36 37
37 void CheckPoolSize(size_t size) const { 38 void CheckPoolSize(size_t size) const {
38 EXPECT_EQ(size, pool_->GetPoolSizeForTesting()); 39 EXPECT_EQ(size, pool_->GetPoolSizeForTesting());
39 } 40 }
40 41
41 protected: 42 protected:
42 scoped_ptr<VideoFramePool> pool_; 43 std::unique_ptr<VideoFramePool> pool_;
43 }; 44 };
44 45
45 TEST_F(VideoFramePoolTest, FrameInitializedAndZeroed) { 46 TEST_F(VideoFramePoolTest, FrameInitializedAndZeroed) {
46 scoped_refptr<VideoFrame> frame = CreateFrame(PIXEL_FORMAT_YV12, 10); 47 scoped_refptr<VideoFrame> frame = CreateFrame(PIXEL_FORMAT_YV12, 10);
47 48
48 // Verify that frame is initialized with zeros. 49 // Verify that frame is initialized with zeros.
49 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i) 50 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i)
50 EXPECT_EQ(0, frame->data(i)[0]); 51 EXPECT_EQ(0, frame->data(i)[0]);
51 } 52 }
52 53
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Destroy the pool. 86 // Destroy the pool.
86 pool_.reset(); 87 pool_.reset();
87 88
88 // Write to the Y plane. The memory tools should detect a 89 // Write to the Y plane. The memory tools should detect a
89 // use-after-free if the storage was actually removed by pool destruction. 90 // use-after-free if the storage was actually removed by pool destruction.
90 memset(frame->data(VideoFrame::kYPlane), 0xff, 91 memset(frame->data(VideoFrame::kYPlane), 0xff,
91 frame->rows(VideoFrame::kYPlane) * frame->stride(VideoFrame::kYPlane)); 92 frame->rows(VideoFrame::kYPlane) * frame->stride(VideoFrame::kYPlane));
92 } 93 }
93 94
94 } // namespace media 95 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame_metadata.cc ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698