content/canvas/test/webgl-mochitest/test_webgl_request_context.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 <title>WebGL test: 'webgl' and 'experimental-webgl' context requests succeed,
michael@0 3 'moz-webgl' context requests fail.</title>
michael@0 4 <script src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 5 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
michael@0 6 <script src="driver-info.js"></script>
michael@0 7 <body>
michael@0 8 <canvas id="c1"></canvas>
michael@0 9 <canvas id="c2"></canvas>
michael@0 10 <script>
michael@0 11
michael@0 12 var testFunc = ok;
michael@0 13
michael@0 14 function testContextRetrieval(canvasId, creationId, shouldSucceed) {
michael@0 15 var canvas = document.getElementById(canvasId);
michael@0 16 ok(canvas, 'Invalid `canvasId`: ' + canvasId);
michael@0 17
michael@0 18 var createdGL = canvas.getContext(creationId);
michael@0 19 if (shouldSucceed) {
michael@0 20 testFunc(createdGL, 'Request for \'' + creationId + '\' should succeed.');
michael@0 21 } else {
michael@0 22 ok(!createdGL, 'Request for \'' + creationId + '\' should fail.');
michael@0 23 }
michael@0 24 }
michael@0 25
michael@0 26 SimpleTest.waitForExplicitFinish();
michael@0 27 SpecialPowers.pushPrefEnv({'set': [
michael@0 28 ['webgl.force-enabled', true]
michael@0 29 ]}, function() {
michael@0 30 testContextRetrieval('c1', 'experimental-webgl', true);
michael@0 31 testContextRetrieval('c2', 'moz-webgl', false);
michael@0 32 SimpleTest.finish();
michael@0 33 });
michael@0 34
michael@0 35 </script>
michael@0 36

mercurial