tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_wmfme_crash.js (1572B)


      1 "use strict";
      2 
      3 /**
      4 * This test aims to ensure that the media engine playback will recover from a
      5 * crash and keep playing without any problem.
      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  info(`Create a tab and load test page`);
     20  let tab = await BrowserTestUtils.openNewForegroundTab(
     21    window.gBrowser,
     22    "about:blank"
     23  );
     24  BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, VIDEO_PAGE);
     25  await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
     26 
     27  await playVideo(tab);
     28 
     29  info("Ensure video is running via the media engine framework");
     30  await assertRunningProcessAndDecoderName(tab, {
     31    expectedProcess: "Utility MF Media Engine CDM",
     32    expectedDecoder: "media engine video stream",
     33  });
     34 
     35  const pidBeforeCrash = await getMFCDMProcessId();
     36  await crashUtilityProcess(pidBeforeCrash);
     37 
     38  info("The CDM process should be recreated which makes media keep playing");
     39  await assertRunningProcessAndDecoderName(tab, {
     40    expectedProcess: "Utility MF Media Engine CDM",
     41    expectedDecoder: "media engine video stream",
     42  });
     43 
     44  const pidAfterCrash = await getMFCDMProcessId();
     45  isnot(
     46    pidBeforeCrash,
     47    pidAfterCrash,
     48    `new process ${pidAfterCrash} is not previous crashed one ${pidBeforeCrash}`
     49  );
     50 
     51  BrowserTestUtils.removeTab(tab);
     52 });