Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/WebKit/PerformanceTests/Canvas/upload-video-to-texture.html

Issue 1644353002: Enable blink_perf.canvas on Android Perf bots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add --reduce-security-for-testing Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <video id="video" loop></video> 4 <video id="video" loop></video>
5 <script src="../resources/runner.js"></script> 5 <script src="../resources/runner.js"></script>
6 <script src="resources/canvas_runner.js"></script> 6 <script src="resources/canvas_runner.js"></script>
7 <script> 7 <script>
8 var videoElement = document.getElementById("video"); 8 var videoElement = document.getElementById("video");
9 var canvas3D = document.createElement('canvas'); 9 var canvas3D = document.createElement('canvas');
10 var gl = canvas3D.getContext('webgl'); 10 var gl = canvas3D.getContext('webgl');
11 if(!gl) 11 if(!gl)
12 CanvasRunner.logFatalError("\nWebGL is not supported or enabled on this plat form!\n"); 12 CanvasRunner.logFatalError("WebGL is not supported or enabled on this platfo rm!");
13 13
14 function setSize(width, height) { 14 function setSize(width, height) {
15 canvas3D.width = width; 15 canvas3D.width = width;
16 canvas3D.height = height; 16 canvas3D.height = height;
17 } 17 }
18 18
19 function addPlayCallback(videoElement) {
20 // This logic makes sure this perf test starts after playing the video.
21 videoElement.addEventListener("canplaythrough", startVideo, true);
22 videoElement.addEventListener("play", startPerfTest, true);
23 videoElement.addEventListener('error', function(ev) {
24 CanvasRunner.logFatalError("\nmp4 codec is not supported on this platfor m. Received error event:" + ev.target.error.code + "\n");
25 }, false);
26 videoElement.src = "../resources/bear-1280x720.mp4";
27 }
28
29 function startVideo() {
30 // loop can emit this event again.
31 videoElement.removeEventListener("canplaythrough", startVideo, true);
32 videoElement.play();
33 }
34
35 function startPerfTest() { 19 function startPerfTest() {
36 CanvasRunner.start({ 20 CanvasRunner.start({
37 description: "This bench test checks the speed on texImage2D(Video) on W ebgl.", 21 description: "This bench test checks the speed on texImage2D(Video) on W ebgl.",
38 preRun: preRun, 22 preRun: preRun,
39 doRun: doRun, 23 doRun: doRun,
40 ensureComplete: ensureComplete, 24 ensureComplete: ensureComplete,
41 postRun: postRun}); 25 postRun: postRun});
42 } 26 }
43 27
44 var flipYAndPremultipyAlphas = 28 var flipYAndPremultipyAlphas =
(...skipping 20 matching lines...) Expand all
65 function ensureComplete() { 49 function ensureComplete() {
66 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); 50 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));
67 } 51 }
68 52
69 function postRun() { 53 function postRun() {
70 gl.deleteTexture(tex); 54 gl.deleteTexture(tex);
71 } 55 }
72 56
73 window.onload = function () { 57 window.onload = function () {
74 setSize(1, 1); 58 setSize(1, 1);
75 addPlayCallback(videoElement); 59
60 videoElement.src = "resources/bear-1280x720.mp4";
61 if(!videoElement.canPlayType('video/mp4').replace(/no/, '')) {
62 CanvasRunner.logFatalError("video/mp4 is unsupported");
63 };
64 CanvasRunner.startPlayingAndWaitForVideo(videoElement, startPerfTest);
76 } 65 }
77 66
78 </script> 67 </script>
79 </body> 68 </body>
80 </html> 69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698