diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/test/test_eme_canvas_blocked.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_eme_canvas_blocked.html')
-rw-r--r-- | dom/media/test/test_eme_canvas_blocked.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/dom/media/test/test_eme_canvas_blocked.html b/dom/media/test/test_eme_canvas_blocked.html new file mode 100644 index 0000000000..22986493c4 --- /dev/null +++ b/dom/media/test/test_eme_canvas_blocked.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test Encrypted Media Extensions</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> + <script type="text/javascript" src="manifest.js"></script> + <script type="text/javascript" src="eme.js"></script> +</head> +<body> +<pre id="test"> +<script class="testbody" type="text/javascript"> +var manager = new MediaTestManager(); + +function startTest(test, token) { + manager.started(token); + + let v = document.createElement("video"); + v.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this. + + var p1 = new EMEPromise(); + v.addEventListener("loadeddata", function(ev) { + var video = ev.target; + var canvas = document.createElement("canvas"); + canvas.width = video.videoWidth; + canvas.height = video.videoHeight; + document.body.appendChild(canvas); + var ctx = canvas.getContext("2d"); + ctx.drawImage(video, 0, 0); + if (canvas.width || canvas.height) { + let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data; + for (let byte of pixels) { + if (byte != 0) { + ok(false, "Should not draw EME video to canvas"); + // We don't need a log for each pixel, break after 1st failure. + break; + } + } + } + p1.resolve(); + }); + + let p2 = SetupEME(v, test, token); + + Promise.all([p1.promise, p2]) + .catch(reason => ok(false, reason)) + .then(() => { + CleanUpMedia(v); + manager.finished(token); + }); +} + +SimpleTest.waitForExplicitFinish(); +manager.runTests(gEMETests, startTest); +</script> +</pre> +</body> +</html> |