no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / dom / canvas / test / webgl-mochitest / ensure-exts / test_common.html
blobce2ee33d3820ca3ca677a14ddb03e7dd5532aa4d
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset='utf-8'/>
5 <script src='/tests/SimpleTest/SimpleTest.js'></script>
6 <link rel='stylesheet' href='/tests/SimpleTest/test.css'>
7 <script src='ensure-ext.js'></script>
8 </head>
9 <body>
10 <script>
12 'use strict';
14 var ENSURE = 'ENSURE'; // Works on all test machines.
15 var FORBID = 'FORBID'; // Should not work on any test machine.
16 var MACHINE_SPECIFIC = 'MACHINE_SPECIFIC';
18 var defaultExts = [
19 // Ratified
20 ['ANGLE_instanced_arrays' , [MACHINE_SPECIFIC, FORBID ]],
21 ['EXT_blend_minmax' , [MACHINE_SPECIFIC, FORBID ]],
22 ['EXT_frag_depth' , [MACHINE_SPECIFIC, FORBID ]],
23 ['EXT_shader_texture_lod' , [MACHINE_SPECIFIC, FORBID ]],
24 ['EXT_texture_filter_anisotropic', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
25 ['OES_element_index_uint' , [ENSURE , FORBID ]],
26 ['OES_fbo_render_mipmap' , [MACHINE_SPECIFIC, FORBID ]],
27 ['OES_standard_derivatives' , [MACHINE_SPECIFIC, FORBID ]],
28 ['OES_texture_float' , [ENSURE , FORBID ]],
29 ['OES_texture_float_linear' , [ENSURE , ENSURE ]],
30 ['OES_texture_half_float' , [ENSURE , FORBID ]],
31 ['OES_texture_half_float_linear' , [ENSURE , FORBID ]],
32 ['OES_vertex_array_object' , [ENSURE , FORBID ]],
33 ['WEBGL_compressed_texture_s3tc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
34 ['WEBGL_debug_renderer_info' , [ENSURE , ENSURE ]],
35 ['WEBGL_debug_shaders' , [ENSURE , ENSURE ]],
36 ['WEBGL_depth_texture' , [MACHINE_SPECIFIC, FORBID ]],
37 ['WEBGL_draw_buffers' , [MACHINE_SPECIFIC, FORBID ]],
38 ['WEBGL_lose_context' , [ENSURE , ENSURE ]],
40 // Community Approved
41 ['EXT_color_buffer_float' , [FORBID , ENSURE ]],
42 ['EXT_color_buffer_half_float' , [MACHINE_SPECIFIC, FORBID ]],
43 ['EXT_depth_clamp' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
44 ['EXT_disjoint_timer_query' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
45 ['EXT_float_blend' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
46 ['EXT_sRGB' , [MACHINE_SPECIFIC, FORBID ]],
47 ['EXT_texture_compression_bptc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
48 ['EXT_texture_compression_rgtc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
49 ['OES_draw_buffers_indexed' , [FORBID , MACHINE_SPECIFIC]],
50 ['OVR_multiview2' , [FORBID , MACHINE_SPECIFIC]],
51 ['WEBGL_color_buffer_float' , [MACHINE_SPECIFIC, FORBID ]],
52 ['WEBGL_compressed_texture_astc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
53 ['WEBGL_compressed_texture_atc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
54 ['WEBGL_compressed_texture_etc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
55 ['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
56 ['WEBGL_compressed_texture_pvrtc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
57 ['WEBGL_compressed_texture_s3tc_srgb', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
58 ['WEBGL_provoking_vertex' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
61 var draftExts = [
62 ['EXT_texture_norm16' , [FORBID , MACHINE_SPECIFIC]],
63 ['WEBGL_explicit_present' , [ENSURE , ENSURE ]],
66 ////////////////////
67 // Ensure that we never see any extensions that we haven't listed above!
69 (function() {
70 const expectedExts = (defaultExts.concat(draftExts)).map(x => x[0]);
72 ['webgl', 'webgl2'].forEach( contextType => {
73 const c = document.createElement('canvas');
74 const gl = c.getContext(contextType);
75 if (!gl) return;
77 const actualExts = gl.getSupportedExtensions();
78 actualExts.forEach(actualExt => {
79 ok(expectedExts.includes(actualExt), 'Unexpected ext: ' + actualExt);
80 });
81 });
82 })();
84 ////////////////////
86 function TestExtFor(contextType, extName, status) {
87 switch (status) {
88 case ENSURE:
89 EnsureExtFor(contextType, extName);
90 break;
92 case FORBID:
93 EnsureExtFor(contextType, extName, false);
94 break;
96 case MACHINE_SPECIFIC:
97 break;
101 function TestExt(extName, statusArr) {
102 TestExtFor('webgl', extName, statusArr[0]);
103 TestExtFor('webgl2', extName, statusArr[1]);
106 ////////////////////
108 defaultExts.forEach(function(x) {
109 var extName = x[0];
110 var statusArr = x[1];
111 TestExt(extName, statusArr);
114 draftExts.forEach(function(x) {
115 var extName = x[0];
116 EnsureExt(extName, false);
119 Lastly_WithDraftExtsEnabled(function() {
120 draftExts.forEach(function(x) {
121 var extName = x[0];
122 var statusArr = x[1];
123 TestExt(extName, statusArr);
127 </script>
128 </body>
129 </html>