tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GUM-invalid-facing-mode.https.html (1105B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <title>Invalid facingMode in getUserMedia</title>
      5 <link rel="help" href="https://w3c.github.io/mediacapture-main/#def-constraint-facingMode">
      6 </head>
      7 <body>
      8 <h1 class="instructions">Description</h1>
      9 <p class="instructions">This test checks that trying to set an empty facingMode
     10  value in getUserMedia results in an OverconstrainedError.
     11 </p>
     12 
     13 <script src=/resources/testharness.js></script>
     14 <script src=/resources/testharnessreport.js></script>
     15 <script src=/resources/testdriver.js></script>
     16 <script src=/resources/testdriver-vendor.js></script>
     17 <script src=permission-helper.js></script>
     18 <script>
     19 promise_test(async () => {
     20  await setMediaPermission("granted", ["camera"]);
     21  try {
     22    await navigator.mediaDevices.getUserMedia({video: {facingMode: {exact: ''}}});
     23    assert_unreached("The empty string is not a valid facingMode");
     24  } catch (error) {
     25    assert_equals(error.name, "OverconstrainedError");
     26    assert_equals(error.constraint, "facingMode");
     27  };
     28 }, "Tests that setting an invalid facingMode constraint in getUserMedia fails");
     29 </script>
     30 </body>
     31 </html>