Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html

Issue 656683007: Add a layout test for potential bug on drawing video on SkCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html
diff --git a/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html
new file mode 100644
index 0000000000000000000000000000000000000000..378c39396fbb6be19af215bedcd96e3d0cd80630
--- /dev/null
+++ b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html
@@ -0,0 +1,77 @@
+<html>
+<head>
+ <title>Ensure correct behavior of drawImage video elements on both software canvas and accelerated canvas. crbug.com/424591</title>
+ <style trpe="text/css">
+ video {
+ display: none;
+ }
+ </style>
+</head>
+<body>
+ <canvas id="hw-canvas" width=300 height=300></canvas>
+ <canvas id="sw-canvas" width=150 height=150></canvas>
+ <video id="hw-video" loop>
+ <source src="resources/canvas_video.mp4" type='video/mp4' />
+ <source src="resources/canvas_video.webm" type='video/webm' />
+ <source src="resources/canvas_video.ogv" type='video/ogg' />
+ </video>
+ <video id="sw-video" loop>
+ <source src="resources/canvas_video.mp4" type='video/mp4' />
+ <source src="resources/canvas_video.webm" type='video/webm' />
+ <source src="resources/canvas_video.ogv" type='video/ogg' />
+</video>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ }
+
+ var hw_canvas = document.getElementById("hw-canvas");
+ var hw_ctx = hw_canvas.getContext("2d");
+ // Although enabling accelerated-2d-canvas, canvas with the dimension
+ // less than 257*256 is not accelerated.
+ var sw_canvas = document.getElementById("sw-canvas");
+ var sw_ctx = sw_canvas.getContext("2d");
+
+ var blockUntilPlayingBothVideo = true;
+ var hw_video = document.getElementById("hw-video");
+ hw_video.addEventListener("playing", onHwVideoPlaying, true);
+ hw_video.play();
+ function onHwVideoPlaying() {
+ hw_video.removeEventListener("playing", onHwVideoPlaying, true);
+ if (blockUntilPlayingBothVideo) {
+ blockUntilPlayingBothVideo = false;
+ } else {
+ drawImageToCanvas();
+ }
+ }
+ var sw_video = document.getElementById("sw-video");
+ sw_video.addEventListener("playing", onSwVideoPlaying, true);
+ sw_video.play();
+ function onSwVideoPlaying() {
+ sw_video.removeEventListener("playing", onSwVideoPlaying, true);
+ if (blockUntilPlayingBothVideo) {
+ blockUntilPlayingBothVideo = false;
+ } else {
+ drawImageToCanvas();
+ }
+ }
+
+ function drawVideo(video, ctx, canvas) {
+ ctx.globalAlpha = 1;
+ ctx.fillStyle = "blue";
+ ctx.fillRect(0, 0, canvas.width, canvas.width);
+ ctx.drawImage(video, 0, 0);
+ ctx.globalAlpha = 0.5;
+ ctx.drawImage(video, 0, 60);
+ }
+
+ function drawImageToCanvas() {
+ // draw a different video on a different canvas.
+ drawVideo(sw_video, sw_ctx, sw_canvas);
+ drawVideo(hw_video, hw_ctx, hw_canvas);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698