tor-browser

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

test_cloneElementVisually_poster.html (1571B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test cloneElementVisually with poster</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <script type="application/javascript" src="https://example.com:443/tests/dom/media/test/cloneElementVisually_helpers.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
      9 </head>
     10 <body>
     11 <div id="content">
     12  <h1>Original</h1>
     13  <video id="original"></video>
     14  <h1>Clone</h1>
     15 </div>
     16 <div id="results">
     17  <h1>Results</h1>
     18  <canvas id="left"></canvas>
     19  <canvas id="right"></canvas>
     20 </div>
     21 
     22 <script type="application/javascript">
     23 
     24 /* import-globals-from cloneElementVisually_helpers.js */
     25 
     26 /**
     27 * Test that when we clone a video with a poster, the poster does not prevent
     28 * the cloned video from displaying properly (as in bug 1532692).
     29 */
     30 add_task(async () => {
     31  await setup();
     32 
     33  let originalVideo = document.getElementById("original");
     34  const POSTER_URL = "https://example.com:443/tests/dom/media/test/poster-test.jpg";
     35  originalVideo.setAttribute("poster", POSTER_URL);
     36 
     37  await withNewClone(originalVideo, async clone => {
     38    await SpecialPowers.wrap(originalVideo).cloneElementVisually(clone);
     39    originalVideo.loop = false;
     40    originalVideo.currentTime = originalVideo.duration - 0.1;
     41    let endedPromise = waitForEventOnce(originalVideo, "ended");
     42    await originalVideo.play();
     43    await endedPromise;
     44 
     45    ok(await assertVideosMatch(originalVideo, clone),
     46       "Video with a poster should clone properly.");
     47  });
     48 });
     49 
     50 </script>
     51 
     52 </body>
     53 </html>