4 <script src=
"media-file.js"></script>
7 if (window
.testRunner
) {
8 testRunner
.waitUntilDone();
12 var video
= document
.getElementsByTagName('video')[0];
13 video
.src
= findMediaFile("video", "content/test");
15 var canvas1
= document
.getElementById('canvas1');
16 var canvas2
= document
.getElementById('canvas2');
17 var ctx1
= canvas1
.getContext('2d');
18 var ctx2
= canvas2
.getContext('2d');
21 video
.addEventListener("canplay", function (e
) {
22 ctx1
.fillStyle
= ctx1
.createPattern(video
, 'repeat');
23 ctx1
.fillRect(0, 0, 320, 240);
25 ctx2
.drawImage(video
, 0, 0);
27 if (window
.testRunner
) {
28 testRunner
.notifyDone();
35 <body onload=
"onLoad();">
36 Test to verify that drawing a video to a
2D canvas with drawImage and with a CanvasPattern works as expected.
38 <canvas id=
"canvas1" width=
"320px" height=
"240px"></canvas>
39 <canvas id=
"canvas2" width=
"320px" height=
"240px"></canvas>