test_video_fastpath.js (912B)
1 var gl; 2 var video; 3 4 function onPlayingTestVideo() { 5 video.removeEventListener("playing", onPlayingTestVideo, true); 6 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video); 7 is( 8 gl.getError(), 9 gl.NO_ERROR, 10 "texImage2D should not generate any error here." 11 ); 12 video.pause(); 13 SimpleTest.finish(); 14 } 15 16 function startTest(file) { 17 gl = document.createElement("canvas").getContext("webgl"); 18 ext = gl.getExtension("MOZ_debug"); 19 ok(ext, "MOZ_debug extenstion should exist"); 20 gl.bindTexture(gl.TEXTURE_2D, gl.createTexture()); 21 gl.pixelStorei(ext.UNPACK_REQUIRE_FASTPATH, true); 22 is( 23 gl.getError(), 24 gl.NO_ERROR, 25 "pixelStorei should not generate any error here." 26 ); 27 28 video = document.createElement("video"); 29 video.addEventListener("playing", onPlayingTestVideo, true); 30 video.preload = "auto"; 31 video.src = file; 32 video.loop = true; 33 video.play(); 34 }