content/canvas/test/webgl-mochitest/test_webgl_request_mismatch.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: Mismatched 'webgl' and 'experimental-webgl' context requests</title>
michael@0 3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
michael@0 5 <body>
michael@0 6 <canvas id="c1"></canvas>
michael@0 7 <canvas id="c2"></canvas>
michael@0 8 <canvas id="c3"></canvas>
michael@0 9 <canvas id="c4"></canvas>
michael@0 10 <script>
michael@0 11
michael@0 12 function testContextRetrieval(canvasId, creationId, requestId) {
michael@0 13 var canvas = document.getElementById(canvasId);
michael@0 14 ok(canvas, 'Invalid `canvasId`: ' + canvasId);
michael@0 15
michael@0 16 var createdGL = canvas.getContext(creationId);
michael@0 17 if (!createdGL)
michael@0 18 return; // No WebGL on this machine?
michael@0 19
michael@0 20 var requestedGL = canvas.getContext(requestId);
michael@0 21 if (creationId == requestId) {
michael@0 22 ok(requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should succeed.');
michael@0 23 ok(requestedGL == createdGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should match.');
michael@0 24 } else {
michael@0 25 ok(!requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should fail.');
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 testContextRetrieval('c1', 'experimental-webgl', 'webgl');
michael@0 30 testContextRetrieval('c2', 'webgl', 'experimental-webgl');
michael@0 31 testContextRetrieval('c3', 'experimental-webgl', 'experimental-webgl');
michael@0 32 testContextRetrieval('c4', 'webgl', 'webgl');
michael@0 33
michael@0 34 </script>
michael@0 35

mercurial