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

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

Issue 2969093002: Make rendering of MediaStreams reflect changes to its set of tracks. (Closed)
Patch Set: rebase and address comments by foolip@ 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..1b4fc78ed3a93bfbabfb6f4a07bf7278523b6529 100644
--- a/content/test/data/media/getusermedia.html
+++ b/content/test/data/media/getusermedia.html
@@ -556,6 +556,92 @@
}
var detectorInterval = setInterval(detectorFunction, 50);
}
+
+ function srcObjectAddVideoTrack() {
+ var video = document.createElement('video');
+ video.autoplay = true;
+ assertEquals(video.srcObject, null);
+ 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(stream.getVideoTracks()[0]);
+ }
+ 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);
+ 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);
+ stream.removeTrack(stream.getVideoTracks()[0]);
+ }
+ video.srcObject = stream;
+ })
+ .catch(e => {
+ failTest("Unexpected error: " + e)
+ });
+ }
+
+ function srcObjectReassignSameObject() {
foolip 2017/07/05 13:13:52 This would be possible to test in web-platform-tes
+ var video = document.createElement('video');
+ video.autoplay = true;
+ assertEquals(video.srcObject, null);
+ navigator.mediaDevices.getUserMedia({audio: true, video: true})
+ .then(stream => {
+ video.onplaying = function() {
+ video.onplaying = null;
+ video.onloadstart = function() {
+ reportTestSuccess();
+ }
+ assertNotEquals(video.srcObject, null);
+ assertTrue(video.videoWidth > 0);
+ assertTrue(video.videoHeight > 0);
+ // Reassigning the same object should trigger the load algorithm.
+ video.srcObject = video.srcObject;
+ }
+ video.srcObject = stream;
+ })
+ .catch(e => {
+ failTest("Unexpected error: " + e)
+ });
+ }
</script>
</head>
<body>

Powered by Google App Engine
This is Rietveld 408576698