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

Side by Side Diff: LayoutTests/inspector/profiler/webgl/webgl-profiler-api-changes.html

Issue 1073863003: DevTools: remove Canvas profiler from DevTools source base. See details in the bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tests gone Created 5 years, 8 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
(Empty)
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 function wasError(gl)
7 {
8 var result = false;
9 while (gl.getError() !== gl.NO_ERROR)
10 result = true;
11 return result;
12 }
13
14 function createWebGLContext()
15 {
16 var canvas = document.createElement("canvas");
17 var contextIds = ["experimental-webgl", "webkit-3d", "3d"];
18 for (var i = 0, contextId; contextId = contextIds[i]; ++i) {
19 var gl = canvas.getContext(contextId);
20 if (gl)
21 return gl;
22 }
23 output("ERROR: Could not create a WebGL context.");
24 return null;
25 }
26
27 WebGLRenderingContextResource = {};
28
29 /**
30 * @const
31 * @type {Array.<string>}
32 */
33 WebGLRenderingContextResource.GLCapabilities = [
34 "BLEND",
35 "CULL_FACE",
36 "DEPTH_TEST",
37 "DITHER",
38 "POLYGON_OFFSET_FILL",
39 "SAMPLE_ALPHA_TO_COVERAGE",
40 "SAMPLE_COVERAGE",
41 "SCISSOR_TEST",
42 "STENCIL_TEST"
43 ];
44
45 /**
46 * @const
47 * @type {Array.<string>}
48 */
49 WebGLRenderingContextResource.PixelStoreParameters = [
50 "PACK_ALIGNMENT",
51 "UNPACK_ALIGNMENT",
52 "UNPACK_COLORSPACE_CONVERSION_WEBGL",
53 "UNPACK_FLIP_Y_WEBGL",
54 "UNPACK_PREMULTIPLY_ALPHA_WEBGL"
55 ];
56
57 /**
58 * @const
59 * @type {Array.<string>}
60 */
61 WebGLRenderingContextResource.StateParameters = [
62 "ACTIVE_TEXTURE",
63 "ARRAY_BUFFER_BINDING",
64 "BLEND_COLOR",
65 "BLEND_DST_ALPHA",
66 "BLEND_DST_RGB",
67 "BLEND_EQUATION_ALPHA",
68 "BLEND_EQUATION_RGB",
69 "BLEND_SRC_ALPHA",
70 "BLEND_SRC_RGB",
71 "COLOR_CLEAR_VALUE",
72 "COLOR_WRITEMASK",
73 "CULL_FACE_MODE",
74 "CURRENT_PROGRAM",
75 "DEPTH_CLEAR_VALUE",
76 "DEPTH_FUNC",
77 "DEPTH_RANGE",
78 "DEPTH_WRITEMASK",
79 "ELEMENT_ARRAY_BUFFER_BINDING",
80 "FRAMEBUFFER_BINDING",
81 "FRONT_FACE",
82 "GENERATE_MIPMAP_HINT",
83 "LINE_WIDTH",
84 "PACK_ALIGNMENT",
85 "POLYGON_OFFSET_FACTOR",
86 "POLYGON_OFFSET_UNITS",
87 "RENDERBUFFER_BINDING",
88 "SAMPLE_COVERAGE_INVERT",
89 "SAMPLE_COVERAGE_VALUE",
90 "SCISSOR_BOX",
91 "STENCIL_BACK_FAIL",
92 "STENCIL_BACK_FUNC",
93 "STENCIL_BACK_PASS_DEPTH_FAIL",
94 "STENCIL_BACK_PASS_DEPTH_PASS",
95 "STENCIL_BACK_REF",
96 "STENCIL_BACK_VALUE_MASK",
97 "STENCIL_BACK_WRITEMASK",
98 "STENCIL_CLEAR_VALUE",
99 "STENCIL_FAIL",
100 "STENCIL_FUNC",
101 "STENCIL_PASS_DEPTH_FAIL",
102 "STENCIL_PASS_DEPTH_PASS",
103 "STENCIL_REF",
104 "STENCIL_VALUE_MASK",
105 "STENCIL_WRITEMASK",
106 "UNPACK_ALIGNMENT",
107 "UNPACK_COLORSPACE_CONVERSION_WEBGL",
108 "UNPACK_FLIP_Y_WEBGL",
109 "UNPACK_PREMULTIPLY_ALPHA_WEBGL",
110 "VIEWPORT"
111 ];
112
113 WebGLRenderingContextResource.TextureBindings = [
114 "TEXTURE_BINDING_2D",
115 "TEXTURE_BINDING_CUBE_MAP"
116 ];
117
118 function test()
119 {
120 var gl = createWebGLContext();
121 if (!gl)
122 return;
123
124 var constantNames = [];
125 for (var property in gl) {
126 if (/^[A-Z0-9_]+$/.test(property))
127 constantNames.push(property);
128 }
129 constantNames.sort();
130
131 output("Constants for gl.isEnabled():");
132 constantNames.forEach(function(property) {
133 wasError(gl);
134 gl.isEnabled(gl[property]);
135 if (!wasError(gl))
136 output(property);
137 });
138
139 output("\nConstants for gl.pixelStorei():");
140 constantNames.forEach(function(property) {
141 wasError(gl);
142 var value = gl.getParameter(gl[property]);
143 if (wasError(gl))
144 return;
145 gl.pixelStorei(gl[property], value);
146 if (!wasError(gl))
147 output(property);
148 });
149
150 output("\nConstants for gl.getTexParameter():");
151 var texture = gl.createTexture();
152 gl.bindTexture(gl.TEXTURE_2D, texture);
153 constantNames.forEach(function(property) {
154 wasError(gl);
155 gl.getTexParameter(gl.TEXTURE_2D, gl[property]);
156 if (!wasError(gl))
157 output(property);
158 });
159
160 output("\nConstants for gl.getVertexAttrib():");
161 constantNames.forEach(function(property) {
162 wasError(gl);
163 gl.getVertexAttrib(0, gl[property]);
164 if (!wasError(gl))
165 output(property);
166 });
167
168 output("\nConstants for gl.getVertexAttribOffset():");
169 constantNames.forEach(function(property) {
170 wasError(gl);
171 gl.getVertexAttribOffset(0, gl[property]);
172 if (!wasError(gl))
173 output(property);
174 });
175
176 output("\nConstants for gl.getParameter() that we do not track in InjectedSc riptModule:");
177 constantNames.forEach(function(property) {
178 // Special case for equal constants BLEND_EQUATION and BLEND_EQUATION_RG B.
179 if (property === "BLEND_EQUATION" && gl.BLEND_EQUATION === gl.BLEND_EQUA TION_RGB)
180 return;
181 if (WebGLRenderingContextResource.GLCapabilities.indexOf(property) !== - 1)
182 return;
183 if (WebGLRenderingContextResource.PixelStoreParameters.indexOf(property) !== -1)
184 return;
185 if (WebGLRenderingContextResource.StateParameters.indexOf(property) !== -1)
186 return;
187 if (WebGLRenderingContextResource.TextureBindings.indexOf(property) !== -1)
188 return;
189 wasError(gl);
190 gl.getParameter(gl[property]);
191 if (!wasError(gl))
192 output(property);
193 });
194 }
195
196 function runTest()
197 {
198 if (window.testRunner) {
199 testRunner.overridePreference("WebKitWebGLEnabled", "1");
200 testRunner.dumpAsText();
201 testRunner.waitUntilDone();
202 }
203 if (window.internals)
204 window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
205 try {
206 test();
207 } finally {
208 if (window.testRunner)
209 testRunner.notifyDone();
210 }
211 }
212
213 </script>
214 </head>
215 <body onload="runTest()">
216 <p>
217 Test to catch WebGL API changes.
218 If this test should ever fail, we should re-examine the WebGL state saving/resto ring logic in the
219 InjectedScriptModule to include any latest changes to the API.
220
221 </p>
222 </body>
223 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698