tor-browser

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

GUM-impossible-constraint.https.html (1792B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <title>Trivial mandatory constraint in getUserMedia</title>
      5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
      6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
      7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-NavigatorUserMediaError">
      8 </head>
      9 <body>
     10 <p class="instructions">When prompted, accept to share your video stream.</p>
     11 <h1 class="instructions">Description</h1>
     12 <p class="instructions">This test checks that setting an impossible mandatory
     13 constraint (width &gt;=1G) in getUserMedia works</p>
     14 
     15 <div id='log'></div>
     16 <script src=/resources/testharness.js></script>
     17 <script src=/resources/testharnessreport.js></script>
     18 <script src=/resources/testdriver.js></script>
     19 <script src=/resources/testdriver-vendor.js></script>
     20 <script src=permission-helper.js></script>
     21 <script>
     22 promise_test(async () => {
     23  await setMediaPermission("granted", ["camera"]);
     24  // Note - integer conversion is weird for +inf and numbers > 2^32, so we
     25  // use a number less than 2^32 for testing.
     26  try {
     27    await navigator.mediaDevices.getUserMedia({video: {width: {min:100000000}}});
     28    assert_unreached("a Video stream of width 100M cannot be created");
     29 
     30  } catch (error) {
     31    assert_equals(error.name, "OverconstrainedError", "An impossible constraint triggers a OverconstrainedError");
     32    assert_equals(error.constraint, "width", "The name of the not satisfied error is given in error.constraint");
     33  }
     34 }, "Tests that setting an impossible constraint in getUserMedia fails");
     35 </script>
     36 </body>
     37 </html>