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

Unified Diff: webrtc/api/videotrack_unittest.cc

Issue 1790633002: Propagate MediaStreamSource state to video tracks the same way as audio. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@refactor_track
Patch Set: Fix bug with wrong enum values. Created 4 years, 9 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/videotrack.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/videotrack_unittest.cc
diff --git a/webrtc/api/videotrack_unittest.cc b/webrtc/api/videotrack_unittest.cc
index 6dac507020321b1abd6f0f9866791247fa577a0e..0df8679ddcd64068c510294bec20055c61fe6566 100644
--- a/webrtc/api/videotrack_unittest.cc
+++ b/webrtc/api/videotrack_unittest.cc
@@ -21,19 +21,19 @@
using webrtc::FakeVideoTrackRenderer;
using webrtc::FakeVideoTrackRendererOld;
+using webrtc::MediaSourceInterface;
+using webrtc::MediaStreamTrackInterface;
using webrtc::VideoTrackSource;
using webrtc::VideoTrack;
using webrtc::VideoTrackInterface;
-
class VideoTrackTest : public testing::Test {
public:
VideoTrackTest() {
static const char kVideoTrackId[] = "track_id";
- video_track_ = VideoTrack::Create(
- kVideoTrackId,
- new rtc::RefCountedObject<VideoTrackSource>(
- &capturer_, rtc::Thread::Current(), true /* remote */));
+ video_track_source_ = new rtc::RefCountedObject<VideoTrackSource>(
+ &capturer_, rtc::Thread::Current(), true /* remote */);
+ video_track_ = VideoTrack::Create(kVideoTrackId, video_track_source_);
capturer_.Start(
cricket::VideoFormat(640, 480, cricket::VideoFormat::FpsToInterval(30),
cricket::FOURCC_I420));
@@ -41,9 +41,17 @@ class VideoTrackTest : public testing::Test {
protected:
cricket::FakeVideoCapturer capturer_;
+ rtc::scoped_refptr<VideoTrackSource> video_track_source_;
rtc::scoped_refptr<VideoTrackInterface> video_track_;
};
+// Test changing the source state also changes the track state.
+TEST_F(VideoTrackTest, SourceStateChangeTrackState) {
+ EXPECT_EQ(MediaStreamTrackInterface::kLive, video_track_->state());
+ video_track_source_->SetState(MediaSourceInterface::kEnded);
+ EXPECT_EQ(MediaStreamTrackInterface::kEnded, video_track_->state());
+}
+
// Test adding renderers to a video track and render to them by providing
// frames to the source.
TEST_F(VideoTrackTest, RenderVideo) {
« no previous file with comments | « webrtc/api/videotrack.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698