2 <html class=
"reftest-wait">
6 <script type=
"text/javascript" src=
"webgl-utils.js"></script>
7 <script type=
"text/javascript">
10 * If we succeed in getting a WebGL context, we will fill
11 * the canvas with red. If we fail to acquire a WebGL context,
12 * we will use Canvas2D to instead fill it with green.
14 * Note that this test differs from the others in that
15 * it will draw differently if it receives a WebGL context.
16 * Other tests are designed to fallback silently to Canvas2D.
18 * We use this test to assure that when we disable WebGL,
19 * WebGL does not function. This is trivially true for systems
20 * that don't support WebGL. This test is not viable for testing
21 * that WebGL works, as blocklisted systems will always draw green.
26 function renderGL(gl
) {
27 gl
.clearColor(1.0, 0.0, 0.0, 1.0);
28 gl
.clear(gl
.COLOR_BUFFER_BIT
);
32 function renderBackup(canvas
) {
33 var context
= canvas
.getContext("2d");
34 context
.fillStyle
= "rgba(0, 255, 0, 1.0)";
35 context
.fillRect(0, 0, 256, 256);
39 var canvas
= document
.getElementById("canvas");
40 var gl
= initGL(canvas
);
47 waitForComposite(testComplete
);
50 function testComplete() {
51 document
.documentElement
.removeAttribute("class");
56 <body onload=
"rAF(runTest);">
57 <canvas id=
"canvas" width=
"256" height=
"256"></canvas>