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

Unified Diff: webrtc/api/videosource_unittest.cc

Issue 1711763003: New flag is_screencast in VideoOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix use-after-free of FakeVideoSendStream. Created 4 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 side-by-side diff with in-line comments
Download patch
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(),

Powered by Google App Engine
This is Rietveld 408576698