fast/mediastream/RTCPeerConnection-icecandidate-event.html is flaky
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Apr 2017 04:24:21 +0000 (04:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Apr 2017 04:24:21 +0000 (04:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171242

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-25
Reviewed by Alex Christensen.

* TestExpectations:
* fast/mediastream/RTCPeerConnection-icecandidate-event-expected.txt:
* fast/mediastream/RTCPeerConnection-icecandidate-event.html: Updating test to be more deterministic.

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/mediastream/RTCPeerConnection-icecandidate-event-expected.txt
LayoutTests/fast/mediastream/RTCPeerConnection-icecandidate-event.html

index 9530105..9cafb1f 100644 (file)
@@ -1,3 +1,14 @@
+2017-04-25  Youenn Fablet  <youenn@apple.com>
+
+        fast/mediastream/RTCPeerConnection-icecandidate-event.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=171242
+
+        Reviewed by Alex Christensen.
+
+        * TestExpectations:
+        * fast/mediastream/RTCPeerConnection-icecandidate-event-expected.txt:
+        * fast/mediastream/RTCPeerConnection-icecandidate-event.html: Updating test to be more deterministic.
+
 2017-04-25  Brent Fulgham  <bfulgham@apple.com>
 
         Relax the event firing ASSERT for Attr changes
index 296ff63..ceee8e4 100644 (file)
@@ -733,7 +733,6 @@ fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html [ Skip ]
 fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html [ Skip ]
 fast/mediastream/RTCPeerConnection-overloaded-operations-params.html [ Skip ]
 fast/mediastream/RTCRtpSender-replaceTrack.html [ Skip ]
-fast/mediastream/RTCPeerConnection-icecandidate-event.html [ Pass Failure ]
 fast/mediastream/RTCPeerConnection-dtmf.html [ Failure ]
 # libwebrtc backend doesn't generate a=bundle-only lines
 fast/mediastream/RTCPeerConnection-inspect-offer-bundlePolicy-bundle-only.html [ Failure ]
index 5cfa871..2851ac9 100644 (file)
@@ -3,25 +3,25 @@ Test RTCPeerConnection 'icecandidate' event and gathering done
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS Got candidate
-PASS event.candidate instanceof RTCIceCandidate is true
-PASS event.candidate.sdpMLineIndex is 0
-FAIL event.candidate.sdpMid should be null (of type object). Was 1 (of type string).
-PASS event.candidate.candidate: 2013266431 1 udp 2013266432 192.168.0.100 38838 typ host generation 0
 PASS Local description set
 PASS End of test promise chain
 PASS Got candidate
-PASS event.candidate instanceof RTCIceCandidate is true
-PASS event.candidate.sdpMLineIndex is 0
-FAIL event.candidate.sdpMid should be null (of type object). Was 1 (of type string).
-PASS event.candidate.candidate: 1019216383 1 tcp 1019216384 192.168.0.100 9 typ host tcptype passive generation 0
+PASS candidate instanceof RTCIceCandidate is true
+PASS candidate.sdpMLineIndex is 0
+FAIL candidate.sdpMid should be null (of type object). Was 1 (of type string).
+PASS candidate.candidate: 2013266431 1 udp 2013266432 192.168.0.100 38838 typ host generation 0
+PASS Got candidate
+PASS candidate instanceof RTCIceCandidate is true
+PASS candidate.sdpMLineIndex is 0
+FAIL candidate.sdpMid should be null (of type object). Was 1 (of type string).
+PASS candidate.candidate: 1019216383 1 tcp 1019216384 192.168.0.100 9 typ host tcptype passive generation 0
 PASS Got candidate
-PASS event.candidate instanceof RTCIceCandidate is true
-PASS event.candidate.sdpMLineIndex is 0
-FAIL event.candidate.sdpMid should be null (of type object). Was 1 (of type string).
-PASS event.candidate.candidate: 1677722111 1 tcp 1677722112 172.18.0.1 47989 typ srflx raddr 192.168.0.100 rport 47989 generation 0
+PASS candidate instanceof RTCIceCandidate is true
+PASS candidate.sdpMLineIndex is 0
+FAIL candidate.sdpMid should be null (of type object). Was 1 (of type string).
+PASS candidate.candidate: 1677722111 1 tcp 1677722112 172.18.0.1 47989 typ srflx raddr 192.168.0.100 rport 47989 generation 0
 PASS Got end of candidates
-PASS event.candidate is null
+PASS candidate is null
 PASS successfullyParsed is true
 
 TEST COMPLETE
index effa94a..48488d5 100644 (file)
@@ -6,8 +6,6 @@
     </head>
     <body>
         <script>
-            let event;
-
             description("Test RTCPeerConnection 'icecandidate' event and gathering done");
 
             if (window.internals)
 
             const pc = new RTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
 
+            var candidates = [];
+            var shouldDoChecking = false;
+            var reachedEndOfCandidates = false;
             pc.onicecandidate = function (evt) {
-                event = evt;
-                if (evt.candidate) {
+                candidates.push(evt.candidate);
+                if (!evt.candidate)
+                    reachedEndOfCandidates = true;
+                checkCandidates();
+            };
+
+            function checkCandidates() {
+              if (!shouldDoChecking || !reachedEndOfCandidates)
+                return;
+              for (candidate of candidates) {
+                if (candidate) {
                     testPassed("Got candidate");
-                    shouldBeTrue("event.candidate instanceof RTCIceCandidate");
-                    shouldBe("event.candidate.sdpMLineIndex", "0");
-                    shouldBe("event.candidate.sdpMid", "pc.getTransceivers()[0].mid");
-                    testPassed(`event.candidate.candidate: ${event.candidate.candidate}`);
+                    shouldBeTrue("candidate instanceof RTCIceCandidate");
+                    shouldBe("candidate.sdpMLineIndex", "0");
+                    shouldBe("candidate.sdpMid", "pc.getTransceivers()[0].mid");
+                    testPassed(`candidate.candidate: ${candidate.candidate}`);
                 } else {
                     testPassed("Got end of candidates");
-                    shouldBeNull("event.candidate");
-                    finishJSTest();
+                    shouldBeNull("candidate");
                 }
-            };
+              }
+              finishJSTest();
+            }
 
             navigator.mediaDevices.getUserMedia({ "video": true }).then(function (stream) {
                 pc.addTrack(stream.getTracks()[0], stream);
                 return pc.createOffer();
-            })
-            .then(function (offer) {
+            }).then(function (offer) {
                 return pc.setLocalDescription(offer);
-            })
-            .then(function () {
+            }).then(function () {
                 testPassed("Local description set");
-                window.internals.emulateRTCPeerConnectionPlatformEvent(pc, "dispatch-fake-ice-candidates");
                 testPassed("End of test promise chain");
-            })
-            .catch(function (error) {
+                if (window.internals)
+                    window.internals.emulateRTCPeerConnectionPlatformEvent(pc, "dispatch-fake-ice-candidates");
+                shouldDoChecking = true;
+                checkCandidates();
+            }).catch(function (error) {
                 testFailed("Error in promise chain: " + error);
                 finishJSTest();
             });