OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <meta charset="utf-8"> | |
5 <title>WebGL Context Release Test</title> | |
6 <script src="../../../resources/js-test.js"></script> | |
7 <script src="resources/webgl-test.js"></script> | |
8 </head> | |
9 <body> | |
10 <iframe id="host" style="width: 256px; height: 256px; border: 0;"></iframe> | |
11 <div id="description"></div> | |
12 <div id="console"></div> | |
13 <script> | |
14 description("This test ensures that WebGL contexts are released properly upon pa
ge reload"); | |
15 | |
16 window.jsTestIsAsync = true; | |
17 if (window.testRunner) { | |
18 testRunner.dumpAsText(); | |
19 testRunner.waitUntilDone(); | |
20 } | |
21 | |
22 var host = document.getElementById("host"); | |
23 var testIterations = 8; | |
24 var currentIteration = 0; | |
25 | |
26 function refreshFrame() { | |
27 if(currentIteration < testIterations) { | |
28 currentIteration++; | |
29 host.src = "resources/context-release-upon-reload-child.html"; | |
30 } else { | |
31 testPassed("All drawing buffers were allocated at the correct size"); | |
32 finishTest(); | |
33 } | |
34 } | |
35 | |
36 function testContext() { | |
37 var bail = false; | |
38 var gl = host.contentWindow.glContext; | |
39 if (gl == null) { | |
40 bail = true; | |
41 testFailed("context was not created properly"); | |
42 } | |
43 | |
44 if (gl) { | |
45 var err = gl.getError(); | |
46 if (err != gl.NO_ERROR) { | |
47 bail = true; | |
48 testFailed("Should be no GL error; got " + getGLErrorAsString(gl, err)); | |
49 } | |
50 } | |
51 | |
52 if (bail) { | |
53 finishTest(); | |
54 return; | |
55 } | |
56 | |
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); | |
62 finishTest(); | |
63 return; | |
64 } else { | |
65 refreshFrame(); | |
66 } | |
67 | |
68 gl = null; | |
69 } | |
70 | |
71 window.addEventListener("message", function(event) { | |
72 if(event.data == "Ready") { | |
73 testContext(); | |
74 } | |
75 }); | |
76 | |
77 refreshFrame(); | |
78 </script> | |
79 | |
80 </body> | |
81 </html> | |
OLD | NEW |