OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <script src="/resources/testharness.js"></script> |
3 <body onload="start()"> | 3 <script src="/resources/testharnessreport.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../../media-resources/media-file.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <canvas></canvas> |
6 <script src=../../media-resources/video-test.js></script> | 6 <script> |
7 <script src=../../media-resources/media-file.js></script> | 7 async_test(function(t) { |
8 <script> | 8 var video = document.createElement("video"); |
9 waitForEvent('error', function() { | 9 video.crossOrigin = "anonymous"; |
10 failTest("error: " + JSON.stringify(video.error)); | |
11 }); | |
12 | 10 |
13 waitForEvent('playing', function() { | 11 video.onerror = t.unreached_func(); |
14 try { | 12 video.onplaying = t.step_func_done(function() { |
15 var ctx = document.getElementsByTagName('canvas')[0].getContext("2
d"); | 13 var ctx = document.querySelector("canvas").getContext("2d"); |
16 ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); | 14 ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); |
17 ctx.getImageData(0, 0, video.videoWidth, video.videoHeight); | 15 ctx.getImageData(0, 0, video.videoWidth, video.videoHeight); |
18 } catch (e) { | 16 }); |
19 failTest("Caught error: " + e); | |
20 } | |
21 endTest(); | |
22 }); | |
23 | 17 |
24 function start() { | 18 document.body.appendChild(video); |
25 mediaElement = video = document.createElement("video"); | 19 var mediaFile = findMediaFile("video", "../../media/resources/test"); |
26 mediaElement.crossOrigin = "anonymous"; | 20 var type = mimeTypeForExtension(mediaFile.split('.').pop()); |
27 document.body.appendChild(mediaElement); | 21 video.src = "http://localhost:8080/security/resources/video-cross-origin-all
ow.php?no-preflight&name=" + mediaFile + "&type=" + type; |
28 var mediaFile = findMediaFile("video", "../../media/resources/test")
; | 22 video.play(); |
29 var type = mimeTypeForExtension(mediaFile.split('.').pop()); | 23 }); |
30 video.src = "http://localhost:8080/security/resources/video-cross-or
igin-allow.php?no-preflight&name=" + mediaFile + "&type=" + type; | 24 </script> |
31 video.play(); | |
32 } | |
33 </script> | |
34 <canvas></canvas> | |
35 </body> | |
36 </head> | |
OLD | NEW |