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

Side by Side Diff: third_party/WebKit/PerformanceTests/Canvas/upload-video-to-sub-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
36 function startPerfTest() { 19 function startPerfTest() {
37 CanvasRunner.start({ 20 CanvasRunner.start({
38 description: "This bench test checks the speed on texSubImage2D(Video) o n Webgl.", 21 description: "This bench test checks the speed on texSubImage2D(Video) o n Webgl.",
39 preRun: preRun, 22 preRun: preRun,
40 doRun: doRun, 23 doRun: doRun,
41 ensureComplete: ensureComplete, 24 ensureComplete: ensureComplete,
42 postRun: postRun}); 25 postRun: postRun});
43 } 26 }
44 27
45 var flipYAndPremultipyAlphas = 28 var flipYAndPremultipyAlphas =
(...skipping 21 matching lines...) Expand all
67 function ensureComplete() { 50 function ensureComplete() {
68 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); 51 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));
69 } 52 }
70 53
71 function postRun() { 54 function postRun() {
72 gl.deleteTexture(tex); 55 gl.deleteTexture(tex);
73 } 56 }
74 57
75 window.onload = function () { 58 window.onload = function () {
76 setSize(1, 1); 59 setSize(1, 1);
77 addPlayCallback(videoElement); 60
61 videoElement.src = "resources/bear-1280x720.mp4";
62 if(!videoElement.canPlayType('video/mp4').replace(/no/, '')) {
63 CanvasRunner.logFatalError("video/mp4 is unsupported");
64 };
65 CanvasRunner.startPlayingAndWaitForVideo(videoElement, startPerfTest);
78 } 66 }
79 67
80 </script> 68 </script>
81 </body> 69 </body>
82 </html> 70 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698