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

Side by Side Diff: webrtc/media/base/videocapturer_unittest.cc

Issue 1937693002: Replace scoped_ptr with unique_ptr everywhere (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@unique5
Patch Set: Created 4 years, 7 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/media/base/videobroadcaster.h ('k') | webrtc/media/engine/webrtcvoe.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 /* 1 /*
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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
11 #include <stdio.h> 11 #include <stdio.h>
12
13 #include <memory>
12 #include <vector> 14 #include <vector>
13 15
14 #include "webrtc/base/gunit.h" 16 #include "webrtc/base/gunit.h"
15 #include "webrtc/base/logging.h" 17 #include "webrtc/base/logging.h"
16 #include "webrtc/base/thread.h" 18 #include "webrtc/base/thread.h"
17 #include "webrtc/media/base/fakevideocapturer.h" 19 #include "webrtc/media/base/fakevideocapturer.h"
18 #include "webrtc/media/base/fakevideorenderer.h" 20 #include "webrtc/media/base/fakevideorenderer.h"
19 #include "webrtc/media/base/testutils.h" 21 #include "webrtc/media/base/testutils.h"
20 #include "webrtc/media/base/videocapturer.h" 22 #include "webrtc/media/base/videocapturer.h"
21 23
(...skipping 11 matching lines...) Expand all
33 : public sigslot::has_slots<>, 35 : public sigslot::has_slots<>,
34 public testing::Test { 36 public testing::Test {
35 public: 37 public:
36 VideoCapturerTest() 38 VideoCapturerTest()
37 : capture_state_(cricket::CS_STOPPED), num_state_changes_(0) { 39 : capture_state_(cricket::CS_STOPPED), num_state_changes_(0) {
38 InitCapturer(false); 40 InitCapturer(false);
39 } 41 }
40 42
41 protected: 43 protected:
42 void InitCapturer(bool is_screencast) { 44 void InitCapturer(bool is_screencast) {
43 capturer_ = rtc::scoped_ptr<FakeVideoCapturer>( 45 capturer_ = std::unique_ptr<FakeVideoCapturer>(
44 new FakeVideoCapturer(is_screencast)); 46 new FakeVideoCapturer(is_screencast));
45 capturer_->SignalStateChange.connect(this, 47 capturer_->SignalStateChange.connect(this,
46 &VideoCapturerTest::OnStateChange); 48 &VideoCapturerTest::OnStateChange);
47 capturer_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); 49 capturer_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants());
48 } 50 }
49 void InitScreencast() { InitCapturer(true); } 51 void InitScreencast() { InitCapturer(true); }
50 52
51 void OnStateChange(cricket::VideoCapturer*, 53 void OnStateChange(cricket::VideoCapturer*,
52 cricket::CaptureState capture_state) { 54 cricket::CaptureState capture_state) {
53 capture_state_ = capture_state; 55 capture_state_ = capture_state;
54 ++num_state_changes_; 56 ++num_state_changes_;
55 } 57 }
56 cricket::CaptureState capture_state() { return capture_state_; } 58 cricket::CaptureState capture_state() { return capture_state_; }
57 int num_state_changes() { return num_state_changes_; } 59 int num_state_changes() { return num_state_changes_; }
58 60
59 rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer_; 61 std::unique_ptr<cricket::FakeVideoCapturer> capturer_;
60 cricket::CaptureState capture_state_; 62 cricket::CaptureState capture_state_;
61 int num_state_changes_; 63 int num_state_changes_;
62 cricket::FakeVideoRenderer renderer_; 64 cricket::FakeVideoRenderer renderer_;
63 bool expects_rotation_applied_; 65 bool expects_rotation_applied_;
64 }; 66 };
65 67
66 TEST_F(VideoCapturerTest, CaptureState) { 68 TEST_F(VideoCapturerTest, CaptureState) {
67 EXPECT_TRUE(capturer_->enable_video_adapter()); 69 EXPECT_TRUE(capturer_->enable_video_adapter());
68 EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(cricket::VideoFormat( 70 EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(cricket::VideoFormat(
69 640, 71 640,
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 capturer_->set_enable_camera_list(true); 800 capturer_->set_enable_camera_list(true);
799 capturer_->ConstrainSupportedFormats(vga_format); 801 capturer_->ConstrainSupportedFormats(vga_format);
800 EXPECT_EQ(2u, capturer_->GetSupportedFormats()->size()); 802 EXPECT_EQ(2u, capturer_->GetSupportedFormats()->size());
801 // To make sure it's not just the camera list being broken, add in VGA and 803 // To make sure it's not just the camera list being broken, add in VGA and
802 // try again. This time, only the VGA format should be there. 804 // try again. This time, only the VGA format should be there.
803 supported_formats.push_back(vga_format); 805 supported_formats.push_back(vga_format);
804 capturer_->ResetSupportedFormats(supported_formats); 806 capturer_->ResetSupportedFormats(supported_formats);
805 ASSERT_EQ(1u, capturer_->GetSupportedFormats()->size()); 807 ASSERT_EQ(1u, capturer_->GetSupportedFormats()->size());
806 EXPECT_EQ(vga_format.height, capturer_->GetSupportedFormats()->at(0).height); 808 EXPECT_EQ(vga_format.height, capturer_->GetSupportedFormats()->at(0).height);
807 } 809 }
OLDNEW
« no previous file with comments | « webrtc/media/base/videobroadcaster.h ('k') | webrtc/media/engine/webrtcvoe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698