Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2011 Mozilla Foundation. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE html> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <meta charset="utf-8"> |
michael@0 | 10 | <title>WebGL Conformance Tests</title> |
michael@0 | 11 | <style> |
michael@0 | 12 | html, body { |
michael@0 | 13 | border: 0; |
michael@0 | 14 | margin: 0; |
michael@0 | 15 | height: 100%; |
michael@0 | 16 | height: 100%; |
michael@0 | 17 | text-align: center; |
michael@0 | 18 | font-family: monospace; |
michael@0 | 19 | } |
michael@0 | 20 | table { |
michael@0 | 21 | width: 100%; |
michael@0 | 22 | height: 100%; |
michael@0 | 23 | } |
michael@0 | 24 | .timeout { } |
michael@0 | 25 | .success { } |
michael@0 | 26 | .fail { } |
michael@0 | 27 | .testpage { border: 1px solid black; background-color: #ccc; } |
michael@0 | 28 | .testpagesuccess { border: 1px solid black; background-color: #8F8; } |
michael@0 | 29 | .testpagefail { border: 1px solid black; background-color: #F88; } |
michael@0 | 30 | .testpagetimeout { border: 1px solid black; background-color: #FC8; } |
michael@0 | 31 | .nowebgl { font-weight: bold; color: red; } |
michael@0 | 32 | #error-wrap { |
michael@0 | 33 | float: left; |
michael@0 | 34 | position: relative; |
michael@0 | 35 | left: 50%; |
michael@0 | 36 | } |
michael@0 | 37 | #error { |
michael@0 | 38 | color: red; |
michael@0 | 39 | float: left; |
michael@0 | 40 | position: relative; |
michael@0 | 41 | left: -50%; |
michael@0 | 42 | text-align: left; |
michael@0 | 43 | } |
michael@0 | 44 | ul { |
michael@0 | 45 | list-style: none; |
michael@0 | 46 | padding-left: 1em; |
michael@0 | 47 | } |
michael@0 | 48 | </style> |
michael@0 | 49 | <script type="text/javascript" src="resources/webgl-test-harness.js"></script> |
michael@0 | 50 | <script> |
michael@0 | 51 | var CONFORMANCE_TEST_VERSION = "1.0.1"; |
michael@0 | 52 | |
michael@0 | 53 | var OPTIONS = { |
michael@0 | 54 | version: CONFORMANCE_TEST_VERSION |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | function start() { |
michael@0 | 58 | |
michael@0 | 59 | function log(msg) { |
michael@0 | 60 | if (window.console && window.console.log) { |
michael@0 | 61 | window.console.log(msg); |
michael@0 | 62 | } |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | function create3DContext(canvas) |
michael@0 | 66 | { |
michael@0 | 67 | if (!canvas) { |
michael@0 | 68 | canvas = document.createElement("canvas"); |
michael@0 | 69 | } |
michael@0 | 70 | var context = null; |
michael@0 | 71 | var names = ["webgl", "experimental-webgl"]; |
michael@0 | 72 | for (var i = 0; i < names.length; ++i) { |
michael@0 | 73 | try { |
michael@0 | 74 | context = canvas.getContext(names[i]); |
michael@0 | 75 | } catch (e) { |
michael@0 | 76 | } |
michael@0 | 77 | if (context) { |
michael@0 | 78 | break; |
michael@0 | 79 | } |
michael@0 | 80 | } |
michael@0 | 81 | return context; |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | var reportType = WebGLTestHarnessModule.TestHarness.reportType; |
michael@0 | 85 | |
michael@0 | 86 | var Page = function(reporter, folder, testIndex, url) { |
michael@0 | 87 | this.reporter = reporter; |
michael@0 | 88 | this.folder = folder; |
michael@0 | 89 | this.url = url; |
michael@0 | 90 | this.totalTests = 0; |
michael@0 | 91 | this.totalSuccessful = 0; |
michael@0 | 92 | this.totalTimeouts = 0; |
michael@0 | 93 | this.testIndex = testIndex; |
michael@0 | 94 | |
michael@0 | 95 | var li = reporter.localDoc.createElement('li'); |
michael@0 | 96 | var div = reporter.localDoc.createElement('div'); |
michael@0 | 97 | var check = reporter.localDoc.createElement('input'); |
michael@0 | 98 | check.type = 'checkbox'; |
michael@0 | 99 | check.checked = true; |
michael@0 | 100 | div.appendChild(check); |
michael@0 | 101 | var button = reporter.localDoc.createElement('input'); |
michael@0 | 102 | button.type = 'button'; |
michael@0 | 103 | button.value = 'run'; |
michael@0 | 104 | button.onclick = function() { |
michael@0 | 105 | reporter.runTest(url); |
michael@0 | 106 | }; |
michael@0 | 107 | if (reporter.noWebGL) { |
michael@0 | 108 | button.disabled = true; |
michael@0 | 109 | } |
michael@0 | 110 | div.appendChild(button); |
michael@0 | 111 | var a = reporter.localDoc.createElement('a'); |
michael@0 | 112 | a.href = url; |
michael@0 | 113 | a.target = "_blank"; |
michael@0 | 114 | var node = reporter.localDoc.createTextNode(url); |
michael@0 | 115 | a.appendChild(node); |
michael@0 | 116 | div.appendChild(a); |
michael@0 | 117 | li.setAttribute('class', 'testpage'); |
michael@0 | 118 | li.appendChild(div); |
michael@0 | 119 | var ul = reporter.localDoc.createElement('ul'); |
michael@0 | 120 | var node = reporter.localDoc.createTextNode(''); |
michael@0 | 121 | li.appendChild(ul); |
michael@0 | 122 | div.appendChild(node); |
michael@0 | 123 | this.totalsElem = node; |
michael@0 | 124 | this.resultElem = ul; |
michael@0 | 125 | this.elem = li; |
michael@0 | 126 | this.check = check; |
michael@0 | 127 | }; |
michael@0 | 128 | |
michael@0 | 129 | Page.prototype.addResult = function(msg, success) { |
michael@0 | 130 | ++this.totalTests; |
michael@0 | 131 | if (success === undefined) { |
michael@0 | 132 | ++this.totalTimeouts; |
michael@0 | 133 | var result = "timeout"; |
michael@0 | 134 | var css = "timeout"; |
michael@0 | 135 | } else if (success) { |
michael@0 | 136 | ++this.totalSuccessful; |
michael@0 | 137 | var result = "success"; |
michael@0 | 138 | var css = "success"; |
michael@0 | 139 | // don't report success. |
michael@0 | 140 | return; |
michael@0 | 141 | } else { |
michael@0 | 142 | var result = "failed"; |
michael@0 | 143 | var css = "fail"; |
michael@0 | 144 | } |
michael@0 | 145 | |
michael@0 | 146 | var node = this.reporter.localDoc.createTextNode(result + ': ' + msg); |
michael@0 | 147 | var li = this.reporter.localDoc.createElement('li'); |
michael@0 | 148 | li.appendChild(node); |
michael@0 | 149 | li.setAttribute('class', css); |
michael@0 | 150 | this.resultElem.appendChild(li); |
michael@0 | 151 | }; |
michael@0 | 152 | |
michael@0 | 153 | Page.prototype.startPage = function() { |
michael@0 | 154 | this.totalTests = 0; |
michael@0 | 155 | this.totalSuccessful = 0; |
michael@0 | 156 | this.totalTimeouts = 0; |
michael@0 | 157 | // remove previous results. |
michael@0 | 158 | while (this.resultElem.hasChildNodes()) { |
michael@0 | 159 | this.resultElem.removeChild(this.resultElem.childNodes[0]); |
michael@0 | 160 | } |
michael@0 | 161 | this.totalsElem.textContent = ''; |
michael@0 | 162 | return this.check.checked && this.folder.checked(); |
michael@0 | 163 | }; |
michael@0 | 164 | |
michael@0 | 165 | Page.prototype.firstTestIndex = function() { |
michael@0 | 166 | return this.testIndex; |
michael@0 | 167 | }; |
michael@0 | 168 | |
michael@0 | 169 | Page.prototype.finishPage = function(success) { |
michael@0 | 170 | var msg = ' (' + this.totalSuccessful + ' of ' + |
michael@0 | 171 | this.totalTests + ' passed)'; |
michael@0 | 172 | if (success === undefined) { |
michael@0 | 173 | var css = 'testpagetimeout'; |
michael@0 | 174 | msg = '(*timeout*)'; |
michael@0 | 175 | ++this.totalTests; |
michael@0 | 176 | ++this.totalTimeouts; |
michael@0 | 177 | } else if (this.totalSuccessful != this.totalTests) { |
michael@0 | 178 | var css = 'testpagefail'; |
michael@0 | 179 | } else { |
michael@0 | 180 | var css = 'testpagesuccess'; |
michael@0 | 181 | } |
michael@0 | 182 | this.elem.setAttribute('class', css); |
michael@0 | 183 | this.totalsElem.textContent = msg; |
michael@0 | 184 | }; |
michael@0 | 185 | |
michael@0 | 186 | var Folder = function(reporter, folder, depth, opt_name) { |
michael@0 | 187 | this.reporter = reporter; |
michael@0 | 188 | this.depth = depth; |
michael@0 | 189 | this.name = opt_name || ""; |
michael@0 | 190 | this.subFolders = {}; |
michael@0 | 191 | this.pages = []; |
michael@0 | 192 | this.items = []; |
michael@0 | 193 | var that = this; |
michael@0 | 194 | |
michael@0 | 195 | var doc = reporter.localDoc; |
michael@0 | 196 | var li = doc.createElement('li'); |
michael@0 | 197 | var div = doc.createElement('div'); |
michael@0 | 198 | var check = doc.createElement('input'); |
michael@0 | 199 | check.type = 'checkbox'; |
michael@0 | 200 | check.checked = true; |
michael@0 | 201 | div.appendChild(check); |
michael@0 | 202 | var button = doc.createElement('input'); |
michael@0 | 203 | button.type = 'button'; |
michael@0 | 204 | button.value = 'run'; |
michael@0 | 205 | button.onclick = function() { |
michael@0 | 206 | that.run(); |
michael@0 | 207 | }; |
michael@0 | 208 | if (reporter.noWebGL) { |
michael@0 | 209 | button.disabled = true; |
michael@0 | 210 | } |
michael@0 | 211 | div.appendChild(button); |
michael@0 | 212 | var h = doc.createElement('span'); |
michael@0 | 213 | h.appendChild(doc.createTextNode(this.name)); |
michael@0 | 214 | div.appendChild(h); |
michael@0 | 215 | var ul = doc.createElement('ul'); |
michael@0 | 216 | li.appendChild(div); |
michael@0 | 217 | li.appendChild(ul); |
michael@0 | 218 | this.childUL = ul; |
michael@0 | 219 | this.elem = li; |
michael@0 | 220 | this.check = check; |
michael@0 | 221 | }; |
michael@0 | 222 | |
michael@0 | 223 | Folder.prototype.checked = function() { |
michael@0 | 224 | return this.check.checked && |
michael@0 | 225 | (this.folder ? this.folder.checked() : true); |
michael@0 | 226 | }; |
michael@0 | 227 | |
michael@0 | 228 | Folder.prototype.firstTestIndex = function() { |
michael@0 | 229 | return this.items[0].firstTestIndex(); |
michael@0 | 230 | }; |
michael@0 | 231 | |
michael@0 | 232 | Folder.prototype.numChildren = function() { |
michael@0 | 233 | var numChildren = 0; |
michael@0 | 234 | for (var name in this.subFolders) { |
michael@0 | 235 | numChildren += this.subFolders[name].numChildren(); |
michael@0 | 236 | } |
michael@0 | 237 | return numChildren + this.pages.length; |
michael@0 | 238 | }; |
michael@0 | 239 | |
michael@0 | 240 | Folder.prototype.run = function() { |
michael@0 | 241 | var firstTestIndex = this.firstTestIndex(); |
michael@0 | 242 | var count = this.numChildren(); |
michael@0 | 243 | log("run tests: " + firstTestIndex + " to " + (firstTestIndex + count - 1)) |
michael@0 | 244 | testHarness.runTests(firstTestIndex, count); |
michael@0 | 245 | }; |
michael@0 | 246 | |
michael@0 | 247 | Folder.prototype.getSubFolder = function(name) { |
michael@0 | 248 | var subFolder = this.subFolders[name]; |
michael@0 | 249 | if (subFolder === undefined) { |
michael@0 | 250 | subFolder = new Folder(this.reporter, this, this.depth + 1, name); |
michael@0 | 251 | this.subFolders[name] = subFolder; |
michael@0 | 252 | this.items.push(subFolder); |
michael@0 | 253 | this.childUL.appendChild(subFolder.elem); |
michael@0 | 254 | } |
michael@0 | 255 | return subFolder; |
michael@0 | 256 | }; |
michael@0 | 257 | |
michael@0 | 258 | Folder.prototype.getOrCreateFolder = function(url) { |
michael@0 | 259 | var parts = url.split('/'); |
michael@0 | 260 | var folder = this; |
michael@0 | 261 | for (var pp = 0; pp < parts.length - 1; ++pp) { |
michael@0 | 262 | folder = folder.getSubFolder(parts[pp]); |
michael@0 | 263 | } |
michael@0 | 264 | return folder; |
michael@0 | 265 | }; |
michael@0 | 266 | |
michael@0 | 267 | Folder.prototype.addPage = function(page) { |
michael@0 | 268 | this.pages.push(page); |
michael@0 | 269 | this.items.push(page); |
michael@0 | 270 | this.childUL.appendChild(page.elem); |
michael@0 | 271 | }; |
michael@0 | 272 | |
michael@0 | 273 | var Reporter = function() { |
michael@0 | 274 | this.localDoc = document; |
michael@0 | 275 | this.resultElem = document.getElementById("results"); |
michael@0 | 276 | this.fullResultsElem = document.getElementById("fullresults"); |
michael@0 | 277 | var node = this.localDoc.createTextNode(''); |
michael@0 | 278 | this.fullResultsElem.appendChild(node); |
michael@0 | 279 | this.fullResultsNode = node; |
michael@0 | 280 | this.iframe = document.getElementById("testframe"); |
michael@0 | 281 | this.currentPageElem = null; |
michael@0 | 282 | this.totalPages = 0; |
michael@0 | 283 | this.pagesByURL = {}; |
michael@0 | 284 | var canvas = document.getElementById("webglcheck"); |
michael@0 | 285 | var ctx = create3DContext(canvas); |
michael@0 | 286 | this.noWebGL = !ctx; |
michael@0 | 287 | this.contextInfo = {}; |
michael@0 | 288 | this.root = new Folder(this, null, 0, "all"); |
michael@0 | 289 | this.resultElem.appendChild(this.root.elem); |
michael@0 | 290 | |
michael@0 | 291 | if (ctx) { |
michael@0 | 292 | this.contextInfo["VENDOR"] = ctx.getParameter(ctx.VENDOR); |
michael@0 | 293 | this.contextInfo["VERSION"] = ctx.getParameter(ctx.VERSION); |
michael@0 | 294 | this.contextInfo["RENDERER"] = ctx.getParameter(ctx.RENDERER); |
michael@0 | 295 | this.contextInfo["RED_BITS"] = ctx.getParameter(ctx.RED_BITS); |
michael@0 | 296 | this.contextInfo["GREEN_BITS"] = ctx.getParameter(ctx.GREEN_BITS); |
michael@0 | 297 | this.contextInfo["BLUE_BITS"] = ctx.getParameter(ctx.BLUE_BITS); |
michael@0 | 298 | this.contextInfo["ALPHA_BITS"] = ctx.getParameter(ctx.ALPHA_BITS); |
michael@0 | 299 | this.contextInfo["DEPTH_BITS"] = ctx.getParameter(ctx.DEPTH_BITS); |
michael@0 | 300 | this.contextInfo["STENCIL_BITS"] = ctx.getParameter(ctx.STENCIL_BITS); |
michael@0 | 301 | |
michael@0 | 302 | var ext = ctx.getExtension("WEBGL_debug_renderer_info"); |
michael@0 | 303 | if (ext) { |
michael@0 | 304 | this.contextInfo["UNMASKED_VENDOR"] = ctx.getParameter(ext.UNMASKED_VENDOR_WEBGL); |
michael@0 | 305 | this.contextInfo["UNMASKED_RENDERER"] = ctx.getParameter(ext.UNMASKED_RENDERER_WEBGL); |
michael@0 | 306 | } |
michael@0 | 307 | } |
michael@0 | 308 | }; |
michael@0 | 309 | |
michael@0 | 310 | Reporter.prototype.runTest = function(url) { |
michael@0 | 311 | var page = this.pagesByURL[url]; |
michael@0 | 312 | page.startPage(); |
michael@0 | 313 | this.currentPage = page; |
michael@0 | 314 | this.iframe.src = url; |
michael@0 | 315 | }; |
michael@0 | 316 | |
michael@0 | 317 | Reporter.prototype.getFolder = function(url) { |
michael@0 | 318 | return this.root.getOrCreateFolder(url); |
michael@0 | 319 | }; |
michael@0 | 320 | |
michael@0 | 321 | Reporter.prototype.addPage = function(url) { |
michael@0 | 322 | var folder = this.getFolder(url); |
michael@0 | 323 | var page = new Page(this, folder, this.totalPages, url); |
michael@0 | 324 | folder.addPage(page); |
michael@0 | 325 | ++this.totalPages; |
michael@0 | 326 | this.pagesByURL[url] = page; |
michael@0 | 327 | }; |
michael@0 | 328 | |
michael@0 | 329 | Reporter.prototype.startPage = function(url) { |
michael@0 | 330 | var page = this.pagesByURL[url]; |
michael@0 | 331 | this.currentPage = page; |
michael@0 | 332 | return page.startPage(); |
michael@0 | 333 | }; |
michael@0 | 334 | |
michael@0 | 335 | Reporter.prototype.addResult = function(msg, success) { |
michael@0 | 336 | if (this.currentPage != null) { |
michael@0 | 337 | this.currentPage.addResult(msg, success); |
michael@0 | 338 | } |
michael@0 | 339 | }; |
michael@0 | 340 | |
michael@0 | 341 | Reporter.prototype.finishPage = function(success) { |
michael@0 | 342 | if (this.currentPage != null) { |
michael@0 | 343 | this.currentPage.finishPage(success); |
michael@0 | 344 | this.currentPage = null; |
michael@0 | 345 | } |
michael@0 | 346 | }; |
michael@0 | 347 | |
michael@0 | 348 | Reporter.prototype.displayFinalResults = function(msg, success) { |
michael@0 | 349 | if (success) { |
michael@0 | 350 | var totalTests = 0; |
michael@0 | 351 | var totalSuccessful = 0; |
michael@0 | 352 | var totalTimeouts = 0; |
michael@0 | 353 | for (var url in this.pagesByURL) { |
michael@0 | 354 | var page = this.pagesByURL[url]; |
michael@0 | 355 | totalTests += page.totalTests; |
michael@0 | 356 | totalSuccessful += page.totalSuccessful; |
michael@0 | 357 | totalTimeouts += page.totalTimeouts; |
michael@0 | 358 | } |
michael@0 | 359 | var timeout = ''; |
michael@0 | 360 | if (totalTimeouts > 0) { |
michael@0 | 361 | timeout = ', ' + totalTimeouts + ' timed out'; |
michael@0 | 362 | } |
michael@0 | 363 | var msg = ' (' + totalSuccessful + ' of ' + |
michael@0 | 364 | totalTests + ' passed' + timeout + ')'; |
michael@0 | 365 | this.fullResultsNode.textContent = msg; |
michael@0 | 366 | |
michael@0 | 367 | // generate a text summary |
michael@0 | 368 | var tx = ""; |
michael@0 | 369 | tx += "WebGL Conformance Test Results\n"; |
michael@0 | 370 | tx += "Version " + OPTIONS.version + "\n"; |
michael@0 | 371 | tx += "\n"; |
michael@0 | 372 | tx += "-------------------\n\n"; |
michael@0 | 373 | tx += "User Agent: " + (navigator.userAgent ? navigator.userAgent : "(navigator.userAgent is null)") + "\n"; |
michael@0 | 374 | tx += "WebGL VENDOR: " + this.contextInfo["VENDOR"] + "\n"; |
michael@0 | 375 | tx += "WebGL VERSION: " + this.contextInfo["VERSION"] + "\n"; |
michael@0 | 376 | tx += "WebGL RENDERER: " + this.contextInfo["RENDERER"] + "\n"; |
michael@0 | 377 | tx += "Unmasked VENDOR: " + this.contextInfo["UNMASKED_VENDOR"] + "\n"; |
michael@0 | 378 | tx += "Unmasked RENDERER: " + this.contextInfo["UNMASKED_RENDERER"] + "\n"; |
michael@0 | 379 | tx += "WebGL R/G/B/A/Depth/Stencil bits (default config): " + this.contextInfo["RED_BITS"] + "/" + this.contextInfo["GREEN_BITS"] + "/" + this.contextInfo["BLUE_BITS"] + "/" + this.contextInfo["ALPHA_BITS"] + "/" + this.contextInfo["DEPTH_BITS"] + "/" + this.contextInfo["STENCIL_BITS"] + "\n"; |
michael@0 | 380 | tx += "\n"; |
michael@0 | 381 | tx += "-------------------\n\n"; |
michael@0 | 382 | tx += "Test Summary (" + totalTests + " total tests):\n"; |
michael@0 | 383 | tx += "Tests PASSED: " + totalSuccessful + "\n"; |
michael@0 | 384 | tx += "Tests FAILED: " + (totalTests - totalSuccessful) + "\n"; |
michael@0 | 385 | tx += "Tests TIMED OUT: " + totalTimeouts + "\n"; |
michael@0 | 386 | tx += "\n"; |
michael@0 | 387 | tx += "-------------------\n\n"; |
michael@0 | 388 | if (totalSuccessful < totalTests) { |
michael@0 | 389 | tx += "Failures:\n\n"; |
michael@0 | 390 | for (var url in this.pagesByURL) { |
michael@0 | 391 | var page = this.pagesByURL[url]; |
michael@0 | 392 | var pageTotalFail = page.totalTests - page.totalSuccessful; |
michael@0 | 393 | if (!(page.totalTests == 0 && page.totalTimeouts == 0) && |
michael@0 | 394 | pageTotalFail > 0) |
michael@0 | 395 | { |
michael@0 | 396 | tx += url + ": " + pageTotalFail + " tests failed"; |
michael@0 | 397 | if (page.totalTimeouts) |
michael@0 | 398 | tx += " (" + page.totalTimeouts + " timed out)"; |
michael@0 | 399 | tx += "\n"; |
michael@0 | 400 | } |
michael@0 | 401 | } |
michael@0 | 402 | } else { |
michael@0 | 403 | tx += "All tests PASSED\n\n"; |
michael@0 | 404 | } |
michael@0 | 405 | tx += "\n"; |
michael@0 | 406 | tx += "-------------------\n\n"; |
michael@0 | 407 | tx += "Complete Test Results (total / pass / fail / timeout):\n\n"; |
michael@0 | 408 | for (var url in this.pagesByURL) { |
michael@0 | 409 | var page = this.pagesByURL[url]; |
michael@0 | 410 | var pageTotalFail = page.totalTests - page.totalSuccessful; |
michael@0 | 411 | if (!(page.totalTests == 0 && page.totalTimeouts == 0)) { |
michael@0 | 412 | tx += url + ": " + page.totalTests + " / " + |
michael@0 | 413 | page.totalSuccessful + " / " + pageTotalFail + " / " + page.totalTimeouts + "\n"; |
michael@0 | 414 | } |
michael@0 | 415 | } |
michael@0 | 416 | tx += "\n"; |
michael@0 | 417 | tx += "-------------------\n\n"; |
michael@0 | 418 | tx += "Generated on: " + (new Date()).toString() + "\n"; |
michael@0 | 419 | |
michael@0 | 420 | var r = document.getElementById("testResultsAsText"); |
michael@0 | 421 | while (r.firstChild) r.removeChild(r.firstChild); |
michael@0 | 422 | r.appendChild(document.createTextNode(tx)); |
michael@0 | 423 | document.getElementById("showTextSummary").style.visibility = "visible"; |
michael@0 | 424 | } else { |
michael@0 | 425 | var e = document.getElementById("error"); |
michael@0 | 426 | e.innerHTML = msg; |
michael@0 | 427 | } |
michael@0 | 428 | }; |
michael@0 | 429 | |
michael@0 | 430 | Reporter.prototype.ready = function() { |
michael@0 | 431 | var loading = document.getElementById("loading"); |
michael@0 | 432 | loading.style.display = "none"; |
michael@0 | 433 | if (!this.noWebGL) { |
michael@0 | 434 | var button = document.getElementById("runTestsButton"); |
michael@0 | 435 | button.disabled = false; |
michael@0 | 436 | } |
michael@0 | 437 | }; |
michael@0 | 438 | |
michael@0 | 439 | Reporter.prototype.reportFunc = function(type, msg, success) { |
michael@0 | 440 | switch (type) { |
michael@0 | 441 | case reportType.ADD_PAGE: |
michael@0 | 442 | return this.addPage(msg); |
michael@0 | 443 | case reportType.READY: |
michael@0 | 444 | return this.ready(); |
michael@0 | 445 | case reportType.START_PAGE: |
michael@0 | 446 | return this.startPage(msg); |
michael@0 | 447 | case reportType.TEST_RESULT: |
michael@0 | 448 | return this.addResult(msg, success); |
michael@0 | 449 | case reportType.FINISH_PAGE: |
michael@0 | 450 | return this.finishPage(success); |
michael@0 | 451 | case reportType.FINISHED_ALL_TESTS: |
michael@0 | 452 | return this.displayFinalResults(msg, success); |
michael@0 | 453 | default: |
michael@0 | 454 | throw 'unhandled'; |
michael@0 | 455 | break; |
michael@0 | 456 | }; |
michael@0 | 457 | }; |
michael@0 | 458 | |
michael@0 | 459 | var getURLOptions = function(obj) { |
michael@0 | 460 | var s = window.location.href; |
michael@0 | 461 | var q = s.indexOf("?"); |
michael@0 | 462 | var e = s.indexOf("#"); |
michael@0 | 463 | if (e < 0) { |
michael@0 | 464 | e = s.length; |
michael@0 | 465 | } |
michael@0 | 466 | var query = s.substring(q + 1, e); |
michael@0 | 467 | var pairs = query.split("&"); |
michael@0 | 468 | for (var ii = 0; ii < pairs.length; ++ii) { |
michael@0 | 469 | var keyValue = pairs[ii].split("="); |
michael@0 | 470 | var key = keyValue[0]; |
michael@0 | 471 | var value = decodeURIComponent(keyValue[1]); |
michael@0 | 472 | obj[key] = value; |
michael@0 | 473 | } |
michael@0 | 474 | }; |
michael@0 | 475 | |
michael@0 | 476 | getURLOptions(OPTIONS); |
michael@0 | 477 | |
michael@0 | 478 | document.getElementById("testVersion").innerHTML = OPTIONS.version; |
michael@0 | 479 | |
michael@0 | 480 | var reporter = new Reporter(); |
michael@0 | 481 | var iframe = document.getElementById("testframe"); |
michael@0 | 482 | var testHarness = new WebGLTestHarnessModule.TestHarness( |
michael@0 | 483 | iframe, |
michael@0 | 484 | '00_test_list.txt', |
michael@0 | 485 | function(type, msg, success) { |
michael@0 | 486 | return reporter.reportFunc(type, msg, success); |
michael@0 | 487 | }, |
michael@0 | 488 | OPTIONS); |
michael@0 | 489 | window.webglTestHarness = testHarness; |
michael@0 | 490 | var button = document.getElementById("runTestsButton"); |
michael@0 | 491 | button.disabled = true; |
michael@0 | 492 | button.onclick = function() { |
michael@0 | 493 | testHarness.runTests(); |
michael@0 | 494 | }; |
michael@0 | 495 | var textbutton = document.getElementById("showTextSummary"); |
michael@0 | 496 | textbutton.onclick = function() { |
michael@0 | 497 | log("click"); |
michael@0 | 498 | var htmldiv = document.getElementById("testResultsHTML"); |
michael@0 | 499 | var textdiv = document.getElementById("testResultsText"); |
michael@0 | 500 | if (textdiv.style.display == "none") { |
michael@0 | 501 | textdiv.style.display = "block"; |
michael@0 | 502 | htmldiv.style.display = "none"; |
michael@0 | 503 | textbutton.setAttribute("value", "display html summary"); |
michael@0 | 504 | } else { |
michael@0 | 505 | textdiv.style.display = "none"; |
michael@0 | 506 | htmldiv.style.display = "block"; |
michael@0 | 507 | textbutton.setAttribute("value", "display text summary"); |
michael@0 | 508 | } |
michael@0 | 509 | }; |
michael@0 | 510 | if (reporter.noWebGL) { |
michael@0 | 511 | button.disabled = true; |
michael@0 | 512 | var elem = document.getElementById("nowebgl"); |
michael@0 | 513 | elem.style.display = ""; |
michael@0 | 514 | } |
michael@0 | 515 | } |
michael@0 | 516 | </script> |
michael@0 | 517 | </head> |
michael@0 | 518 | <body onload="start()"> |
michael@0 | 519 | <table border="2"> |
michael@0 | 520 | <tr style="height: 300px;"> |
michael@0 | 521 | <td> |
michael@0 | 522 | <table> |
michael@0 | 523 | <tr><td><img src="resources/webgl-logo.png" /><br />WebGL Conformance Test Runner<br/>Version <span id="testVersion"></span><br/><input type="button" value="run tests" id="runTestsButton"/><br/><input type="button" style="visibility: hidden;" value="display text summary" id="showTextSummary"/> |
michael@0 | 524 | <div id="nowebgl" class="nowebgl" style="display: none;">This browser does not appear to support WebGL</div></td></tr> |
michael@0 | 525 | <tr><td><div id="loading">Loading Tests...</div> |
michael@0 | 526 | <div style="border: 1px">Results: <span id="fullresults"></span></div> |
michael@0 | 527 | <canvas id="webglcheck" style="display: none;"></canvas></td></tr> |
michael@0 | 528 | <tr><td><div id="error-wrap"><pre id="error"></pre></div></td></tr> |
michael@0 | 529 | </table> |
michael@0 | 530 | </td> |
michael@0 | 531 | <td> |
michael@0 | 532 | <iframe id="testframe" scrolling="yes" width="100%" height="100%"></iframe> |
michael@0 | 533 | </td> |
michael@0 | 534 | </tr> |
michael@0 | 535 | <tr> |
michael@0 | 536 | <td colspan="2"> |
michael@0 | 537 | <div style="text-align: left; width: 100%; height: 100%; overflow: auto;"> |
michael@0 | 538 | <div id="testResultsHTML"><ul id="results"></ul></div> |
michael@0 | 539 | <div style="display: none;" id="testResultsText"><pre id="testResultsAsText"></pre></div> |
michael@0 | 540 | </div> |
michael@0 | 541 | </td> |
michael@0 | 542 | </tr> |
michael@0 | 543 | </table> |
michael@0 | 544 | </body> |
michael@0 | 545 | </html> |