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

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: In WebRtcVideoSendStream::SetOptions, modify only options specified by the caller. 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..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/25 06:57:06 I still don't like the name. How about two method
nisse-webrtc 2016/02/25 08:59:35 I've renamed the shared method to InitCapturer(boo
+ 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(),
« 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