summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-mochitest/test_renderer_strings.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/canvas/test/webgl-mochitest/test_renderer_strings.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/test/webgl-mochitest/test_renderer_strings.html')
-rw-r--r--dom/canvas/test/webgl-mochitest/test_renderer_strings.html102
1 files changed, 102 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-mochitest/test_renderer_strings.html b/dom/canvas/test/webgl-mochitest/test_renderer_strings.html
new file mode 100644
index 000000000..4890abf91
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/test_renderer_strings.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+<script>
+
+function AssertError(gl, expected, info) {
+ var actual = gl.getError();
+ while (gl.getError()) {}
+
+ ok(actual == expected,
+ 'For ' + info + ', expected GL error 0x' + expected.toString(16) + ', got 0x'
+ + actual.toString(16));
+}
+
+var gl;
+
+var RENDERER_OVERRIDE = 'overridden renderer';
+var VENDOR_OVERRIDE = 'overridden vendor';
+
+function TestExt() {
+ var ext = gl.getExtension('WEBGL_debug_renderer_info');
+ ok(ext, 'When pref enabled: Should have access to \'WEBGL_debug_renderer_info\'.');
+ AssertError(gl, 0, 'start of test');
+
+ var renderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
+ AssertError(gl, 0, 'UNMASKED_RENDERER_WEBGL');
+ ok(renderer,
+ 'When pref enabled: UNMASKED_RENDERER_WEBGL value should not be empty, was \''
+ + renderer + '\'');
+
+ var vendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
+ AssertError(gl, 0, 'UNMASKED_VENDOR_WEBGL');
+ ok(vendor,
+ 'When pref enabled: UNMASKED_VENDOR_WEBGL value should not be empty, was \''
+ + vendor + '\'');
+
+ var prefArrArr = [
+ ['webgl.renderer-string-override', RENDERER_OVERRIDE],
+ ['webgl.vendor-string-override', VENDOR_OVERRIDE],
+ ];
+ var prefEnv = {'set': prefArrArr};
+ SpecialPowers.pushPrefEnv(prefEnv, TestOverrides);
+}
+
+function TestOverrides() {
+ var ext = gl.getExtension('WEBGL_debug_renderer_info');
+ ok(ext, 'When overrides set: Should have access to \'WEBGL_debug_renderer_info\'.');
+ AssertError(gl, 0, 'start of test');
+
+ var renderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
+ AssertError(gl, 0, 'UNMASKED_RENDERER_WEBGL');
+ ok(renderer == RENDERER_OVERRIDE,
+ 'When overrides set: UNMASKED_RENDERER_WEBGL value should be \'' + RENDERER_OVERRIDE
+ + '\', was \'' + renderer + '\'');
+
+ var vendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
+ AssertError(gl, 0, 'UNMASKED_VENDOR_WEBGL');
+ ok(vendor == VENDOR_OVERRIDE,
+ 'When overrides set: UNMASKED_VENDOR_WEBGL value should be \'' + VENDOR_OVERRIDE
+ + '\', was \'' + vendor + '\'');
+
+ var prefArrArr = [
+ ['webgl.enable-debug-renderer-info', false],
+ ];
+ var prefEnv = {'set': prefArrArr};
+ SpecialPowers.pushPrefEnv(prefEnv, TestDisable);
+}
+
+function TestDisable() {
+ var ext = gl.getExtension('WEBGL_debug_renderer_info');
+ ok(!ext,
+ 'When pref disabled: Should not have access to \'WEBGL_debug_renderer_info\'.');
+
+ ok(true, 'Test complete.');
+ SimpleTest.finish();
+}
+
+(function() {
+ var canvas = document.createElement('canvas');
+ gl = canvas.getContext('experimental-webgl');
+ if (!gl) {
+ todo(gl, 'Get WebGL working here first.');
+ ok(true, 'Test complete.');
+ return;
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ var prefArrArr = [
+ ['webgl.enable-debug-renderer-info', true],
+ ];
+ var prefEnv = {'set': prefArrArr};
+ SpecialPowers.pushPrefEnv(prefEnv, TestExt);
+})();
+
+</script>
+</body>
+</html>