| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-live-video.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-live-video.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-live-video.html
|
| index 2e70eb46ae7beed6047de044ffcafc3c23e3b25f..3dd5f50adbf879aa309182c2938f0fb73474a24d 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-live-video.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-live-video.html
|
| @@ -7,60 +7,57 @@
|
| </style>
|
| </head>
|
| <body>
|
| - <canvas id="canvas"></canvas>
|
| - <video id="video">
|
| - <source src="../../media/resources/test-live.webm" type='video/webm' />
|
| - </video>
|
| - <script src="../../resources/js-test.js"></script>
|
| - <script>
|
| - description('Verify that consecutive drawImage from a live video correctly propagates frame updates.');
|
| - if (window.testRunner) {
|
| - testRunner.dumpAsText();
|
| - testRunner.waitUntilDone();
|
| - }
|
| -
|
| +<canvas id="canvas"></canvas>
|
| +<video id="video">
|
| + <source src="../../media/resources/test-live.webm" type='video/webm' />
|
| +</video>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +async_test(t => {
|
| var canvas = document.getElementById("canvas");
|
| canvas.width = 100;
|
| canvas.height = 100;
|
| var ctx = canvas.getContext("2d");
|
|
|
| - var video = document.getElementById("video");
|
| - video.addEventListener("playing", drawFirstFrame, true);
|
| - video.play();
|
| + var video = document.getElementById("video");
|
| + video.addEventListener("playing", drawFirstFrame, true);
|
| + video.play();
|
|
|
| - function drawFirstFrame() {
|
| - video.removeEventListener("playing", drawFirstFrame, true);
|
| - ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| - requestAnimationFrame(function() {
|
| - video.addEventListener("timeupdate", updateVideo, true);
|
| - });
|
| - }
|
| + function drawFirstFrame() {
|
| + video.removeEventListener("playing", drawFirstFrame, true);
|
| + ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| + requestAnimationFrame(function() {
|
| + video.addEventListener("timeupdate", updateVideo, true);
|
| + });
|
| + }
|
|
|
| - var referenceImageData;
|
| - var processedFirstFrame = false;
|
| - var imagesAreTheSame;
|
| + var referenceImageData;
|
| + var processedFirstFrame = false;
|
| + var imagesAreTheSame;
|
|
|
| - function updateVideo() {
|
| - if (!processedFirstFrame) {
|
| - ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| - referenceImageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
| - processedFirstFrame = true;
|
| - } else {
|
| - video.removeEventListener("timeupdate", updateVideo, true);
|
| - ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| - var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
| - imagesAreTheSame = true;
|
| - for(var i = 0; i < imageData.data.length; ++i) {
|
| - if (imageData.data[i] != referenceImageData.data[i]) {
|
| - imagesAreTheSame = false;
|
| - break;
|
| + function updateVideo() {
|
| + t.step(function(){
|
| + if (!processedFirstFrame) {
|
| + ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| + referenceImageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
| + processedFirstFrame = true;
|
| + } else {
|
| + video.removeEventListener("timeupdate", updateVideo, true);
|
| + ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| + var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
| + imagesAreTheSame = true;
|
| + for(var i = 0; i < imageData.data.length; ++i) {
|
| + if (imageData.data[i] != referenceImageData.data[i]) {
|
| + imagesAreTheSame = false;
|
| + break;
|
| + }
|
| + }
|
| + assert_false(imagesAreTheSame);
|
| + t.done();
|
| }
|
| - }
|
| - shouldBeFalse("imagesAreTheSame");
|
| - if (window.testRunner)
|
| - testRunner.notifyDone();
|
| + });
|
| }
|
| - }
|
| - </script>
|
| +}, 'Verify that consecutive drawImage from a live video correctly propagates frame updates.');
|
| +</script>
|
| </body>
|
| -</html>
|
|
|