| <html> |
| <head> |
| <script type="text/javascript" |
| src="../../../../third_party/webgl_conformance/resources/webgl-test-harness.js"> |
| </script> |
| <script> |
| // We parse the test list offline and run the harness multiple times with each |
| // test. Therefore, the version and options do not matter for the browsertests. |
| // However, we still need to pass in a valid options for the harness to run. |
| var CONFORMANCE_TEST_VERSION = "1.0.1 (beta)"; |
| var OPTIONS = { |
| version: CONFORMANCE_TEST_VERSION |
| }; |
| |
| var BASE_URL = "../../../../third_party/webgl_conformance/"; |
| var gl = null; |
| var messages = []; |
| var numFailures = 0; |
| |
| function start(start_url) { |
| // Report function called by each conformance test. |
| function report(type, msg, success) { |
| var reportType = WebGLTestHarnessModule.TestHarness.reportType; |
| switch (type) { |
| case reportType.START_PAGE: |
| // Accept every page loaded. |
| messages = []; |
| numFailures = 0; |
| return true; |
| case reportType.TEST_RESULT: |
| if (!success) { |
| ++numFailures; |
| messages.push("FAILURE: " + msg); |
| } |
| break; |
| case reportType.FINISH_PAGE: |
| if (success === undefined) { |
| ++numFailures; |
| messages.push("TIMEOUT: " + |
| window.webglTestHarness.timeoutDelay + " ms"); |
| } |
| case reportType.FINISHED_ALL_TESTS: |
| if (numFailures > 0) { |
| var ext = gl.getExtension("WEBGL_debug_renderer_info"); |
| if (ext) { |
| messages.push("GL_VENDOR: " + |
| gl.getParameter(ext.UNMASKED_VENDOR_WEBGL)); |
| messages.push("GL_RENDERER: " + |
| gl.getParameter(ext.UNMASKED_RENDERER_WEBGL)); |
| } |
| } else { |
| messages.push("SUCCESS"); |
| } |
| domAutomationController.send(messages.join("\n")); |
| break; |
| } |
| } |
| |
| function create3DContext() { |
| var canvas = document.createElement("canvas"); |
| var context = null; |
| try { |
| context = canvas.getContext("webgl"); |
| } catch(e) { |
| } |
| if (!context) { |
| try { |
| context = canvas.getContext("experimental-webgl"); |
| } catch(e) { |
| } |
| } |
| return context; |
| } |
| |
| // Assert the WebGL context exists. |
| gl = create3DContext(); |
| if (!gl) { |
| domAutomationController.send("FAILURE: unable to fetch WebGL context"); |
| return; |
| } |
| |
| var iframe = document.getElementById("testframe"); |
| var testHarness = new WebGLTestHarnessModule.TestHarness( |
| iframe, |
| BASE_URL + start_url, |
| report, |
| OPTIONS); |
| |
| window.webglTestHarness = testHarness; |
| window.webglTestHarness.runTests(); |
| } |
| </script> |
| </head> |
| <body> |
| <iframe id="testframe" scrolling="yes" width="100%" height="100%"></iframe> |
| </body> |
| </html> |