Index: LayoutTests/inspector/profiler/webgl/webgl-profiler-get-error.html |
diff --git a/LayoutTests/inspector/profiler/webgl/webgl-profiler-get-error.html b/LayoutTests/inspector/profiler/webgl/webgl-profiler-get-error.html |
deleted file mode 100644 |
index 586842b0839cf5cbae08fd6dae6975f171d8d8db..0000000000000000000000000000000000000000 |
--- a/LayoutTests/inspector/profiler/webgl/webgl-profiler-get-error.html |
+++ /dev/null |
@@ -1,189 +0,0 @@ |
-<html> |
-<head> |
- <script src="../../../http/tests/inspector/inspector-test.js"></script> |
- <script src="../canvas-profiler-test.js"></script> |
-<script> |
-if (window.internals) |
- window.internals.settings.setWebGLErrorsToConsoleEnabled(false); |
- |
-/** |
- * @constructor |
- */ |
-function Cache() |
-{ |
- this.reset(); |
-} |
- |
-Cache.prototype = { |
- /** |
- * @return {number} |
- */ |
- size: function() |
- { |
- return this._size; |
- }, |
- |
- reset: function() |
- { |
- /** @type {!Object.<number, Object>} */ |
- this._items = Object.create(null); |
- /** @type {number} */ |
- this._size = 0; |
- }, |
- |
- /** |
- * @param {number} key |
- * @return {boolean} |
- */ |
- has: function(key) |
- { |
- return key in this._items; |
- }, |
- |
- /** |
- * @param {number} key |
- * @return {Object} |
- */ |
- get: function(key) |
- { |
- return this._items[key]; |
- }, |
- |
- /** |
- * @param {number} key |
- * @param {Object} item |
- */ |
- put: function(key, item) |
- { |
- if (!this.has(key)) |
- ++this._size; |
- this._items[key] = item; |
- } |
-} |
- |
-var gl; |
-var rawGL; |
-var glResource; |
- |
-function assertNoErrors(gl) |
-{ |
- console.assert(gl.getError() === gl.NO_ERROR, "No GL error was expected at this time"); |
-} |
- |
-function assertEqualArrays(a, b) |
-{ |
- console.assert(a.length === b.length, "assertEqualArrays: a.length=" + a.length + ", b.length=" + b.length); |
- a = a.slice(); |
- b = b.slice(); |
- a.sort(); |
- b.sort(); |
- a.forEach(function(element, index) { |
- console.assert(a[index] === b[index], "assertEqualArrays: different values at index " + index); |
- }); |
-} |
- |
-function generateWebGLError(gl, error) |
-{ |
- switch (error) { |
- case gl.INVALID_ENUM: |
- gl.pixelStorei(123, 234); |
- break; |
- case gl.INVALID_VALUE: |
- gl.pixelStorei(gl.PACK_ALIGNMENT, 234); |
- break; |
- case gl.INVALID_OPERATION: |
- default: |
- gl.generateMipmap(gl.TEXTURE_CUBE_MAP); |
- break; |
- } |
-} |
- |
-function getAllErrors(gl) |
-{ |
- var errors = []; |
- while (true) { |
- var error = gl.getError(); |
- if (error === gl.NO_ERROR) |
- break; |
- console.assert(typeof error === "number", "getError() should return a number instead of a " + (typeof error)); |
- errors.push(error); |
- } |
- return errors; |
-} |
- |
-function createAndRunWebGLProgram() |
-{ |
- gl = createWebGLContext(); |
- console.assert(gl, "Failed to create WebGL context"); |
- |
- glResource = gl["__resourceObject"]; |
- console.assert(glResource, "WebGL context is not wrapped"); |
- |
- rawGL = glResource.wrappedObject(); |
- console.assert(rawGL, "No raw WebGL context found"); |
- console.assert(gl !== rawGL, "Proxy and RAW contexts should not be the same"); |
- |
- assertNoErrors(gl); |
- assertNoErrors(rawGL); |
- |
- // 1) Generate errors directly on the RAW context |
- // 2) Pick them via proxy. |
- var errors = [rawGL.INVALID_ENUM, rawGL.INVALID_VALUE, rawGL.INVALID_OPERATION]; |
- errors.forEach(generateWebGLError.bind(this, rawGL)); |
- assertEqualArrays(errors, getAllErrors(gl)); |
- assertNoErrors(gl); |
- assertNoErrors(rawGL); |
- |
- // 1) Generate errors on RAW context |
- // 2) Convert Resource to a Replayable => this should clean up the RAW context and save the errors in proxy |
- // 3) Check that RAW context no longer have errors |
- // 4) Check that proxy still has the original errors saved |
- var errors = [rawGL.INVALID_ENUM, rawGL.INVALID_VALUE, rawGL.INVALID_OPERATION]; |
- errors.forEach(generateWebGLError.bind(this, rawGL)); |
- glResource.toReplayable(new Cache()); |
- assertNoErrors(rawGL); |
- assertEqualArrays(errors, getAllErrors(gl)); |
- assertNoErrors(gl); |
- |
- // 1) Repeat 1-3 steps from the above |
- // 2) Check proxy and RAW errors interleaved |
- var errors = [rawGL.INVALID_ENUM, rawGL.INVALID_VALUE, rawGL.INVALID_OPERATION]; |
- errors.forEach(generateWebGLError.bind(this, rawGL)); |
- glResource.toReplayable(new Cache()); |
- assertNoErrors(rawGL); |
- |
- var value = gl.getError(); |
- console.assert(typeof value === "number", "getError() should return a number instead of a " + (typeof value)); |
- console.assert(value !== gl.NO_ERROR, "An error was expected"); |
- errors.forEach(generateWebGLError.bind(this, rawGL)); // Generate again in the RAW context. |
- // Now we "have" 2 errors left in the proxy and 3 new errors in the RAW context => should return 3 errors from the proxy. |
- assertEqualArrays(errors, getAllErrors(gl)); |
- assertNoErrors(gl); |
- assertNoErrors(rawGL); |
- |
- return "SUCCESS"; |
-} |
- |
-function test() |
-{ |
- InspectorTest.enableCanvasAgent(step1); |
- function step1() |
- { |
- InspectorTest.evaluateInPage("createAndRunWebGLProgram()", step2); |
- } |
- function step2(error) |
- { |
- InspectorTest.assertEquals("SUCCESS", error.description); |
- InspectorTest.completeTest(); |
- } |
-} |
- |
-</script> |
-</head> |
-<body onload="runTest()"> |
-<p> |
-Tests WebGL getError() status. |
-</p> |
-<a href="https://bugs.webkit.org/show_bug.cgi?id=95443">Bug 95443</a> |
-</body> |
-</html> |