<script src="../../../resources/js-test-pre.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
<body>
<style type="text/css" media="screen">
    
    video, #host {
        position: absolute;
        top: 0;
        left: 0;
        width: 800px;
        height: 240px;
    }
    
</style>
<video src="../../content/test.mp4" muted autoplay controls></video>
<div id="host"></div>
<script type="text/javascript">

window.jsTestIsAsync = true;

description("Testing the <code>VolumeSupport</code> behavior when dragging the scrubber.");

const container = document.querySelector("div#host");
const media = document.querySelector("video");
const mediaController = createControls(container, media, null);

const muteButton = mediaController.controls.muteButton.element;
const volumeSlider = mediaController.controls.volumeSlider.children[1].element;

debug("By default, the volume slider should be set to 0 because the media is muted");
shouldBe("mediaController.controls.volumeSlider.value", "0");

media.addEventListener("play", () => {
    media.pause();
    shouldBecomeDifferent("muteButton.getBoundingClientRect().width", "0", async () => {
        await UIHelper.renderingUpdate();
        const muteButtonBounds = muteButton.getBoundingClientRect();
        // Controls are now visible, let's hover over the mute button to make the volume control visible.
        eventSender.mouseMoveTo(muteButtonBounds.left + muteButtonBounds.width / 2, muteButtonBounds.top + muteButtonBounds.height / 2);
        shouldBecomeDifferent("volumeSlider.getBoundingClientRect().width", "0", () => {
            // Volume slider is visible, let's start dragging in the middle of it.
            const bounds = volumeSlider.getBoundingClientRect();
            const centerX = bounds.left + bounds.width / 2;
            const dragStartY = bounds.top + bounds.height / 2;
            const dragEndY = bounds.top;
            const delta = dragEndY - dragStartY;
            const iterations = Math.abs(delta);

            debug("");
            debug("Before starting to drag the volume slider, the media should be muted still");
            shouldBeTrue("media.muted");

            eventSender.mouseMoveTo(centerX, dragStartY);
            eventSender.mouseDown();

            debug("");
            debug("We initiated a volume slider drag, the media should no longer be muted and the volume set");
            shouldBecomeEqual("media.muted", "false", () => {
                // Because the slider has a 9pt-wide knob and tests are ran at 1x, we can't get 0.5 here,
                // and instead get 0.51 since the slider will only increment on whole pixels.
                shouldBecomeEqual("media.volume", "0.51", () => {
                    for (let i = 1; i <= iterations; ++i)
                        eventSender.mouseMoveTo(bounds.left + bounds.width / 2, dragStartY + i * Math.sign(delta));

                    eventSender.mouseUp();

                    debug("");
                    debug("We finished dragging to set the volume to 1");
                    shouldBecomeEqual("media.volume", "1", () => {
                        // Ensure the volume slider remains visible.
                        shouldBeTrue("mediaController.controls.volumeSlider.parent.visible");

                        container.remove();
                        media.remove();
                        finishJSTest();
                    });
                });
            });
        });
    });
});

setTimeout(finishJSTest, 3500);

</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
