Title: [222447] trunk/LayoutTests
Revision
222447
Author
[email protected]
Date
2017-09-25 09:01:47 -0700 (Mon, 25 Sep 2017)

Log Message

webrtc/peer-connection-audio-mute.html is sometimes flaky
https://bugs.webkit.org/show_bug.cgi?id=172649

Patch by Youenn Fablet <[email protected]> on 2017-09-25
Reviewed by Darin Adler.

Iterating until getting the expected result to make test more stable.

* webrtc/peer-connection-audio-mute.html:
* webrtc/peer-connection-remote-audio-mute.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (222446 => 222447)


--- trunk/LayoutTests/ChangeLog	2017-09-25 16:00:42 UTC (rev 222446)
+++ trunk/LayoutTests/ChangeLog	2017-09-25 16:01:47 UTC (rev 222447)
@@ -1,5 +1,17 @@
 2017-09-25  Youenn Fablet  <[email protected]>
 
+        webrtc/peer-connection-audio-mute.html is sometimes flaky
+        https://bugs.webkit.org/show_bug.cgi?id=172649
+
+        Reviewed by Darin Adler.
+
+        Iterating until getting the expected result to make test more stable.
+
+        * webrtc/peer-connection-audio-mute.html:
+        * webrtc/peer-connection-remote-audio-mute.html:
+
+2017-09-25  Youenn Fablet  <[email protected]>
+
         Make captureCanvas-webrtc.html more robust
         https://bugs.webkit.org/show_bug.cgi?id=177334
 

Modified: trunk/LayoutTests/webrtc/peer-connection-audio-mute.html (222446 => 222447)


--- trunk/LayoutTests/webrtc/peer-connection-audio-mute.html	2017-09-25 16:00:42 UTC (rev 222446)
+++ trunk/LayoutTests/webrtc/peer-connection-audio-mute.html	2017-09-25 16:01:47 UTC (rev 222447)
@@ -14,10 +14,25 @@
         if (window.testRunner)
             testRunner.setUserMediaPermission(true);
 
+        var remoteStream;
+        async function checkForSound(expected, message, count)
+        {
+            if (count === undefined)
+                count = 0;
+
+            var results = await analyseAudio(remoteStream, 200, context);
+            if (results.heardHum === expected)
+                return;
+            if (count > 50)
+                return Promise.reject("checkForSound timed out when testing: " + message);
+
+            await waitFor(100);
+            return checkForSound(expected, message, ++count);
+        }
+
         var localTrack;
         return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => {
             localTrack = localStream.getAudioTracks()[0];
-            var remoteStream;
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
                     firstConnection.addTrack(localTrack, localStream);
@@ -28,18 +43,12 @@
                     };
                 });
             }).then(() => {
-                return waitFor(500);
+                return checkForSound(true, "should hear hum from remote enabled track");
             }).then(() => {
-                return analyseAudio(remoteStream, 500, context).then((results) => {
-                    assert_true(results.heardHum, "heard hum from remote enabled track");
-                });
-            }).then(() => {
                 localTrack.enabled = false;
-                return waitFor(500);
+                return waitFor(100);
             }).then(() => {
-                return analyseAudio(remoteStream, 500, context).then((results) => {
-                    assert_false(results.heardHum, "not heard hum from remote disabled track");
-                });
+                return checkForSound(false, "should not hear hum from remote enabled track");
             }).then(() => {
                 return context.close();
             });

Modified: trunk/LayoutTests/webrtc/peer-connection-remote-audio-mute.html (222446 => 222447)


--- trunk/LayoutTests/webrtc/peer-connection-remote-audio-mute.html	2017-09-25 16:00:42 UTC (rev 222446)
+++ trunk/LayoutTests/webrtc/peer-connection-remote-audio-mute.html	2017-09-25 16:01:47 UTC (rev 222447)
@@ -9,7 +9,24 @@
 <body>
     <script src =""
     <script>
+
     var context = new webkitAudioContext();
+    var remoteStream;
+    async function checkForSound(expected, message, count)
+    {
+        if (count === undefined)
+            count = 0;
+
+        var results = await analyseAudio(remoteStream, 200, context);
+        if (results.heardHum === expected)
+            return;
+        if (count > 50)
+            return Promise.reject("checkForSound timed out when testing: " + message);
+
+        await waitFor(100);
+        return checkForSound(expected, message, ++count);
+    }
+
     promise_test((test) => {
         if (window.testRunner)
             testRunner.setUserMediaPermission(true);
@@ -16,7 +33,6 @@
 
         return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => {
             var remoteTrack;
-            var remoteStream;
             return new Promise((resolve, reject) => {
                 createConnections((firstConnection) => {
                     firstConnection.addTrack(localStream.getAudioTracks()[0], localStream);
@@ -28,16 +44,12 @@
                     };
                 });
             }).then(() => {
-                return analyseAudio(remoteStream, 200, context).then((results) => {
-                    assert_true(results.heardHum, "heard hum from remote enabled track");
-                });
+                return checkForSound(true, "should hear hum from remote enabled track");
             }).then(() => {
                 remoteTrack.enabled = false;
                 return waitFor(100);
             }).then(() => {
-                return analyseAudio(remoteStream, 200, context).then((results) => {
-                    assert_false(results.heardHum, "not heard hum from remote disabled track");
-                });
+                return checkForSound(false, "should not hear hum from remote disabled track");
             }).then(() => {
                 return context.close();
             });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to