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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-canvas-source.html

Issue 2112003002: Convert video-canvas* and video-capture* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use timeupdate event Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-canvas-source-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Verify that drawing to canvas using video with source element does not ta int canvas</title>
3 <title>Drawing to canvas using video with source element does not taint canvas</title> 3 <script src="../resources/testharness.js"></script>
4 <script src=media-file.js></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 5 <script src="media-file.js"></script>
6 (Please avoid writing new tests using video-test.js) --> 6 <video></video>
7 <script src=video-test.js></script> 7 <canvas></canvas>
8 <script src="../resources/js-test.js"></script> 8 <script>
9 <script> 9 async_test(function(t) {
10 var ctx; 10 var video = document.querySelector("video");
11 var width; 11 var canvas = document.querySelector("canvas");
12 var height;
13 12
14 function canplaythrough() 13 video.oncanplaythrough = t.step_func_done(function() {
15 { 14 var width = video.videoWidth / 2;
16 width = video.videoWidth / 2; 15 var height = video.videoHeight / 2;
17 height = video.videoHeight / 2; 16 var ctx = canvas.getContext("2d");
17 video.pause();
18 ctx.drawImage(video, 0, 0, width, height);
19 assert_not_equals(ctx.getImageData(0, 0, width, height), null);
20 });
18 21
19 ctx = canvas.getContext("2d"); 22 var source = document.createElement("source");
20 video.pause(); 23 source.src = findMediaFile("video", "content/counting");
21 ctx.drawImage(video, 0, 0, width, height); 24 video.appendChild(source);
22 shouldBeTrue("!!ctx.getImageData(0, 0, width, height)"); 25 });
23 endTest(); 26 </script>
24 }
25
26 function start()
27 {
28 description("Test to ensure we don't taint a canvas when drawing from a video the uses source elements rather than the src attribute");
29 findMediaElement();
30 canvas = document.getElementsByTagName('canvas')[0];
31 waitForEvent('canplaythrough', canplaythrough);
32 var mediaFile = findMediaFile("video", "content/counting");
33 disableFullTestDetailsPrinting();
34 runSilently("var source = document.createElement('source'); sour ce.src = '" + mediaFile + "'; video.appendChild(source)");
35 enableFullTestDetailsPrinting();
36 }
37 </script>
38 </head>
39
40 <body onload="start()" >
41 <p id="description"></p>
42 <video controls></video>
43 <canvas width="160" height="120" ></canvas>
44 <div id="console"></div>
45 </body>
46 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-canvas-source-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698