Changeset 213317 in webkit


Ignore:
Timestamp:
Mar 2, 2017 3:53:49 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

LayoutTest media/modern-media-controls/volume-support/volume-support-drag.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=164226
<rdar://problem/30811901>

Patch by Antoine Quint <Antoine Quint> on 2017-03-02
Reviewed by Dean Jackson.

Use asynchronous assertions to step through the test and make it more robust.

  • media/modern-media-controls/volume-support/volume-support-drag-expected.txt:
  • media/modern-media-controls/volume-support/volume-support-drag.html:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r213315 r213317  
     12017-03-02  Antoine Quint  <graouts@apple.com>
     2
     3        LayoutTest media/modern-media-controls/volume-support/volume-support-drag.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=164226
     5        <rdar://problem/30811901>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Use asynchronous assertions to step through the test and make it more robust.
     10
     11        * media/modern-media-controls/volume-support/volume-support-drag-expected.txt:
     12        * media/modern-media-controls/volume-support/volume-support-drag.html:
     13
    1142017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag-expected.txt

    r212861 r213317  
    66By default, the volume slider should be set to 0 because the media is muted
    77PASS mediaController.controls.volumeSlider.value is 0
     8PASS muteButton.getBoundingClientRect().width became different from 0
     9PASS volumeSlider.getBoundingClientRect().width became different from 0
    810
    911Before starting to drag the volume slider, the media should be muted still
     
    1113
    1214We initiated a volume slider drag, the media should no longer be muted and the volume set
    13 PASS media.muted is false
    14 PASS media.volume is 0.5
     15PASS media.muted became false
     16PASS media.volume became 0.5
    1517
    1618We finished dragging to set the volume to 1
    17 PASS media.volume is 1
     19PASS media.volume became 1
    1820PASS mediaController.controls.volumeSlider.parent.visible is true
    1921PASS successfullyParsed is true
  • trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag.html

    r212943 r213317  
    2626const mediaController = createControls(container, media, null);
    2727
     28const muteButton = mediaController.controls.muteButton.element;
     29const volumeSlider = mediaController.controls.volumeSlider.children[1].element;
     30
    2831debug("By default, the volume slider should be set to 0 because the media is muted");
    2932shouldBe("mediaController.controls.volumeSlider.value", "0");
    3033
    31 let numberOfFrames = 0;
    32 scheduler.frameDidFire = function() {
    33     const muteButtonElement = mediaController.controls.muteButton.element;
    34     const muteButtonBounds = muteButtonElement.getBoundingClientRect();
    35     if (media.paused || muteButtonBounds.width === 0)
    36         return;
    37 
    38     numberOfFrames++;
    39 
    40     if (numberOfFrames == 1) {
     34media.addEventListener("play", () => {
     35    media.pause();
     36    shouldBecomeDifferent("muteButton.getBoundingClientRect().width", "0", () => {
     37        const muteButtonBounds = muteButton.getBoundingClientRect();
    4138        // Controls are now visible, let's hover over the mute button to make the volume control visible.
    4239        eventSender.mouseMoveTo(muteButtonBounds.left + muteButtonBounds.width / 2, muteButtonBounds.top + muteButtonBounds.height / 2);
    43     } else if (numberOfFrames == 2) {
    44         // Volume slider is visible, let's start dragging in the middle of it.
    45         const bounds = mediaController.controls.volumeSlider.children[1].element.getBoundingClientRect();
    46         const centerX = bounds.left + bounds.width / 2;
    47         const dragStartY = bounds.top + bounds.height / 2;
    48         const dragEndY = bounds.top;
    49         const delta = dragEndY - dragStartY;
    50         const iterations = Math.abs(delta);
     40        shouldBecomeDifferent("volumeSlider.getBoundingClientRect().width", "0", () => {
     41            // Volume slider is visible, let's start dragging in the middle of it.
     42            const bounds = volumeSlider.getBoundingClientRect();
     43            const centerX = bounds.left + bounds.width / 2;
     44            const dragStartY = bounds.top + bounds.height / 2;
     45            const dragEndY = bounds.top;
     46            const delta = dragEndY - dragStartY;
     47            const iterations = Math.abs(delta);
    5148
    52         debug("");
    53         debug("Before starting to drag the volume slider, the media should be muted still");
    54         shouldBeTrue("media.muted");
     49            debug("");
     50            debug("Before starting to drag the volume slider, the media should be muted still");
     51            shouldBeTrue("media.muted");
    5552
    56         eventSender.mouseMoveTo(centerX, dragStartY);
    57         eventSender.mouseDown();
     53            eventSender.mouseMoveTo(centerX, dragStartY);
     54            eventSender.mouseDown();
    5855
    59         debug("");
    60         debug("We initiated a volume slider drag, the media should no longer be muted and the volume set");
    61         shouldBeFalse("media.muted");
    62         shouldBe("media.volume", "0.5");
     56            debug("");
     57            debug("We initiated a volume slider drag, the media should no longer be muted and the volume set");
     58            shouldBecomeEqual("media.muted", "false", () => {
     59                shouldBecomeEqual("media.volume", "0.5", () => {
     60                    for (let i = 1; i <= iterations; ++i)
     61                        eventSender.mouseMoveTo(bounds.left + bounds.width / 2, dragStartY + i * Math.sign(delta));
    6362
    64         for (let i = 1; i <= iterations; ++i)
    65             eventSender.mouseMoveTo(bounds.left + bounds.width / 2, dragStartY + i * Math.sign(delta));
     63                    eventSender.mouseUp();
    6664
    67         eventSender.mouseUp();
     65                    debug("");
     66                    debug("We finished dragging to set the volume to 1");
     67                    shouldBecomeEqual("media.volume", "1", () => {
     68                        // Ensure the volume slider remains visible.
     69                        shouldBeTrue("mediaController.controls.volumeSlider.parent.visible");
    6870
    69         debug("");
    70         debug("We finished dragging to set the volume to 1");
    71         shouldBe("media.volume", "1");
    72 
    73         // Ensure the volume slider remains visible.
    74         shouldBeTrue("mediaController.controls.volumeSlider.parent.visible");
    75 
    76         container.remove();
    77         media.remove();
    78         finishMediaControlsTest();
    79     }
    80 };
    81 
    82 // First, ensure controls are shown.
    83 mediaController.controls.showsStartButton = false;
     71                        container.remove();
     72                        media.remove();
     73                        finishJSTest();
     74                    });
     75                });
     76            });
     77        });
     78    });
     79});
    8480
    8581</script>
Note: See TracChangeset for help on using the changeset viewer.