summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html')
-rw-r--r--dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html110
1 files changed, 110 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
new file mode 100644
index 000000000..153161d93
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset='utf-8'/>
+ <script src='/tests/SimpleTest/SimpleTest.js'></script>
+ <link rel='stylesheet' href='/tests/SimpleTest/test.css'>
+ <script src='ensure-ext.js'></script>
+ </head>
+ <body>
+ <script>
+
+'use strict';
+
+var ENSURE = 'ENSURE'; // Works on all test machines.
+var FORBID = 'FORBID'; // Should not work on any test machine.
+var MACHINE_SPECIFIC = 'MACHINE_SPECIFIC';
+
+var defaultExts = [
+ // Ratified
+ ['ANGLE_instanced_arrays' , [MACHINE_SPECIFIC, FORBID ]],
+ ['EXT_blend_minmax' , [MACHINE_SPECIFIC, FORBID ]],
+ ['EXT_disjoint_timer_query' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+ ['EXT_frag_depth' , [MACHINE_SPECIFIC, FORBID ]],
+ ['EXT_shader_texture_lod' , [MACHINE_SPECIFIC, FORBID ]],
+ ['EXT_texture_filter_anisotropic', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+ ['OES_element_index_uint' , [ENSURE , FORBID ]],
+ ['OES_standard_derivatives' , [MACHINE_SPECIFIC, FORBID ]],
+ ['OES_texture_float' , [ENSURE , FORBID ]],
+ ['OES_texture_float_linear' , [ENSURE , ENSURE ]],
+ ['OES_texture_half_float' , [ENSURE , FORBID ]],
+ ['OES_texture_half_float_linear' , [ENSURE , FORBID ]],
+ ['OES_vertex_array_object' , [ENSURE , FORBID ]],
+ ['WEBGL_compressed_texture_s3tc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+// ['WEBGL_debug_renderer_info' , [FORBID , FORBID ]], // Complicated!
+ ['WEBGL_debug_shaders' , [FORBID , FORBID ]],
+ ['WEBGL_depth_texture' , [MACHINE_SPECIFIC, FORBID ]],
+ ['WEBGL_draw_buffers' , [MACHINE_SPECIFIC, FORBID ]],
+ ['WEBGL_lose_context' , [ENSURE , ENSURE ]],
+
+ // Community Approved
+ ['EXT_color_buffer_float' , [FORBID , ENSURE ]],
+ ['EXT_color_buffer_half_float' , [MACHINE_SPECIFIC, FORBID ]],
+ ['EXT_sRGB' , [MACHINE_SPECIFIC, FORBID ]],
+ ['WEBGL_color_buffer_float' , [MACHINE_SPECIFIC, FORBID ]],
+ ['WEBGL_compressed_texture_atc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+ ['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+ ['WEBGL_compressed_texture_pvrtc', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+];
+
+var draftExts = [
+ ['WEBGL_compressed_texture_es3', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
+];
+
+var nonImplementedExts = [
+ 'OES_fbo_render_mipmap',
+ 'WEBGL_compressed_texture_astc',
+ 'WEBGL_security_sensitive_resources',
+ 'WEBGL_shared_resources',
+];
+
+////////////////////
+
+function TestExtFor(contextType, extName, status) {
+ switch (status) {
+ case ENSURE:
+ EnsureExtFor(contextType, extName);
+ break;
+
+ case FORBID:
+ EnsureExtFor(contextType, extName, false);
+ break;
+
+ case MACHINE_SPECIFIC:
+ break;
+ }
+}
+
+function TestExt(extName, statusArr) {
+ TestExtFor('webgl', extName, statusArr[0]);
+ TestExtFor('webgl2', extName, statusArr[1]);
+}
+
+////////////////////
+
+defaultExts.forEach(function(x) {
+ var extName = x[0];
+ var statusArr = x[1];
+ TestExt(extName, statusArr);
+});
+
+nonImplementedExts.forEach(function(extName) {
+ EnsureExt(extName, false);
+});
+
+draftExts.forEach(function(x) {
+ var extName = x[0];
+ EnsureExt(extName, false);
+});
+
+Lastly_WithDraftExtsEnabled(function() {
+ draftExts.forEach(function(x) {
+ var extName = x[0];
+ var statusArr = x[1];
+ TestExt(extName, statusArr);
+ });
+});
+
+ </script>
+ </body>
+</html>