<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<script>
jsTestIsAsync = true;
description("This test verifies that long pressing the timestamp in an audio element does not start a text selection. To manually run the test, long press the audio element below and verify that no text is selected.");
addEventListener("load", async () => {
    if (!window.internals)
        return;

    const audioElement = document.querySelector("audio");
    let timeLabel;
    for (let label of Array.from(internals.shadowRoot(audioElement).querySelectorAll("div.time-label"))) {
        if (getComputedStyle(label).display !== "none")
            timeLabel = label;
    }

    const targetX = (audioElement.offsetLeft + timeLabel.offsetLeft) + timeLabel.offsetWidth / 2;
    const targetY = (audioElement.offsetTop + timeLabel.offsetTop) + timeLabel.offsetHeight / 2;
    await UIHelper.longPressAtPoint(targetX, targetY);
    rects = await UIHelper.getUISelectionViewRects();

    shouldBe("rects.length", "0");
    finishJSTest();
});
</script>
</head>
<body>
<audio controls src="../../../media/content/audio-tracks.mp4"></audio>
</body>
</html>