test_getUserMedia_cubebDisabled.html (1308B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="mediaStreamPlayback.js"></script> 5 </head> 6 <body> 7 <pre id="test"> 8 <script type="application/javascript"> 9 createHTML({ 10 title: "getUserMedia with Cubeb Disabled Test", 11 bug: "1443525" 12 }); 13 /** 14 * Run a test to verify we fail gracefully if we cannot fetch a cubeb context 15 * during a gUM call. 16 */ 17 runTest(async function () { 18 info("Get user media with cubeb disabled starting"); 19 // Push prefs to ensure no cubeb context and no fake streams. 20 await pushPrefs(["media.cubeb.force_null_context", true], 21 ["media.navigator.permission.device", false], 22 ["media.navigator.streams.fake", false]); 23 24 // Request audio only, to avoid cams 25 let constraints = {audio: true, video: false}; 26 let stream; 27 try { 28 stream = await getUserMedia(constraints); 29 } catch (e) { 30 // We've got no audio backend, so we expect gUM to fail. 31 ok(e.name == "NotFoundError", "Expected NotFoundError due to no audio tracks!"); 32 return; 33 } 34 // If we're not on android we should not have gotten a stream without a cubeb context! 35 ok(false, "getUserMedia not expected to succeed when cubeb is disabled, but it did!"); 36 }); 37 38 39 </script> 40 </pre> 41 </body> 42 </html>