content/canvas/test/webgl-mochitest/test_webgl_available.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>WebGL test: Check that WebGL works (or not) if it should (or should not).</title>
michael@0 5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
michael@0 7 <script src="webgl-util.js"></script>
michael@0 8 <script src="driver-info.js"></script>
michael@0 9 </head>
michael@0 10 <body>
michael@0 11 <canvas id="c"></canvas>
michael@0 12 <script>
michael@0 13
michael@0 14 function test() {
michael@0 15 ok(SpecialPowers.getBoolPref('webgl.force-enabled'), 'WebGL should be force-enabled.');
michael@0 16
michael@0 17 var shouldSucceed = true;
michael@0 18 var shouldFail = false;
michael@0 19
michael@0 20 if (DriverInfo.getOS() == DriverInfo.OS.ANDROID &&
michael@0 21 DriverInfo.getOSVersion() < 15)
michael@0 22 {
michael@0 23 // Consider 'random'. Actually, ARMv6 fails, and ARMv7 succeeds, but we have
michael@0 24 // not been successful at determining this from JS. (see bug 917478)
michael@0 25 shouldSucceed = false;
michael@0 26 shouldFail = false;
michael@0 27 }
michael@0 28
michael@0 29 var gl = WebGLUtil.getWebGL('c');
michael@0 30 if (shouldSucceed) {
michael@0 31 ok(gl, 'Expected WebGL creation to succeed.');
michael@0 32 }
michael@0 33 if (shouldFail) {
michael@0 34 ok(!gl, 'Expected WebGL creation to fail.');
michael@0 35 }
michael@0 36
michael@0 37 SimpleTest.finish();
michael@0 38 }
michael@0 39
michael@0 40 SimpleTest.waitForExplicitFinish();
michael@0 41
michael@0 42 var prefArrArr = [
michael@0 43 ['webgl.force-enabled', true]
michael@0 44 ];
michael@0 45 var prefEnv = {'set': prefArrArr};
michael@0 46 SpecialPowers.pushPrefEnv(prefEnv, test);
michael@0 47
michael@0 48 </script>
michael@0 49 </body>
michael@0 50 </html>

mercurial