tor-browser

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

media-sniff.window.js (820B)


      1 const tests = {
      2  "vectors": [
      3    "mp3-raw.mp3",
      4    "mp3-with-id3.mp3",
      5    "flac.flac",
      6    "ogg.ogg",
      7    "mp4.mp4",
      8    "wav.wav",
      9    "webm.webm"
     10  ],
     11  "contentTypes": [
     12    "",
     13    "bogus/mime",
     14    "application/octet-stream",
     15    "text/html",
     16    "audio/ogg; codec=vorbis",
     17    "application/pdf"
     18  ]
     19 };
     20 
     21 tests.vectors.forEach(vector => {
     22  tests.contentTypes.forEach(type => {
     23    async_test(t => {
     24      const element = document.createElement("audio");
     25      element.src = "resources/" + vector + "?pipe=header(Content-Type,"+type+")"
     26 
     27      element.addEventListener("error", t.unreached_func("No error expected frorm the HTMLMediaElement"));
     28      element.addEventListener("loadedmetadata", t.step_func_done());
     29      element.load();
     30    }, vector + " loads when served with Content-Type " + type);
     31  });
     32 });