Title: [260901] trunk/LayoutTests
Revision
260901
Author
[email protected]
Date
2020-04-29 09:50:46 -0700 (Wed, 29 Apr 2020)

Log Message

http/tests/media/media-stream/device-change-event-in-iframe.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=211119
<rdar://problem/62457151>

Reviewed by Eric Carlson.

Make sure duplicate ondevicechange events do not create flakiness.

* http/tests/media/media-stream/device-change-event-in-iframe-expected.txt:
* http/tests/media/media-stream/device-change-event-in-iframe.html:
* http/tests/media/media-stream/resources/device-change-iframe.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260900 => 260901)


--- trunk/LayoutTests/ChangeLog	2020-04-29 16:17:06 UTC (rev 260900)
+++ trunk/LayoutTests/ChangeLog	2020-04-29 16:50:46 UTC (rev 260901)
@@ -1,3 +1,17 @@
+2020-04-29  Youenn Fablet  <[email protected]>
+
+        http/tests/media/media-stream/device-change-event-in-iframe.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=211119
+        <rdar://problem/62457151>
+
+        Reviewed by Eric Carlson.
+
+        Make sure duplicate ondevicechange events do not create flakiness.
+
+        * http/tests/media/media-stream/device-change-event-in-iframe-expected.txt:
+        * http/tests/media/media-stream/device-change-event-in-iframe.html:
+        * http/tests/media/media-stream/resources/device-change-iframe.html:
+
 2020-04-29  Kate Cheney  <[email protected]>
 
         Refactor layout tests after updates to In-App Browser Privacy

Modified: trunk/LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe-expected.txt (260900 => 260901)


--- trunk/LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe-expected.txt	2020-04-29 16:17:06 UTC (rev 260900)
+++ trunk/LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe-expected.txt	2020-04-29 16:50:46 UTC (rev 260901)
@@ -1,8 +1,5 @@
      
-<iframe id=camera> got a 'devicechange' event
-<iframe id=main> got a 'devicechange' event
-<iframe id=microphone> got a 'devicechange' event
-<iframe id=same-origin> got a 'devicechange' event
-
-PASS: 'devicechange' only fired on frames with access to devices
-
+PASS: <iframe id=camera> got a 'devicechange' event
+PASS: <iframe id=main> got a 'devicechange' event
+PASS: <iframe id=microphone> got a 'devicechange' event
+PASS: <iframe id=same-origin> got a 'devicechange' event

Modified: trunk/LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe.html (260900 => 260901)


--- trunk/LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe.html	2020-04-29 16:17:06 UTC (rev 260900)
+++ trunk/LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe.html	2020-04-29 16:50:46 UTC (rev 260901)
@@ -2,10 +2,10 @@
 <html>
 <script src=""
 <body _onload_="start()">
-    <iframe id="none"" src=""
-    <iframe id="camera" allow="camera" src=""
-    <iframe id="microphone" allow="camera" src=""
-    <iframe id="same-origin" src=""
+    <iframe id="none"" src=""
+    <iframe id="camera" allow="camera" src=""
+    <iframe id="microphone" allow="camera" src=""
+    <iframe id="same-origin" src=""
 
     <script>
 
@@ -12,7 +12,6 @@
         if (window.testRunner) {
             testRunner.dumpAsText();
             testRunner.waitUntilDone();
-            testRunner.setUserMediaPermission(true);
         }
 
         let count = new Set();
@@ -20,18 +19,16 @@
         let results = [];
         function countEvent(id)
         {
-            results.push(`&LT;iframe id=${id}> got a 'devicechange' event`);
-            if (id == "none") {
-                result.innerHTML += `FAIL: &LT;iframe id=${id}> got 'devicechange' event<br>`;
-                success = false;
-            } else
-                count.add(id);
+            if (count.has(id))
+                return;
 
-            if (count.size == 4) {
+            count.add(id);
+            const status = id === "none" ? "FAIL": "PASS";
+            results.push(`${status}: &LT;iframe id=${id}> got a 'devicechange' event`);
+
+            if (results.length == 4) {
                 setTimeout(() => {
                     result.innerHTML = results.sort().join('<br>');
-                    if (success)
-                        result.innerHTML += "<br><br>PASS: 'devicechange' only fired on frames with access to devices<br>";
                     if (window.testRunner) {
                         testRunner.notifyDone();
                         testRunner.resetMockMediaDevices();
@@ -43,19 +40,13 @@
         async function start()
         {
             await window.navigator.mediaDevices.getUserMedia({audio:true});
+
+            navigator.mediaDevices._ondevicechange_ = () => { countEvent('main'); };
+            window._onmessage_ = (event) => { countEvent(event.data); };
+
             if (window.testRunner)
                 testRunner.addMockMicrophoneDevice("id4", "microphone 3");
         }
-
-        window._onmessage_ = (event) => { countEvent(event.data); };
-        navigator.mediaDevices._ondevicechange_ = (event) => { countEvent('main'); };
-
-        Array.from(document.getElementsByTagName('iframe')).forEach(element => {
-            element._onload_ = (evt) => { 
-                evt.target.contentWindow.postMessage(evt.target.id, '*'); 
-            }
-        });
-
     </script>
 
     <div id="result"></div>

Modified: trunk/LayoutTests/http/tests/media/media-stream/resources/device-change-iframe.html (260900 => 260901)


--- trunk/LayoutTests/http/tests/media/media-stream/resources/device-change-iframe.html	2020-04-29 16:17:06 UTC (rev 260900)
+++ trunk/LayoutTests/http/tests/media/media-stream/resources/device-change-iframe.html	2020-04-29 16:50:46 UTC (rev 260901)
@@ -1,12 +1,5 @@
 <script>
-    let myID;
     navigator.mediaDevices._ondevicechange_ = (event) => {
-        parent.postMessage(myID, '*');
-        result.innerHTML = `${myID} got 'devicechange' event`;
+        parent.postMessage(location.search.substring(1), '*');
     };
-    window.addEventListener("message", (event) => { myID = event.data; });
 </script>
-
-<div id='result'></div>
-
-
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to