Changeset 258632 in webkit


Ignore:
Timestamp:
Mar 18, 2020 8:11:09 AM (4 years ago)
Author:
eric.carlson@apple.com
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:
Location:
trunk/LayoutTests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r258627 r258632  
     12020-03-18  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Update some fast/mediastream to make failures easier to diagnose.
     4        https://bugs.webkit.org/show_bug.cgi?id=209205
     5        <rdar://problem/60561372>
     6
     7        Log more state when a test fails.
     8
     9        Reviewed by Alex Christensen.
     10
     11        * fast/mediastream/MediaStream-video-element-displays-buffer.html:
     12        * fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html:
     13        * fast/mediastream/resize-trim.html:
     14
    1152020-03-18  Antoine Quint  <graouts@apple.com>
    216
  • trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html

    r239319 r258632  
    3030        return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255;
    3131    }
     32   
     33    function checkPixels(x, y, test, expectedToBeTrue)
     34    {
     35        buffer = context.getImageData(x, y, 1, 1).data;
     36        if (expectedToBeTrue)
     37            shouldBeTrue(`${test.name}(buffer)`);
     38        else
     39            shouldBeFalse(`${test.name}(buffer)`);
     40
     41        if (test(buffer) != expectedToBeTrue)
     42            debug(`Found: {${buffer[0]}, ${buffer[1]}, ${buffer[2]}, ${buffer[3]}}`);
     43    }
    3244
    3345    function verifyFramesBeingDisplayed()
     
    4153        let x = canvas.width * .035;
    4254        let y = canvas.height * 0.6 + 2 + x;
    43         buffer = context.getImageData(x, y, 1, 1).data;
    44         shouldBeTrue('isPixelTransparent(buffer)');
     55        checkPixels(x, y, isPixelTransparent, true)
    4556       
    4657        evalAndLog(`context.drawImage(videos[${currentTest}], 0, 0, ${canvas.width}, ${canvas.height})`);
    47         buffer = context.getImageData(x, y, 1, 1).data;
    48         shouldBeFalse('isPixelTransparent(buffer)');
    49         shouldBeFalse('isPixelBlack(buffer)');
     58        checkPixels(x, y, isPixelTransparent, false)
     59        checkPixels(x, y, isPixelBlack, false)
    5060
    5161        x = canvas.width * .05;
    5262        y = canvas.height * .05;
    53         buffer = context.getImageData(x, y, 1, 1).data;
    54         shouldBeFalse('isPixelTransparent(buffer)');
    55         if (!currentTest)
    56             shouldBeTrue('isPixelBlack(buffer)');
    57         else
    58             shouldBeTrue('isPixelGray(buffer)');
     63        checkPixels(x, y, isPixelTransparent, false)
     64        checkPixels(x, y, currentTest ? isPixelGray : isPixelBlack, true)
    5965
    6066        if (currentTest >= 1) {
  • trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html

    r239319 r258632  
    1414    let mediaStream;
    1515    let video;
     16    let buffer;
    1617   
    17     let buffer;
     18    let timeout;
     19
     20    function updateWatchdog()
     21    {
     22        if (timeout)
     23            clearTimeout(timeout);
     24
     25        timeout = setTimeout(() => {
     26            console.log("Test took too long, timing out!");
     27            finishJSTest();
     28        }, 30000);
     29    }
    1830
    1931    function isPixelBlack(pixel)
     
    6476            debug('');
    6577            video.pause();
     78            if (timeout)
     79                clearTimeout(timeout);
    6680            finishJSTest();
    6781        }
     
    7185    {
    7286        mediaStream.getVideoTracks()[0].enabled = true;
     87        updateWatchdog();
    7388        debug(`<br> === video track reenabled, should render current frame ===`);
    7489
     
    97112    {
    98113        mediaStream.getVideoTracks()[0].enabled = false;
     114        updateWatchdog();
    99115        debug('<br> === all video tracks disabled ===');
    100116       
     
    106122    function beginTestRound()
    107123    {
     124        updateWatchdog();
    108125        debug('<br> === beginning round of pixel tests ===');
    109126        attempt(10, checkPixels, disableAllTracks);
     
    126143        video = document.querySelector('video');
    127144        video.addEventListener('canplay', canplay);
     145       
     146        updateWatchdog();
    128147
    129148        navigator.mediaDevices.getUserMedia({ video : true })
  • trunk/LayoutTests/fast/mediastream/resize-trim.html

    r245289 r258632  
    2929    ctx.drawImage(video, 0 ,0);
    3030
    31     assert_true(isPixelGray(ctx.getImageData(5, 5, 1, 1).data), "Pixel at 5x5 is not black.");
    32     assert_true(isPixelGray(ctx.getImageData(10, 200, 1, 1).data), "Pixel at 10x200 is not black.");
     31    let pixel = ctx.getImageData(5, 5, 1, 1).data;
     32    assert_true(isPixelGray(pixel), `Pixel at 5x5 is not black, found {${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}}`);
     33
     34    pixel = ctx.getImageData(10, 200, 1, 1).data;
     35    assert_true(isPixelGray(pixel), `Pixel at 10x200 is not black, found {${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}}`);
     36
    3337}, "Video frames are resized in letterbox-mode when captured at non-native size.");
    3438
Note: See TracChangeset for help on using the changeset viewer.