1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-mochitest/test_webgl_request_context.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<title>WebGL test: 'webgl' and 'experimental-webgl' context requests succeed, 1.6 + 'moz-webgl' context requests fail.</title> 1.7 +<script src="/tests/SimpleTest/SimpleTest.js"></script> 1.8 +<link rel="stylesheet" href="/tests/SimpleTest/test.css"> 1.9 +<script src="driver-info.js"></script> 1.10 +<body> 1.11 +<canvas id="c1"></canvas> 1.12 +<canvas id="c2"></canvas> 1.13 +<script> 1.14 + 1.15 +var testFunc = ok; 1.16 + 1.17 +function testContextRetrieval(canvasId, creationId, shouldSucceed) { 1.18 + var canvas = document.getElementById(canvasId); 1.19 + ok(canvas, 'Invalid `canvasId`: ' + canvasId); 1.20 + 1.21 + var createdGL = canvas.getContext(creationId); 1.22 + if (shouldSucceed) { 1.23 + testFunc(createdGL, 'Request for \'' + creationId + '\' should succeed.'); 1.24 + } else { 1.25 + ok(!createdGL, 'Request for \'' + creationId + '\' should fail.'); 1.26 + } 1.27 +} 1.28 + 1.29 +SimpleTest.waitForExplicitFinish(); 1.30 +SpecialPowers.pushPrefEnv({'set': [ 1.31 + ['webgl.force-enabled', true] 1.32 +]}, function() { 1.33 + testContextRetrieval('c1', 'experimental-webgl', true); 1.34 + testContextRetrieval('c2', 'moz-webgl', false); 1.35 + SimpleTest.finish(); 1.36 +}); 1.37 + 1.38 +</script> 1.39 +