Source code

Revision control

Other Tools

Test Info: Warnings

  • This test gets skipped with pattern: (os == "win" && processor == "aarch64")
<meta charset="utf-8">
<title>Test cloneElementVisually</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src=""></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<div id="content">
<video id="original"></video>
<video id="streamTarget"></video>
<div id="results">
<canvas id="left"></canvas>
<canvas id="right"></canvas>
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
* Test that we can clone a video that is playing a MediaStream.
add_task(async () => {
await setup();
let originalVideo = document.getElementById("original");
let stream = originalVideo.mozCaptureStream();
let streamTarget = document.getElementById("streamTarget");
originalVideo.setAttribute("loop", true);
let playingPromise = waitForEventOnce(originalVideo, "playing");
await playingPromise;
streamTarget.srcObject = stream;
playingPromise = waitForEventOnce(streamTarget, "playing");
await playingPromise
await withNewClone(originalVideo, async clone => {
await SpecialPowers.wrap(streamTarget).cloneElementVisually(clone);
originalVideo.loop = false;
originalVideo.currentTime = originalVideo.duration - 0.1;
await waitForEventOnce(streamTarget, "ended");
ok(await assertVideosMatch(originalVideo, streamTarget),
"Should match Original video");
ok(await assertVideosMatch(streamTarget, clone),
"Should match MediaStream");
// Capturing a stream from a video "taints" it which prevents testing
// shutdown decoder behaviour. To avoid interfering with future tests,
// we replace the video.
let newVideo = originalVideo.cloneNode();
originalVideo.parentNode.replaceChild(newVideo, originalVideo);