<!DOCTYPE html>
<html>
    <head>
        <title>getDisplayMedia prompt</title>
        <script src="../../../../resources/js-test-pre.js"></script>
    </head>
    <body>
    <p id="description"></p>
    <div id="console"></div>

<script>

    let stream;
    let err;
    
    function numberOfTimesGetUserMediaPromptHasBeenCalled() {
        return testRunner.userMediaPermissionRequestCountForOrigin(document.location.href, document.location.href);
    }
    
    async function promptForAudioOnly() {
        debug("<br>** Request an audio-only stream, the user should be prompted **");
        stream = await navigator.mediaDevices.getDisplayMedia({ audio: true });
        shouldBe("numberOfTimesGetUserMediaPromptHasBeenCalled()", "1");
        shouldBe("stream.getAudioTracks().length", "1");
        shouldBe("stream.getVideoTracks().length", "0");
    }

    async function promptForVideoOnly() {
        debug("<br>** Request an video-only stream, the user should be prompted **");
        stream = await navigator.mediaDevices.getDisplayMedia({ video: true });
        shouldBe("numberOfTimesGetUserMediaPromptHasBeenCalled()", "2");
        shouldBe("stream.getAudioTracks().length", "0");
        shouldBe("stream.getVideoTracks().length", "1");
    }

    async function promptForAudioAndVideo() {
        debug("<br>** Request a stream with audio and video, the user should be prompted **");
        stream = await navigator.mediaDevices.getDisplayMedia({ video: true, audio: true });
        shouldBe("numberOfTimesGetUserMediaPromptHasBeenCalled()", "3");
        shouldBe("stream.getAudioTracks().length", "1");
        shouldBe("stream.getVideoTracks().length", "1");
    }
    
    async function promptWithMediaTrackConstraints() {
        debug("<br>** Request a stream with invalid constraints, the user should not be prompted **");
        stream = null;
        try {
            stream = await navigator.mediaDevices.getDisplayMedia({ video: {width: {exact: 640}, height: {exact: 480}} });
        } catch (e) {
            err = e;
        }
        
        shouldBe("numberOfTimesGetUserMediaPromptHasBeenCalled()", "3");
        shouldBeNull("stream");
        shouldBeTrue("err instanceof Error "); 
        shouldBeEqualToString("err.name", "InvalidAccessError");
    }

    (async function() {
        description('Test basic getDisplayMedia prompting behavior');
        jsTestIsAsync = true;

        testRunner.resetUserMediaPermissionRequestCountForOrigin(document.location.href, document.location.href);
        window.internals.settings.setScreenCaptureEnabled(true);

        shouldBe("numberOfTimesGetUserMediaPromptHasBeenCalled()", "0");

        await promptForAudioOnly();
        await promptForVideoOnly();
        await promptForAudioAndVideo();
        await promptWithMediaTrackConstraints();

        debug("");
        finishJSTest();
    })()

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