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

Unified Diff: content/test/data/media/getusermedia.html

Issue 2969093002: Make rendering of MediaStreams reflect changes to its set of tracks. (Closed)
Patch Set: Created 3 years, 5 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: content/test/data/media/getusermedia.html
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
index e39912f06670b6380026a0016b87689c807435f7..11622f6f45a81736cb072eafe8757a21a5c168cf 100644
--- a/content/test/data/media/getusermedia.html
+++ b/content/test/data/media/getusermedia.html
@@ -556,6 +556,72 @@
}
var detectorInterval = setInterval(detectorFunction, 50);
}
+
+ function srcObjectAddVideoTrack() {
+ var video = document.createElement('video');
+ video.autoplay = true;
+ assertEquals(video.srcObject, null);
+ var full_stream;
+ navigator.mediaDevices.getUserMedia({audio: true, video: true})
+ .then(stream => {
+ video.onplaying = function() {
+ video.onplaying = null;
+ video.onloadstart = function() {
+ failTest("loadstart should not be called");
+ }
+
+ video.onresize = function() {
+ assertNotEquals(video.srcObject, null);
+ assertTrue(video.videoHeight > 0);
+ assertTrue(video.videoWidth > 0);
+ reportTestSuccess();
+ }
+
+ assertNotEquals(video.srcObject, null);
+ assertEquals(video.videoWidth, 0);
+ assertEquals(video.videoHeight, 0);
+ video.srcObject.addTrack(full_stream.getVideoTracks()[0]);
+ }
+ full_stream = stream;
+ video.srcObject = new MediaStream(stream.getAudioTracks());
+ })
+ .catch(e => {
+ failTest("Unexpected error: " + e)
+ });
+ }
+
+ function srcObjectRemoveVideoTrack() {
+ var video = document.createElement('video');
+ video.autoplay = true;
+ assertEquals(video.srcObject, null);
+ var original_stream;
+ navigator.mediaDevices.getUserMedia({audio: true, video: true})
+ .then(stream => {
+ video.onplaying = function() {
+ video.onplaying = null;
+ video.onloadstart = function() {
+ failTest("loadstart should not be called");
+ }
+
+ video.onresize = function() {
+ assertNotEquals(video.srcObject, null);
+ assertEquals(0, video.videoHeight);
+ assertEquals(0, video.videoWidth);
+ reportTestSuccess();
+ }
+
+ assertNotEquals(video.srcObject, null);
+ assertTrue(video.videoWidth > 0);
+ assertTrue(video.videoHeight > 0);
+ original_stream.removeTrack(original_stream.getVideoTracks()[0]);
+ }
+ original_stream = stream;
foolip 2017/07/05 08:49:44 original_stream===stream at every point in time af
Guido Urdaneta 2017/07/05 13:05:02 Done. Also for |full_stream| in the other test.
+ video.srcObject = stream;
+ })
+ .catch(e => {
+ failTest("Unexpected error: " + e)
+ });
+ }
</script>
</head>
<body>

Powered by Google App Engine
This is Rietveld 408576698