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

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 OnLoadUpdate is_screencast check. Don't set FakeVideoCapturer into screencast mode in the video… 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
« no previous file with comments | « webrtc/api/videosource.cc ('k') | webrtc/media/base/fakevideocapturer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/videosource_unittest.cc
diff --git a/webrtc/api/videosource_unittest.cc b/webrtc/api/videosource_unittest.cc
index 2d163ef9a053693d9ecb0c63ae30e02c94f03d93..cd4ca3ae3da324fa2c9412a4f148ac600bb30f07 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,11 +112,17 @@ 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())) {
+ InitCapturer(false);
}
+ void InitCapturer(bool is_screencast) {
+ capturer_cleanup_ = rtc::scoped_ptr<TestVideoCapturer>(
+ new TestVideoCapturer(is_screencast));
+ capturer_ = capturer_cleanup_.get();
+ }
+
+ void InitScreencast() { InitCapturer(true); }
void SetUp() {
ASSERT_TRUE(channel_manager_->Init());
@@ -473,8 +481,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();
capturer_->TestWithoutCameraFormats();
- capturer_->SetScreencast(true);
CreateVideoSource();
EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
@@ -493,8 +501,8 @@ TEST_F(VideoSourceTest, ScreencastResolutionWithConstraint) {
constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 480);
constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 270);
+ InitScreencast();
capturer_->TestWithoutCameraFormats();
- capturer_->SetScreencast(true);
CreateVideoSource(&constraints);
EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
« no previous file with comments | « webrtc/api/videosource.cc ('k') | webrtc/media/base/fakevideocapturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698