Migrating webrtc tests to latest API
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Apr 2017 22:47:26 +0000 (22:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Apr 2017 22:47:26 +0000 (22:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170709

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-11
Reviewed by Eric Carlson.

* webrtc/audio-peer-connection-webaudio.html:
* webrtc/libwebrtc/descriptionGetters.html:
* webrtc/negotiatedneeded-event-addStream.html:
* webrtc/peer-connection-audio-mute.html:
* webrtc/peer-connection-audio-mute2.html:
* webrtc/peer-connection-remote-audio-mute.html:
* webrtc/peer-connection-remote-audio-mute2.html:
* webrtc/release-after-getting-track.html:
* webrtc/video-disabled-black.html:
* webrtc/video-mute.html:
* webrtc/video-remote-mute.html:
* webrtc/video-with-receiver.html:
* webrtc/video.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215251 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
LayoutTests/ChangeLog
LayoutTests/webrtc/audio-peer-connection-webaudio.html
LayoutTests/webrtc/libwebrtc/descriptionGetters.html
LayoutTests/webrtc/negotiatedneeded-event-addStream.html
LayoutTests/webrtc/peer-connection-audio-mute.html
LayoutTests/webrtc/peer-connection-audio-mute2.html
LayoutTests/webrtc/peer-connection-remote-audio-mute.html
LayoutTests/webrtc/peer-connection-remote-audio-mute2.html
LayoutTests/webrtc/release-after-getting-track.html
LayoutTests/webrtc/video-disabled-black.html
LayoutTests/webrtc/video-mute.html
LayoutTests/webrtc/video-remote-mute.html
LayoutTests/webrtc/video-with-receiver.html
LayoutTests/webrtc/video.html

index 502fc06..6c3caba 100644 (file)
@@ -1,5 +1,26 @@
 2017-04-11  Youenn Fablet  <youenn@apple.com>
 
+        Migrating webrtc tests to latest API
+        https://bugs.webkit.org/show_bug.cgi?id=170709
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/audio-peer-connection-webaudio.html:
+        * webrtc/libwebrtc/descriptionGetters.html:
+        * webrtc/negotiatedneeded-event-addStream.html:
+        * webrtc/peer-connection-audio-mute.html:
+        * webrtc/peer-connection-audio-mute2.html:
+        * webrtc/peer-connection-remote-audio-mute.html:
+        * webrtc/peer-connection-remote-audio-mute2.html:
+        * webrtc/release-after-getting-track.html:
+        * webrtc/video-disabled-black.html:
+        * webrtc/video-mute.html:
+        * webrtc/video-remote-mute.html:
+        * webrtc/video-with-receiver.html:
+        * webrtc/video.html:
+
+2017-04-11  Youenn Fablet  <youenn@apple.com>
+
         Activate WebRTC data channel tests for WK1
         https://bugs.webkit.org/show_bug.cgi?id=170710
 
index 550fd08..3d64c53 100644 (file)
@@ -14,9 +14,9 @@
         return navigator.mediaDevices.getUserMedia({audio: true}).then((stream) => {
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
-                    firstConnection.addStream(stream);
+                    firstConnection.addTrack(stream.getAudioTracks()[0], stream);
                 }, (secondConnection) => {
-                    secondConnection.onaddstream = (streamEvent) => { resolve(streamEvent.stream); };
+                    secondConnection.ontrack = (event) => { resolve(event.streams[0]); };
                 });
                 setTimeout(() => reject("Test timed out"), 5000);
             });
index 6a53c9a..805b39f 100644 (file)
@@ -17,7 +17,7 @@ promise_test((test) => {
      var currentSDP;
      return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
 
-        localConnection.addStream(stream);
+        localConnection.addTrack(stream.getVideoTracks()[0], stream);
         return localConnection.createOffer();
     }).then((desc) => {
         currentSDP = desc.sdp;
index b44d002..534f85d 100644 (file)
@@ -20,7 +20,7 @@ promise_test((test) => {
         return new Promise((resolve, reject) => {
             var pc = new RTCPeerConnection();
             pc.onnegotiationneeded = () => { resolve(); };
-            pc.addStream(stream);
+            pc.addTrack(stream.getVideoTracks()[0], stream);
         });
     });
 }, "on negotiation needed in case of adding a stream");
@@ -33,7 +33,7 @@ promise_test((test) => {
         return new Promise((resolve, reject) => {
             var pc = new RTCPeerConnection();
             pc.onnegotiationneeded = () => { reject(); };
-            pc.addStream(stream);
+            pc.addTrack(stream.getVideoTracks()[0], stream);
             pc.close();
             setTimeout(resolve, 500);
         });
index ec4f00a..83ad1e4 100644 (file)
             var remoteStream;
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
-                    firstConnection.addStream(localStream);
+                    firstConnection.addTrack(localTrack, localStream);
                 }, (secondConnection) => {
-                    secondConnection.onaddstream = (streamEvent) => {
-                        remoteStream = streamEvent.stream;
+                    secondConnection.ontrack = (trackEvent) => {
+                        remoteStream = trackEvent.streams[0];
                         resolve();
                     };
                 });
index d01298b..d906096 100644 (file)
             var remoteStream;
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
-                    firstConnection.addStream(localStream);
+                    firstConnection.addTrack(localTrack);
                 }, (secondConnection) => {
-                    secondConnection.onaddstream = (streamEvent) => {
-                        remoteStream = streamEvent.stream;
+                    secondConnection.ontrack = (trackEvent) => {
+                        remoteStream = trackEvent.streams[0];
                         resolve();
                     };
                 });
