Title: [126856] trunk/LayoutTests
Revision
126856
Author
[email protected]
Date
2012-08-28 01:42:35 -0700 (Tue, 28 Aug 2012)

Log Message

Web Inspector: [WebGL] Add a test to catch new WebGL context states parameters
https://bugs.webkit.org/show_bug.cgi?id=94941

Patch by Andrey Adaikin <[email protected]> on 2012-08-28
Reviewed by Kenneth Russell.

Adds a test to catch changes in WebGL API so that we don't miss new WebGL state parameters
and could update WebGL state saving/restoring logic in the InjectedScriptWebGLModuleSource.js

* inspector/profiler/webgl-profiler-api-changes-expected.txt: Added.
* inspector/profiler/webgl-profiler-api-changes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126855 => 126856)


--- trunk/LayoutTests/ChangeLog	2012-08-28 08:32:29 UTC (rev 126855)
+++ trunk/LayoutTests/ChangeLog	2012-08-28 08:42:35 UTC (rev 126856)
@@ -1,3 +1,16 @@
+2012-08-28  Andrey Adaikin  <[email protected]>
+
+        Web Inspector: [WebGL] Add a test to catch new WebGL context states parameters
+        https://bugs.webkit.org/show_bug.cgi?id=94941
+
+        Reviewed by Kenneth Russell.
+
+        Adds a test to catch changes in WebGL API so that we don't miss new WebGL state parameters
+        and could update WebGL state saving/restoring logic in the InjectedScriptWebGLModuleSource.js
+
+        * inspector/profiler/webgl-profiler-api-changes-expected.txt: Added.
+        * inspector/profiler/webgl-profiler-api-changes.html: Added.
+
 2012-08-28  Kentaro Hara  <[email protected]>
 
         Unreviewed, rolling out r126852.

Added: trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes-expected.txt (0 => 126856)


--- trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes-expected.txt	2012-08-28 08:42:35 UTC (rev 126856)
@@ -0,0 +1,67 @@
+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.
+
+Constants for gl.isEnabled():
+BLEND
+CULL_FACE
+DEPTH_TEST
+DITHER
+POLYGON_OFFSET_FILL
+SAMPLE_ALPHA_TO_COVERAGE
+SAMPLE_COVERAGE
+SCISSOR_TEST
+STENCIL_TEST
+
+Constants for gl.pixelStorei():
+PACK_ALIGNMENT
+UNPACK_ALIGNMENT
+UNPACK_COLORSPACE_CONVERSION_WEBGL
+UNPACK_FLIP_Y_WEBGL
+UNPACK_PREMULTIPLY_ALPHA_WEBGL
+
+Constants for gl.getTexParameter():
+TEXTURE_MAG_FILTER
+TEXTURE_MIN_FILTER
+TEXTURE_WRAP_S
+TEXTURE_WRAP_T
+
+Constants for gl.getVertexAttrib():
+CURRENT_VERTEX_ATTRIB
+VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
+VERTEX_ATTRIB_ARRAY_ENABLED
+VERTEX_ATTRIB_ARRAY_NORMALIZED
+VERTEX_ATTRIB_ARRAY_SIZE
+VERTEX_ATTRIB_ARRAY_STRIDE
+VERTEX_ATTRIB_ARRAY_TYPE
+
+Constants for gl.getVertexAttribOffset():
+VERTEX_ATTRIB_ARRAY_POINTER
+
+Constants for gl.getParameter() that we do not track in InjectedScriptModule:
+ALIASED_LINE_WIDTH_RANGE
+ALIASED_POINT_SIZE_RANGE
+ALPHA_BITS
+BLUE_BITS
+COMPRESSED_TEXTURE_FORMATS
+DEPTH_BITS
+GREEN_BITS
+MAX_COMBINED_TEXTURE_IMAGE_UNITS
+MAX_CUBE_MAP_TEXTURE_SIZE
+MAX_FRAGMENT_UNIFORM_VECTORS
+MAX_RENDERBUFFER_SIZE
+MAX_TEXTURE_IMAGE_UNITS
+MAX_TEXTURE_SIZE
+MAX_VARYING_VECTORS
+MAX_VERTEX_ATTRIBS
+MAX_VERTEX_TEXTURE_IMAGE_UNITS
+MAX_VERTEX_UNIFORM_VECTORS
+MAX_VIEWPORT_DIMS
+RED_BITS
+RENDERER
+SAMPLES
+SAMPLE_BUFFERS
+SHADING_LANGUAGE_VERSION
+STENCIL_BITS
+SUBPIXEL_BITS
+VENDOR
+VERSION
+
Property changes on: trunk/LayoutTests/inspector/profiler/webgl-profiler-api-changes-expected.txt
___________________________________________________________________

Added: svn:eol-style

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
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to