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