diff options
Diffstat (limited to 'dom/canvas/test/webgl-mochitest/ensure-exts')
19 files changed, 445 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js b/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js new file mode 100644 index 000000000..8d710139f --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js @@ -0,0 +1,44 @@ +'use strict'; + +function EnsureExt(extName, shouldHave=true) { + EnsureExtFor('webgl', extName, shouldHave); + EnsureExtFor('webgl2', extName, shouldHave); +} + +function EnsureExtFor(contextType, extName, shouldHave=true) { + var c = document.createElement('canvas'); + var gl = c.getContext(contextType); + + if (!gl) { + todo(false, 'Failed to create context: ' + contextType); + return; + } + + var ext = gl.getExtension(extName); + var haveText = ' have ' + contextType + ' extension ' + extName + '.'; + if (shouldHave) { + ok(ext, 'Should' + haveText); + } else { + ok(!ext, 'Should not' + haveText); + } +} + +function Lastly_WithDraftExtsEnabled(func) { + SimpleTest.waitForExplicitFinish(); + + var fnEnsure = function() { + func(); + SimpleTest.finish(); + }; + + if ('SpecialPowers' in window) { + var prefStateList = [ + ['webgl.enable-draft-extensions', true], + ]; + var prefEnv = {'set': prefStateList}; + SpecialPowers.pushPrefEnv(prefEnv, fnEnsure); + } else { + console.log('Couldn\'t use SpecialPowers to enable draft extensions.'); + fnEnsure(); + } +} diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html new file mode 100644 index 000000000..5905539a4 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'ANGLE_instanced_arrays'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html new file mode 100644 index 000000000..46b135b79 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'EXT_blend_minmax'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html new file mode 100644 index 000000000..443c7ab70 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'EXT_color_buffer_half_float'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html new file mode 100644 index 000000000..af94cbc65 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExt('EXT_disjoint_timer_query'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html new file mode 100644 index 000000000..9dbac9881 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'EXT_frag_depth'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html new file mode 100644 index 000000000..cbdde000a --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'EXT_sRGB'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html new file mode 100644 index 000000000..c3a51c0c9 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'EXT_shader_texture_lod'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html new file mode 100644 index 000000000..877c4440b --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExt('EXT_texture_filter_anisotropic'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html new file mode 100644 index 000000000..359726256 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'OES_standard_derivatives'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html new file mode 100644 index 000000000..9a88b2771 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'WEBGL_color_buffer_float'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html new file mode 100644 index 000000000..6d68f0b4e --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExt('WEBGL_compressed_texture_atc'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html new file mode 100644 index 000000000..9e6ade9f4 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html @@ -0,0 +1,19 @@ +<!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'; +Lastly_WithDraftExtsEnabled(function() { + EnsureExt('WEBGL_compressed_texture_es3'); +}); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html new file mode 100644 index 000000000..327625c01 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExt('WEBGL_compressed_texture_etc1'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html new file mode 100644 index 000000000..c95481398 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExt('WEBGL_compressed_texture_pvrtc'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html new file mode 100644 index 000000000..6ad800110 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExt('WEBGL_compressed_texture_s3tc'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html new file mode 100644 index 000000000..6d8a864c0 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'WEBGL_depth_texture'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html new file mode 100644 index 000000000..068351635 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html @@ -0,0 +1,17 @@ +<!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'; +EnsureExtFor('webgl', 'WEBGL_draw_buffers'); + + </script> + </body> +</html> 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> |