GUM-deny.https.html (1432B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>getUserMedia() triggers error callback when auth is denied</title> 5 <link rel="author" title="Dr. A. Gouaillard" href="mailto:agouaillard@gmail.com"/> 6 <link rel="help" href="https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia"> 7 </head> 8 <body> 9 <p class="instructions">When prompted, <strong>please deny</strong> access to 10 the video stream.</p> 11 <h1 class="instructions">Description</h1> 12 <p class="instructions">This test checks that the error callback is triggered 13 when user denies access to the video stream.</p> 14 <div id='log'></div> 15 <script src=/resources/testharness.js></script> 16 <script src=/resources/testharnessreport.js></script> 17 <script src=/resources/testdriver.js></script> 18 <script src=/resources/testdriver-vendor.js></script> 19 <script src=permission-helper.js></script> 20 <script> 21 promise_test(async () => { 22 try { 23 await setMediaPermission('denied', ['camera']); 24 await navigator.mediaDevices.getUserMedia({video: true}) 25 } catch (error) { 26 assert_throws_dom("NotAllowedError", () => { throw error }); 27 assert_false('constraintName' in error, 28 "constraintName attribute not set as expected"); 29 return; 30 }; 31 assert_unreached("The success callback should not be triggered since access is to be denied"); 32 }, "Tests that the error callback is triggered when permission is denied"); 33 </script> 34 </body> 35 </html>