<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Testing video capture resizing</title>
        <script src="../../resources/testharness.js"></script>
        <script src="../../resources/testharnessreport.js"></script>
    </head>
    <body>
        <video id="video" autoplay=""></video>
        <script>
promise_test(async (test) => {
    const localStream = await navigator.mediaDevices.getUserMedia({video: { width : { exact : 100 }, height : { exact : 100 }, facingMode: "environment" } });

    video.srcObject = localStream;
    await video.play();

    assert_equals(video.videoWidth, 100, "width");
    assert_equals(video.videoHeight, 100, "height");
}, "wdith 100 height 100 video");

promise_test(async (test) => {
    const localStream = await navigator.mediaDevices.getUserMedia({video: { width : { exact : 100 }, facingMode: "environment" } });

    video.srcObject = localStream;
    await video.play();

    assert_equals(video.videoWidth, 100, "width");
    assert_equals(video.videoHeight, 75, "height");
}, "width 100 video");

promise_test(async (test) => {
    const localStream = await navigator.mediaDevices.getUserMedia({video: { height : { exact : 100 }, facingMode: "environment" } });

    video.srcObject = localStream;
    await video.play();

    assert_equals(video.videoWidth, 133, "width");
    assert_equals(video.videoHeight, 100, "height");
}, "height 100 video ");
        </script>
    </body>
</html>
