browser_wmfme_max_crashes.js (2177B)
1 "use strict"; 2 3 /** 4 * This test aims to ensure that the MFCDM process won't be recovered once the 5 * amount of crashes has exceeded the amount of value which we tolerate. 6 */ 7 add_task(async function setupTestingPref() { 8 await SpecialPowers.pushPrefEnv({ 9 set: [ 10 ["media.wmf.media-engine.enabled", 1], 11 ["media.wmf.media-engine.channel-decoder.enabled", true], 12 ], 13 }); 14 }); 15 16 const VIDEO_PAGE = GetTestWebBasedURL("file_video.html"); 17 18 add_task(async function testPlaybackRecoveryFromCrash() { 19 const maxCrashes = Services.prefs.getIntPref( 20 "media.wmf.media-engine.max-crashes" 21 ); 22 info(`The amount of tolerable crashes=${maxCrashes}`); 23 24 info(`Create a tab and load test page`); 25 let tab = await BrowserTestUtils.openNewForegroundTab( 26 window.gBrowser, 27 "about:blank" 28 ); 29 BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, VIDEO_PAGE); 30 await BrowserTestUtils.browserLoaded(tab.linkedBrowser); 31 32 await playVideo(tab); 33 34 info("Ensure video is running via the media engine framework"); 35 await assertRunningProcessAndDecoderName(tab, { 36 expectedProcess: "Utility MF Media Engine CDM", 37 expectedDecoder: "media engine video stream", 38 }); 39 40 let pidBeforeCrash, pidAfterCrash; 41 for (let idx = 0; idx < maxCrashes; idx++) { 42 pidBeforeCrash = await getMFCDMProcessId(); 43 await crashUtilityProcess(pidBeforeCrash); 44 45 info("The CDM process should be recreated which makes media keep playing"); 46 await assertRunningProcessAndDecoderName(tab, { 47 expectedProcess: "Utility MF Media Engine CDM", 48 expectedDecoder: "media engine video stream", 49 }); 50 51 pidAfterCrash = await getMFCDMProcessId(); 52 isnot( 53 pidBeforeCrash, 54 pidAfterCrash, 55 `new process ${pidAfterCrash} is not previous crashed one ${pidBeforeCrash}` 56 ); 57 } 58 59 info("This crash should result in not spawning MFCDM process again"); 60 pidBeforeCrash = await getMFCDMProcessId(); 61 await crashUtilityProcess(pidBeforeCrash); 62 63 await assertNotEqualRunningProcessAndDecoderName(tab, { 64 givenProcess: "Utility MF Media Engine CDM", 65 givenDecoder: "media engine video stream", 66 }); 67 68 BrowserTestUtils.removeTab(tab); 69 });