tor-browser

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

test_unsupported_mkv.html (1379B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <title>Unsupported MKV codecs test</title>
      5    <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      6    <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7    <script type="text/javascript" src="manifest.js"></script>
      8 </head>
      9 <body>
     10 <pre id="test">
     11 <script>
     12 /**
     13 * This test verifies that MKV files with unsupported codecs fail to load with
     14 * MEDIA_ERR_SRC_NOT_SUPPORTED. Tests are initially listed in gUnsupportedMKVtests
     15 * and moved to gMKVtests once support is implemented. When all tests have been
     16 * migrated to gMKVtests, this test can be removed.
     17 */
     18 add_task(async function test_unsupported_mkv_sources() {
     19  for (const test of gUnsupportedMKVtests) {
     20    let v = document.createElement("video");
     21    document.body.appendChild(v);
     22    v.src = test.name;
     23    v.preload = "auto";
     24 
     25    let errorPromise = new Promise(resolve => {
     26      v.addEventListener("error", () => {
     27        is(v.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
     28           `video.error.code should be MEDIA_ERR_SRC_NOT_SUPPORTED for ${test.name}`);
     29        resolve();
     30      }, { once: true });
     31    });
     32    v.load();
     33    await errorPromise;
     34 
     35    ok(v.readyState < HTMLMediaElement.HAVE_METADATA,
     36       `video.readyState (${v.readyState}) should be < HAVE_METADATA for ${test.name}`);
     37    removeNodeAndSource(v);
     38  }
     39 });
     40 </script>
     41 </pre>
     42 </body>
     43 </html>