5 <title>WebGL Context Release Test
</title>
6 <script src=
"../../../resources/js-test.js"></script>
7 <script src=
"resources/webgl-test.js"></script>
10 <iframe id=
"host" style=
"width: 256px; height: 256px; border: 0;"></iframe>
11 <div id=
"description"></div>
12 <div id=
"console"></div>
14 description("This test ensures that WebGL contexts are released properly upon page reload");
16 window
.jsTestIsAsync
= true;
17 if (window
.testRunner
) {
18 testRunner
.dumpAsText();
19 testRunner
.waitUntilDone();
22 var host
= document
.getElementById("host");
23 var testIterations
= 8;
24 var currentIteration
= 0;
26 function refreshFrame() {
27 if(currentIteration
< testIterations
) {
29 host
.src
= "resources/context-release-upon-reload-child.html";
31 testPassed("All drawing buffers were allocated at the correct size");
36 function testContext() {
38 var gl
= host
.contentWindow
.glContext
;
41 testFailed("context was not created properly");
45 var err
= gl
.getError();
46 if (err
!= gl
.NO_ERROR
) {
48 testFailed("Should be no GL error; got " + getGLErrorAsString(gl
, err
));
57 if (gl
.canvas
.width
!= gl
.drawingBufferWidth
||
58 gl
.canvas
.height
!= gl
.drawingBufferHeight
) {
59 testFailed("At iteration " + currentIteration
+ " of " + testIterations
+
60 ": Buffer was the wrong size: " +
61 gl
.drawingBufferWidth
+ "x" + gl
.drawingBufferHeight
);
71 window
.addEventListener("message", function(event
) {
72 if(event
.data
== "Ready") {