Chromium Code Reviews| Index: webrtc/api/videosource_unittest.cc |
| diff --git a/webrtc/api/videosource_unittest.cc b/webrtc/api/videosource_unittest.cc |
| index 2d163ef9a053693d9ecb0c63ae30e02c94f03d93..aaa7e13bbdec24460130d8197559e5d8a3edb37d 100644 |
| --- a/webrtc/api/videosource_unittest.cc |
| +++ b/webrtc/api/videosource_unittest.cc |
| @@ -42,7 +42,9 @@ const int kMaxWaitMs = 100; |
| // file. |
| class TestVideoCapturer : public cricket::FakeVideoCapturer { |
| public: |
| - TestVideoCapturer() : test_without_formats_(false) { |
| + TestVideoCapturer(bool is_screencast) |
| + : FakeVideoCapturer(is_screencast), |
| + test_without_formats_(false) { |
| std::vector<cricket::VideoFormat> formats; |
| formats.push_back(cricket::VideoFormat(1280, 720, |
| cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); |
| @@ -110,10 +112,14 @@ class StateObserver : public ObserverInterface { |
| class VideoSourceTest : public testing::Test { |
| protected: |
| VideoSourceTest() |
| - : capturer_cleanup_(new TestVideoCapturer()), |
| - capturer_(capturer_cleanup_.get()), |
| - channel_manager_(new cricket::ChannelManager( |
| + : channel_manager_(new cricket::ChannelManager( |
| new cricket::FakeMediaEngine(), rtc::Thread::Current())) { |
| + InitScreencast(false); |
| + } |
| + void InitScreencast(bool is_screencast) { |
|
pthatcher1
2016/02/20 08:32:59
Why isn't this just called Init?
perkj_webrtc
2016/02/21 18:09:06
or CreateVideoCapturer
nisse-webrtc
2016/02/22 07:52:34
Only because when calling it, InitScreencast(true)
|
| + capturer_cleanup_ = rtc::scoped_ptr<TestVideoCapturer>( |
| + new TestVideoCapturer(is_screencast)); |
| + capturer_ = capturer_cleanup_.get(); |
| } |
| void SetUp() { |
| @@ -473,8 +479,8 @@ TEST_F(VideoSourceTest, MixedOptionsAndConstraints) { |
| // Tests that the source starts video with the default resolution for |
| // screencast if no constraint is set. |
| TEST_F(VideoSourceTest, ScreencastResolutionNoConstraint) { |
| + InitScreencast(true); |
| capturer_->TestWithoutCameraFormats(); |
| - capturer_->SetScreencast(true); |
| CreateVideoSource(); |
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
| @@ -493,8 +499,8 @@ TEST_F(VideoSourceTest, ScreencastResolutionWithConstraint) { |
| constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 480); |
| constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 270); |
| + InitScreencast(true); |
| capturer_->TestWithoutCameraFormats(); |
| - capturer_->SetScreencast(true); |
| CreateVideoSource(&constraints); |
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |