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

Side by Side Diff: media/base/video_util_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_unittest.cc ('k') | media/base/wall_clock_time_source.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/base/video_util.h"
6
5 #include <stdint.h> 7 #include <stdint.h>
6 8
9 #include <memory>
10
7 #include "base/macros.h" 11 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "media/base/video_frame.h" 12 #include "media/base/video_frame.h"
10 #include "media/base/video_util.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 14
13 namespace media { 15 namespace media {
14 16
15 class VideoUtilTest : public testing::Test { 17 class VideoUtilTest : public testing::Test {
16 public: 18 public:
17 VideoUtilTest() 19 VideoUtilTest()
18 : height_(0), 20 : height_(0),
19 y_stride_(0), 21 y_stride_(0),
20 u_stride_(0), 22 u_stride_(0),
(...skipping 18 matching lines...) Expand all
39 v_plane_.reset(new uint8_t[v_stride * height / 2]); 41 v_plane_.reset(new uint8_t[v_stride * height / 2]);
40 } 42 }
41 43
42 void CreateDestinationFrame(int width, int height) { 44 void CreateDestinationFrame(int width, int height) {
43 gfx::Size size(width, height); 45 gfx::Size size(width, height);
44 destination_frame_ = VideoFrame::CreateFrame( 46 destination_frame_ = VideoFrame::CreateFrame(
45 PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, base::TimeDelta()); 47 PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, base::TimeDelta());
46 } 48 }
47 49
48 private: 50 private:
49 scoped_ptr<uint8_t[]> y_plane_; 51 std::unique_ptr<uint8_t[]> y_plane_;
50 scoped_ptr<uint8_t[]> u_plane_; 52 std::unique_ptr<uint8_t[]> u_plane_;
51 scoped_ptr<uint8_t[]> v_plane_; 53 std::unique_ptr<uint8_t[]> v_plane_;
52 54
53 int height_; 55 int height_;
54 int y_stride_; 56 int y_stride_;
55 int u_stride_; 57 int u_stride_;
56 int v_stride_; 58 int v_stride_;
57 59
58 scoped_refptr<VideoFrame> destination_frame_; 60 scoped_refptr<VideoFrame> destination_frame_;
59 61
60 DISALLOW_COPY_AND_ASSIGN(VideoUtilTest); 62 DISALLOW_COPY_AND_ASSIGN(VideoUtilTest);
61 }; 63 };
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 public: 229 public:
228 VideoUtilRotationTest() { 230 VideoUtilRotationTest() {
229 dest_.reset(new uint8_t[GetParam().width * GetParam().height]); 231 dest_.reset(new uint8_t[GetParam().width * GetParam().height]);
230 } 232 }
231 233
232 virtual ~VideoUtilRotationTest() {} 234 virtual ~VideoUtilRotationTest() {}
233 235
234 uint8_t* dest_plane() { return dest_.get(); } 236 uint8_t* dest_plane() { return dest_.get(); }
235 237
236 private: 238 private:
237 scoped_ptr<uint8_t[]> dest_; 239 std::unique_ptr<uint8_t[]> dest_;
238 240
239 DISALLOW_COPY_AND_ASSIGN(VideoUtilRotationTest); 241 DISALLOW_COPY_AND_ASSIGN(VideoUtilRotationTest);
240 }; 242 };
241 243
242 TEST_P(VideoUtilRotationTest, Rotate) { 244 TEST_P(VideoUtilRotationTest, Rotate) {
243 int rotation = GetParam().rotation; 245 int rotation = GetParam().rotation;
244 EXPECT_TRUE((rotation >= 0) && (rotation < 360) && (rotation % 90 == 0)); 246 EXPECT_TRUE((rotation >= 0) && (rotation < 360) && (rotation % 90 == 0));
245 247
246 int size = GetParam().width * GetParam().height; 248 int size = GetParam().width * GetParam().height;
247 uint8_t* dest = dest_plane(); 249 uint8_t* dest = dest_plane();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 inside ? 0x03 : 0x80); 356 inside ? 0x03 : 0x80);
355 } 357 }
356 } 358 }
357 } 359 }
358 } 360 }
359 } 361 }
360 } 362 }
361 } 363 }
362 364
363 } // namespace media 365 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame_unittest.cc ('k') | media/base/wall_clock_time_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698