Implement Focus UI
[framework/web/webkit-efl.git] / LayoutTests / media / video-canvas-source.html
1 <html>
2     <head>
3         <title>Drawing to canvas using video with source element does not taint canvas</title>
4         <script src=media-file.js></script>
5         <script src=video-test.js></script>
6         <script src="../fast/js/resources/js-test-pre.js"></script>
7         <script>
8             var ctx;
9             var width;
10             var height;
11
12             function canplaythrough()
13             {
14                 width = video.videoWidth / 2;
15                 height = video.videoHeight / 2;
16
17                 ctx = canvas.getContext("2d");
18                 video.pause();
19                 ctx.drawImage(video, 0, 0, width, height);
20                 shouldBeTrue("!!ctx.getImageData(0, 0, width, height)");
21                 endTest();
22             }
23
24             function start()
25             {
26                 description("Test to ensure we don't taint a canvas when drawing from a video the uses source elements rather than the src attribute");
27                 findMediaElement();
28                 canvas = document.getElementsByTagName('canvas')[0];
29                 waitForEvent('canplaythrough', canplaythrough);
30                 var mediaFile = findMediaFile("video", "content/counting");
31                 disableFullTestDetailsPrinting();
32                 runSilently("var source = document.createElement('source'); source.src = '" + mediaFile + "'; video.appendChild(source)");
33                 enableFullTestDetailsPrinting();
34             }
35         </script>
36     </head>
37
38     <body onload="start()" >
39         <p id="description"></p>
40         <video controls="true"></video>
41         <canvas width="160" height="120" ></canvas>
42         <div id="console"></div>
43     </body>
44 </html>