Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE html> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <meta charset="utf-8"> |
michael@0 | 10 | <title>WebGL WebGL_debug_renderer_info Conformance Tests</title> |
michael@0 | 11 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 12 | <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script> |
michael@0 | 13 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 14 | <script src="../resources/webgl-test.js"></script> |
michael@0 | 15 | <script src="../resources/webgl-test-utils.js"></script> |
michael@0 | 16 | </head> |
michael@0 | 17 | <body> |
michael@0 | 18 | <div id="description"></div> |
michael@0 | 19 | <canvas id="canvas" style="width: 1px; height: 1px;"> </canvas> |
michael@0 | 20 | <div id="console"></div> |
michael@0 | 21 | <!-- Shaders for testing standard derivatives --> |
michael@0 | 22 | |
michael@0 | 23 | <script> |
michael@0 | 24 | description("This test verifies the functionality of the WEBGL_debug_renderer_info extension, if it is available."); |
michael@0 | 25 | |
michael@0 | 26 | debug(""); |
michael@0 | 27 | |
michael@0 | 28 | var wtu = WebGLTestUtils; |
michael@0 | 29 | var gl = wtu.create3DContext("canvas"); |
michael@0 | 30 | var ext = null; |
michael@0 | 31 | var vao = null; |
michael@0 | 32 | |
michael@0 | 33 | if (!gl) { |
michael@0 | 34 | testFailed("WebGL context does not exist"); |
michael@0 | 35 | } else { |
michael@0 | 36 | testPassed("WebGL context exists"); |
michael@0 | 37 | |
michael@0 | 38 | // Run tests with extension disabled |
michael@0 | 39 | runTestDisabled(); |
michael@0 | 40 | |
michael@0 | 41 | // Query the extension and store globally so shouldBe can access it |
michael@0 | 42 | ext = gl.getExtension("WEBGL_debug_renderer_info"); |
michael@0 | 43 | if (!ext) { |
michael@0 | 44 | testPassed("No WEBGL_debug_renderer_info support -- this is legal"); |
michael@0 | 45 | |
michael@0 | 46 | runSupportedTest(false); |
michael@0 | 47 | } else { |
michael@0 | 48 | testPassed("Successfully enabled WEBGL_debug_renderer_info extension"); |
michael@0 | 49 | |
michael@0 | 50 | runSupportedTest(true); |
michael@0 | 51 | runTestEnabled(); |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function runSupportedTest(extensionEnabled) { |
michael@0 | 56 | var supported = gl.getSupportedExtensions(); |
michael@0 | 57 | if (supported.indexOf("WEBGL_debug_renderer_info") >= 0) { |
michael@0 | 58 | if (extensionEnabled) { |
michael@0 | 59 | testPassed("WEBGL_debug_renderer_info listed as supported and getExtension succeeded"); |
michael@0 | 60 | } else { |
michael@0 | 61 | testFailed("WEBGL_debug_renderer_info listed as supported but getExtension failed"); |
michael@0 | 62 | } |
michael@0 | 63 | } else { |
michael@0 | 64 | if (extensionEnabled) { |
michael@0 | 65 | testFailed("WEBGL_debug_renderer_info not listed as supported but getExtension succeeded"); |
michael@0 | 66 | } else { |
michael@0 | 67 | testPassed("WEBGL_debug_renderer_info not listed as supported and getExtension failed -- this is legal"); |
michael@0 | 68 | } |
michael@0 | 69 | } |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | function runTestDisabled() { |
michael@0 | 73 | debug("Testing enums with extension disabled"); |
michael@0 | 74 | |
michael@0 | 75 | // Use the constants directly as we don't have the extension |
michael@0 | 76 | |
michael@0 | 77 | var UNMASKED_VENDOR_WEBGL = 0x9245; |
michael@0 | 78 | gl.getParameter(UNMASKED_VENDOR_WEBGL); |
michael@0 | 79 | glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_VENDOR_WEBGL should not be queryable if extension is disabled"); |
michael@0 | 80 | |
michael@0 | 81 | var UNMASKED_RENDERER_WEBGL = 0x9246; |
michael@0 | 82 | gl.getParameter(UNMASKED_RENDERER_WEBGL); |
michael@0 | 83 | glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_RENDERER_WEBGL should not be queryable if extension is disabled"); |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | function runTestEnabled() { |
michael@0 | 87 | debug("Testing enums with extension enabled"); |
michael@0 | 88 | |
michael@0 | 89 | shouldBe("ext.UNMASKED_VENDOR_WEBGL", "0x9245"); |
michael@0 | 90 | gl.getParameter(ext.UNMASKED_VENDOR_WEBGL); |
michael@0 | 91 | glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_VENDOR_WEBGL query should succeed if extension is enable"); |
michael@0 | 92 | |
michael@0 | 93 | shouldBe("ext.UNMASKED_RENDERER_WEBGL", "0x9246"); |
michael@0 | 94 | gl.getParameter(ext.UNMASKED_RENDERER_WEBGL); |
michael@0 | 95 | glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_RENDERER_WEBGL query should succeed if extension is enable"); |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | debug(""); |
michael@0 | 99 | successfullyParsed = true; |
michael@0 | 100 | </script> |
michael@0 | 101 | <script>finishTest();</script> |
michael@0 | 102 | |
michael@0 | 103 | </body> |
michael@0 | 104 | </html> |