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

Unified Diff: content/test/data/gpu/pixel_webgl_util.js

Issue 2023153002: Add more WebGL pixel tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments fmor kbr. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/test/data/gpu/pixel_webgl_util.js
diff --git a/content/test/data/gpu/pixel_webgl_util.js b/content/test/data/gpu/pixel_webgl_util.js
index b87e176b2f1dd47a88cb323c879707c3db26361a..e0ce45e329b92413063b95eaac1cfad31138ae06 100644
--- a/content/test/data/gpu/pixel_webgl_util.js
+++ b/content/test/data/gpu/pixel_webgl_util.js
@@ -23,11 +23,13 @@ var fragmentShader = [
"}"
].join("\n");
-function initGL(canvas)
+// TODO: We should test premultiplyAlpha as well.
+function initGL(canvas, antialias, alpha)
{
var gl = null;
try {
- gl = canvas.getContext("experimental-webgl");
+ gl = canvas.getContext("experimental-webgl",
+ {"alpha": alpha, "antialias":antialias});
} catch (e) {}
if (!gl) {
try {
@@ -93,3 +95,32 @@ function drawTriangle(gl) {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 3);
}
+
+var g_swapsBeforeAckUtil = 15;
+var g_glUtil;
+
+function makeMain(antialias, alpha)
+{
+ return function() {
+ var canvas = document.getElementById("c");
+ g_glUtil = initGL(canvas, antialias, alpha);
+ if (g_glUtil && setup(g_glUtil)) {
+ drawSomeFramesUtil();
+ } else {
+ domAutomationController.setAutomationId(1);
+ domAutomationController.send("FAILURE");
+ }
+ };
+}
+
+function drawSomeFramesUtil()
+{
+ if (g_swapsBeforeAckUtil == 0) {
+ domAutomationController.setAutomationId(1);
+ domAutomationController.send("SUCCESS");
+ } else {
+ g_swapsBeforeAckUtil--;
+ drawTriangle(g_glUtil);
+ window.webkitRequestAnimationFrame(drawSomeFramesUtil);
+ }
+}
« no previous file with comments | « content/test/data/gpu/pixel_webgl_noaa_noalpha.html ('k') | content/test/gpu/gpu_tests/pixel_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698