index 30cab82..2d342f4 100644 (file)
             var remoteStream;
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
-                    firstConnection.addStream(localStream);
+                    firstConnection.addTrack(localStream.getAudioTracks()[0], localStream);
                 }, (secondConnection) => {
-                    secondConnection.onaddstream = (streamEvent) => {
-                        remoteStream = streamEvent.stream;
+                    secondConnection.ontrack = (trackEvent) => {
+                        remoteStream = trackEvent.streams[0];
                         remoteTrack = remoteStream.getAudioTracks()[0];
                         resolve();
                     };
index fb90187..39247ce 100644 (file)
             var remoteStream;
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
-                    firstConnection.addStream(localStream);
+                    firstConnection.addTrack(localStream.getAudioTracks()[0]);
                 }, (secondConnection) => {
-                    secondConnection.onaddstream = (streamEvent) => {
-                        remoteStream = streamEvent.stream;
+                    secondConnection.ontrack = (trackEvent) => {
+                        remoteStream = trackEvent.streams[0];
                         remoteTrack = remoteStream.getAudioTracks()[0];
                         resolve();
                     };
index 431e9bb..983049e 100644 (file)
@@ -16,7 +16,8 @@ promise_test((test) => {
     return navigator.mediaDevices.getUserMedia({ video: true, audio: true}).then((stream) => {
         return new Promise((resolve, reject) => {
             createConnections((firstConnection) => {
-                firstConnection.addStream(stream);
+                firstConnection.addTrack(stream.getVideoTracks()[0], stream);
+                firstConnection.addTrack(stream.getAudioTracks()[0], stream);
             }, (secondConnection) => {
                 secondConnection.ontrack = resolve;
             });
index 4fe5791..72be54a 100644 (file)
@@ -53,9 +53,9 @@ promise_test((test) => {
             finishTest = resolve;
             errorTest = reject;
             createConnections((firstConnection) => {
-                firstConnection.addStream(stream);
+                firstConnection.addTrack(stream.getVideoTracks()[0], stream);
             }, (secondConnection) => {
-                secondConnection.onaddstream = (streamEvent) => { testStream(streamEvent.stream); };
+                secondConnection.ontrack = (trackEvent) => { testStream(trackEvent.streams[0]); };
             });
         });
     });
index 538755c..29b066d 100644 (file)
@@ -13,7 +13,6 @@
         <script>
 video = document.getElementById("video");
 canvas = document.getElementById("canvas");
-// FIXME: We should use tracks
 
 function isVideoBlack()
 {
@@ -41,9 +40,9 @@ promise_test((test) => {
             track = localStream.getVideoTracks()[0];
 
             createConnections((firstConnection) => {
-                firstConnection.addStream(localStream);
+                firstConnection.addTrack(track, localStream);
             }, (secondConnection) => {
-                secondConnection.onaddstream = (streamEvent) => { resolve(streamEvent.stream); };
+                secondConnection.ontrack = (trackEvent) => { resolve(trackEvent.streams[0]); };
             });
             setTimeout(() => reject("Test timed out"), 5000);
         });
index f198ce3..871e777 100644 (file)
@@ -13,7 +13,6 @@
         <script>
 video = document.getElementById("video");
 canvas = document.getElementById("canvas");
-// FIXME: We should use tracks
 
 function isVideoBlack()
 {
@@ -38,9 +37,9 @@ promise_test((test) => {
     return navigator.mediaDevices.getUserMedia({ video: true}).then((localStream) => {
         return new Promise((resolve, reject) => {
             createConnections((firstConnection) => {
-                firstConnection.addStream(localStream);
+                firstConnection.addTrack(localStream.getVideoTracks()[0], localStream);
             }, (secondConnection) => {
-                secondConnection.onaddstream = (streamEvent) => { resolve(streamEvent.stream); };
+                secondConnection.ontrack = (trackEvent) => { resolve(trackEvent.streams[0]); };
             });
             setTimeout(() => reject("Test timed out"), 5000);
         });
index 04102df..c0cf821 100644 (file)
@@ -46,7 +46,7 @@ promise_test((test) => {
     return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
         return new Promise((resolve, reject) => {
             createConnections((firstConnection) => {
-                firstConnection.addStream(stream);
+                firstConnection.addTrack(stream.getVideoTracks()[0], stream);
             }, (secondConnection) => {
                 resolve(secondConnection.addTransceiver("video").receiver.track);
             });
index cb7742a..3bb3b69 100644 (file)
@@ -46,7 +46,8 @@ promise_test((test) => {
     return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
         return new Promise((resolve, reject) => {
             createConnections((firstConnection) => {
-                firstConnection.addStream(stream);
+                var track = stream.getVideoTracks()[0];
+                firstConnection.addTrack(stream.getVideoTracks()[0], stream);
             }, (secondConnection) => {
                 secondConnection.ontrack = (trackEvent) => {
                     assert_true(trackEvent.track instanceof MediaStreamTrack);