Added: trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes.html (0 => 126856)
--- trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes.html (rev 0)
+++ trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes.html 2012-08-28 08:42:35 UTC (rev 126856)
@@ -0,0 +1,213 @@
+<html>
+<head>
+<script src=""
+<script>
+
+ if (window.testRunner) {
+ testRunner.overridePreference("WebKitWebGLEnabled", "1");
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function wasError(gl)
+{
+ var result = false;
+ while (gl.getError() !== gl.NO_ERROR)
+ result = true;
+ return result;
+}
+
+ function createWebGLContext()
+ {
+ var canvas = document.createElement("canvas");
+ var contextIds = ["experimental-webgl", "webkit-3d", "3d"];
+ for (var i = 0, contextId; contextId = contextIds[i]; ++i) {
+ var gl = canvas.getContext(contextId);
+ if (gl)
+ return gl;
+ }
+ output("ERROR: Could not create a WebGL context.");
+ return null;
+ }
+
+ WebGLRenderingContextResource = {};
+
+ /**
+ * @const
+ * @type {Array.<string>}
+ */
+ WebGLRenderingContextResource.GLCapabilities = [
+ "BLEND",
+ "CULL_FACE",
+ "DEPTH_TEST",
+ "DITHER",
+ "POLYGON_OFFSET_FILL",
+ "SAMPLE_ALPHA_TO_COVERAGE",
+ "SAMPLE_COVERAGE",
+ "SCISSOR_TEST",
+ "STENCIL_TEST"
+ ];
+
+ /**
+ * @const
+ * @type {Array.<string>}
+ */
+ WebGLRenderingContextResource.PixelStoreParameters = [
+ "PACK_ALIGNMENT",
+ "UNPACK_ALIGNMENT",
+ "UNPACK_COLORSPACE_CONVERSION_WEBGL",
+ "UNPACK_FLIP_Y_WEBGL",
+ "UNPACK_PREMULTIPLY_ALPHA_WEBGL"
+ ];
+
+ /**
+ * @const
+ * @type {Array.<string>}
+ */
+ WebGLRenderingContextResource.StateParameters = [
+ "ACTIVE_TEXTURE",
+ "ARRAY_BUFFER_BINDING",
+ "BLEND_COLOR",
+ "BLEND_DST_ALPHA",
+ "BLEND_DST_RGB",
+ "BLEND_EQUATION_ALPHA",
+ "BLEND_EQUATION_RGB",
+ "BLEND_SRC_ALPHA",
+ "BLEND_SRC_RGB",
+ "COLOR_CLEAR_VALUE",
+ "COLOR_WRITEMASK",
+ "CULL_FACE_MODE",
+ "CURRENT_PROGRAM",
+ "DEPTH_CLEAR_VALUE",
+ "DEPTH_FUNC",
+ "DEPTH_RANGE",
+ "DEPTH_WRITEMASK",
+ "ELEMENT_ARRAY_BUFFER_BINDING",
+ "FRAMEBUFFER_BINDING",
+ "FRONT_FACE",
+ "GENERATE_MIPMAP_HINT",
+ "LINE_WIDTH",
+ "PACK_ALIGNMENT",
+ "POLYGON_OFFSET_FACTOR",
+ "POLYGON_OFFSET_UNITS",
+ "RENDERBUFFER_BINDING",
+ "SAMPLE_COVERAGE_INVERT",
+ "SAMPLE_COVERAGE_VALUE",
+ "SCISSOR_BOX",
+ "STENCIL_BACK_FAIL",
+ "STENCIL_BACK_FUNC",
+ "STENCIL_BACK_PASS_DEPTH_FAIL",
+ "STENCIL_BACK_PASS_DEPTH_PASS",
+ "STENCIL_BACK_REF",
+ "STENCIL_BACK_VALUE_MASK",
+ "STENCIL_BACK_WRITEMASK",
+ "STENCIL_CLEAR_VALUE",
+ "STENCIL_FAIL",
+ "STENCIL_FUNC",
+ "STENCIL_PASS_DEPTH_FAIL",
+ "STENCIL_PASS_DEPTH_PASS",
+ "STENCIL_REF",
+ "STENCIL_VALUE_MASK",
+ "STENCIL_WRITEMASK",
+ "UNPACK_ALIGNMENT",
+ "UNPACK_COLORSPACE_CONVERSION_WEBGL",
+ "UNPACK_FLIP_Y_WEBGL",
+ "UNPACK_PREMULTIPLY_ALPHA_WEBGL",
+ "VIEWPORT"
+ ];
+
+ WebGLRenderingContextResource.TextureBindings = [
+ "TEXTURE_BINDING_2D",
+ "TEXTURE_BINDING_CUBE_MAP"
+ ];
+
+ function test()
+{
+ var gl = createWebGLContext();
+
+ var constantNames = [];
+ for (var property in gl) {
+ if (/^[A-Z0-9_]+$/.test(property))
+ constantNames.push(property);
+ }
+ constantNames.sort();
+
+ output("Constants for gl.isEnabled():");
+ constantNames.forEach(function(property) {
+ wasError(gl);
+ gl.isEnabled(gl[property]);
+ if (!wasError(gl))
+ output(property);
+ });
+
+ output("\nConstants for gl.pixelStorei():");
+ constantNames.forEach(function(property) {
+ wasError(gl);
+ var value = gl.getParameter(gl[property]);
+ if (wasError(gl))
+ return;
+ gl.pixelStorei(gl[property], value);
+ if (!wasError(gl))
+ output(property);
+ });
+
+ output("\nConstants for gl.getTexParameter():");
+ var texture = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ constantNames.forEach(function(property) {
+ wasError(gl);
+ gl.getTexParameter(gl.TEXTURE_2D, gl[property]);
+ if (!wasError(gl))
+ output(property);
+ });
+
+ output("\nConstants for gl.getVertexAttrib():");
+ constantNames.forEach(function(property) {
+ wasError(gl);
+ gl.getVertexAttrib(0, gl[property]);
+ if (!wasError(gl))
+ output(property);
+ });
+
+ output("\nConstants for gl.getVertexAttribOffset():");
+ constantNames.forEach(function(property) {
+ wasError(gl);
+ gl.getVertexAttribOffset(0, gl[property]);
+ if (!wasError(gl))
+ output(property);
+ });
+
+ output("\nConstants for gl.getParameter() that we do not track in InjectedScriptModule:");
+ constantNames.forEach(function(property) {
+ // Special case for equal constants BLEND_EQUATION and BLEND_EQUATION_RGB.
+ if (property === "BLEND_EQUATION" && gl.BLEND_EQUATION === gl.BLEND_EQUATION_RGB)
+ return;
+ if (WebGLRenderingContextResource.GLCapabilities.indexOf(property) !== -1)
+ return;
+ if (WebGLRenderingContextResource.PixelStoreParameters.indexOf(property) !== -1)
+ return;
+ if (WebGLRenderingContextResource.StateParameters.indexOf(property) !== -1)
+ return;
+ if (WebGLRenderingContextResource.TextureBindings.indexOf(property) !== -1)
+ return;
+ wasError(gl);
+ gl.getParameter(gl[property]);
+ if (!wasError(gl))
+ output(property);
+ });
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+</script>
+</head>
+<body _onload_="test()">
+<p>
+Test to catch WebGL API changes.
+If this test should ever fail, we should re-examine the WebGL state saving/restoring logic in the
+InjectedScriptModule to include any latest changes to the API.
+
+</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes.html
___________________________________________________________________