Title: [258632] trunk/LayoutTests
Revision
258632
Author
[email protected]
Date
2020-03-18 08:11:09 -0700 (Wed, 18 Mar 2020)

Log Message

Update some fast/mediastream to make failures easier to diagnose.
https://bugs.webkit.org/show_bug.cgi?id=209205
<rdar://problem/60561372>

Log more state when a test fails.

Reviewed by Alex Christensen.

* fast/mediastream/MediaStream-video-element-displays-buffer.html:
* fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html:
* fast/mediastream/resize-trim.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (258631 => 258632)


--- trunk/LayoutTests/ChangeLog	2020-03-18 14:49:37 UTC (rev 258631)
+++ trunk/LayoutTests/ChangeLog	2020-03-18 15:11:09 UTC (rev 258632)
@@ -1,3 +1,17 @@
+2020-03-18  Eric Carlson  <[email protected]>
+
+        Update some fast/mediastream to make failures easier to diagnose.
+        https://bugs.webkit.org/show_bug.cgi?id=209205
+        <rdar://problem/60561372>
+
+        Log more state when a test fails.
+
+        Reviewed by Alex Christensen.
+
+        * fast/mediastream/MediaStream-video-element-displays-buffer.html:
+        * fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html:
+        * fast/mediastream/resize-trim.html:
+
 2020-03-18  Antoine Quint  <[email protected]>
 
         [ macOS iOS ] animations/play-state-paused.html is flaky failing

Modified: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html (258631 => 258632)


--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html	2020-03-18 14:49:37 UTC (rev 258631)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html	2020-03-18 15:11:09 UTC (rev 258632)
@@ -29,7 +29,19 @@
     {
         return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255;
     }
+    
+    function checkPixels(x, y, test, expectedToBeTrue)
+    {
+        buffer = context.getImageData(x, y, 1, 1).data;
+        if (expectedToBeTrue)
+            shouldBeTrue(`${test.name}(buffer)`);
+        else
+            shouldBeFalse(`${test.name}(buffer)`);
 
+        if (test(buffer) != expectedToBeTrue)
+            debug(`Found: {${buffer[0]}, ${buffer[1]}, ${buffer[2]}, ${buffer[3]}}`);
+    }
+
     function verifyFramesBeingDisplayed()
     {
         videos[currentTest].removeEventListener('playing', verifyFramesBeingDisplayed, false)
@@ -40,22 +52,16 @@
         context.clearRect(0, 0, canvas.width, canvas.height);
         let x = canvas.width * .035;
         let y = canvas.height * 0.6 + 2 + x;
-        buffer = context.getImageData(x, y, 1, 1).data;
-        shouldBeTrue('isPixelTransparent(buffer)');
+        checkPixels(x, y, isPixelTransparent, true)
         
         evalAndLog(`context.drawImage(videos[${currentTest}], 0, 0, ${canvas.width}, ${canvas.height})`);
-        buffer = context.getImageData(x, y, 1, 1).data;
-        shouldBeFalse('isPixelTransparent(buffer)');
-        shouldBeFalse('isPixelBlack(buffer)');
+        checkPixels(x, y, isPixelTransparent, false)
+        checkPixels(x, y, isPixelBlack, false)
 
         x = canvas.width * .05;
         y = canvas.height * .05;
-        buffer = context.getImageData(x, y, 1, 1).data;
-        shouldBeFalse('isPixelTransparent(buffer)');
-        if (!currentTest)
-            shouldBeTrue('isPixelBlack(buffer)');
-        else
-            shouldBeTrue('isPixelGray(buffer)');
+        checkPixels(x, y, isPixelTransparent, false)
+        checkPixels(x, y, currentTest ? isPixelGray : isPixelBlack, true)
 
         if (currentTest >= 1) {
             finishJSTest();

Modified: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html (258631 => 258632)


--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html	2020-03-18 14:49:37 UTC (rev 258631)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html	2020-03-18 15:11:09 UTC (rev 258632)
@@ -13,9 +13,21 @@
     let context;
     let mediaStream;
     let video;
+    let buffer;
     
-    let buffer;
+    let timeout;
 
+    function updateWatchdog()
+    {
+        if (timeout)
+            clearTimeout(timeout);
+
+        timeout = setTimeout(() => {
+            console.log("Test took too long, timing out!");
+            finishJSTest();
+        }, 30000);
+    }
+
     function isPixelBlack(pixel)
     {
         return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 255;
@@ -63,6 +75,8 @@
         } else {
             debug('');
             video.pause();
+            if (timeout)
+                clearTimeout(timeout);
             finishJSTest();
         }
     }
@@ -70,6 +84,7 @@
     function reenableTrack()
     {
         mediaStream.getVideoTracks()[0].enabled = true;
+        updateWatchdog();
         debug(`<br> === video track reenabled, should render current frame ===`);
 
         // The video is not guaranteed to render non-black frames before the canvas is drawn to and the pixels are checked.
@@ -96,6 +111,7 @@
     function disableAllTracks()
     {
         mediaStream.getVideoTracks()[0].enabled = false;
+        updateWatchdog();
         debug('<br> === all video tracks disabled ===');
         
         // The video is not guaranteed to render black frames before the canvas is drawn to and the pixels are checked.
@@ -105,6 +121,7 @@
 
     function beginTestRound()
     {
+        updateWatchdog();
         debug('<br> === beginning round of pixel tests ===');
         attempt(10, checkPixels, disableAllTracks);
     }
@@ -125,6 +142,8 @@
 
         video = document.querySelector('video');
         video.addEventListener('canplay', canplay);
+        
+        updateWatchdog();
 
         navigator.mediaDevices.getUserMedia({ video : true })
             .then((stream) => {

Modified: trunk/LayoutTests/fast/mediastream/resize-trim.html (258631 => 258632)


--- trunk/LayoutTests/fast/mediastream/resize-trim.html	2020-03-18 14:49:37 UTC (rev 258631)
+++ trunk/LayoutTests/fast/mediastream/resize-trim.html	2020-03-18 15:11:09 UTC (rev 258632)
@@ -28,8 +28,12 @@
     const ctx = canvas.getContext("2d");
     ctx.drawImage(video, 0 ,0);
 
-    assert_true(isPixelGray(ctx.getImageData(5, 5, 1, 1).data), "Pixel at 5x5 is not black.");
-    assert_true(isPixelGray(ctx.getImageData(10, 200, 1, 1).data), "Pixel at 10x200 is not black.");
+    let pixel = ctx.getImageData(5, 5, 1, 1).data;
+    assert_true(isPixelGray(pixel), `Pixel at 5x5 is not black, found {${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}}`);
+
+    pixel = ctx.getImageData(10, 200, 1, 1).data;
+    assert_true(isPixelGray(pixel), `Pixel at 10x200 is not black, found {${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}}`);
+
 }, "Video frames are resized in letterbox-mode when captured at non-native size.");
 
         </script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to