mediaDevices-setCaptureHandle.https.html (1223B)
1 <!DOCTYPE html> 2 <title>Test MediaDevice navigator.mediaDevices.setCaptureHandleConfig()</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/utils.js"></script> 6 <script src="/common/dispatcher/dispatcher.js"></script> 7 <script src="resources/utils.js"></script> 8 9 <body> 10 <script> 11 promise_test(async () => { 12 const frame = attachFencedFrameContext(); 13 await frame.execute(async () => { 14 // If capture handle is set inside the fenced frame, it should fail because 15 // it should not be the top-level browsing context. 16 // https://w3c.github.io/mediacapture-handle/identity/index.html#set-capture-handle-config 17 try { 18 navigator.mediaDevices.setCaptureHandleConfig({ 19 handle: 'dummyhandle', 20 permittedOrigins: ["*"], 21 }); 22 throw 'The setCaptureHandleConfig request should not succeed.'; 23 } catch (e) { 24 assert_equals(e.name, 'InvalidStateError'); 25 assert_equals(e.message, 26 "Failed to execute 'setCaptureHandleConfig' on 'MediaDevices': " + 27 'Can only be called from the top-level document.'); 28 } 29 }); 30 }, 'navigator.mediaDevices.setCaptureHandleConfig'); 31 </script> 32 </body>