overconstrained_error.https.html (868B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 </head> 7 <body> 8 <script> 9 10 promise_test(async t => { 11 try { 12 stream = await navigator.mediaDevices.getUserMedia( 13 {video: {width: {exact: 639}, resizeMode: {exact: "none"}}}); 14 t.add_cleanup(()=>stream.getVideoTracks()[0].stop()); 15 t.step(() => assert_unreached('applyConstraints should have failed')); 16 } catch(e) { 17 assert_true(e instanceof DOMException); 18 assert_equals(e.name, 'OverconstrainedError'); 19 assert_equals(e.constraint, 'width'); 20 } 21 }, 'Error of OverconstrainedError type inherit from DOMException'); 22 23 promise_test(async t => { 24 assert_true(new OverconstrainedError("constraint") instanceof DOMException); 25 }, 'OverconstrainedError class inherits from DOMException'); 26 27 </script> 28 </body> 29 </html>