tor-browser

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

head-multiple.js (1640B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /* import-globals-from head.js */
      7 
      8 async function runTest({
      9  expectUtility = false,
     10  expectRDD = false,
     11  expectContent = false,
     12  expectError = false,
     13 }) {
     14  info(`Running tests with decoding from somewhere`);
     15  info(`  expectUtility: ${expectUtility}`);
     16  info(`  expectRDD: ${expectRDD}`);
     17  info(`  expectContent: ${expectContent}`);
     18 
     19  const platform = Services.appinfo.OS;
     20 
     21  for (let { src, expectations } of audioTestData()) {
     22    if (!(platform in expectations)) {
     23      info(`Skipping ${src} for ${platform}`);
     24      continue;
     25    }
     26 
     27    const expectation = expectations[platform];
     28 
     29    info(`Add media tabs: ${src}`);
     30    let tabs = [await addMediaTab(src), await addMediaTab(src)];
     31    let playback = [];
     32 
     33    info("Play tabs");
     34    for (let tab of tabs) {
     35      playback.push(
     36        play(
     37          tab,
     38          expectUtility && !expectContent && !expectError
     39            ? expectation.process
     40            : "RDD",
     41          expectation.decoder,
     42          expectContent,
     43          false, // expectJava
     44          expectError
     45        )
     46      );
     47    }
     48 
     49    info("Wait all playback");
     50    await Promise.all(playback);
     51 
     52    let allstop = [];
     53    info("Stop tabs");
     54    for (let tab of tabs) {
     55      allstop.push(stop(tab));
     56    }
     57 
     58    info("Wait all stop");
     59    await Promise.all(allstop);
     60 
     61    let remove = [];
     62    info("Remove tabs");
     63    for (let tab of tabs) {
     64      remove.push(BrowserTestUtils.removeTab(tab));
     65    }
     66 
     67    info("Wait all tabs to be removed");
     68    await Promise.all(remove);
     69  }
     70 }