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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial