<!DOCTYPE html>
<html>
<head>
    <script src=../../../../media/video-test.js></script>
    <script type="text/javascript">
    var promise;
    var info;

    async function doTest()
    {
        if (!window.internals) {
            failTest("Internals is required for this test.")
            return;
        }

        run('internals.settings.setMediaCapabilitiesExtensionsEnabled(true)');

        run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"hvc1.2.4.H153.B0\"', height: 720, bitrate: 800000, width: 1280, framerate: 24.5 }});");
        info = await shouldResolve(promise);
        testExpected('info.supported', true);
        testExpected('info.supportedConfiguration.video.hdrMetadataType', null);

        run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"hvc1.2.4.H153.B0\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, hdrMetadataType: 'smpteSt2086', transferFunction: 'pq' }});");
        info = await shouldResolve(promise);
        testExpected('info.supported', true);
        testExpected('info.supportedConfiguration.video.hdrMetadataType', 'smpteSt2086');

        run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"avc1.640028\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, hdrMetadataType: 'smpteSt2086', transferFunction: 'pq' }});");
        info = await shouldResolve(promise);
        testExpected('info.supported', false);
        testExpected('info.supportedConfiguration.video.hdrMetadataType', 'smpteSt2086');

        endTest();
    }
    </script>
</head>
<body onload="doTest()" />
</html>
