Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: webgl-conformance-tests.html

Issue 41443002: Add ToT webgl conformance tests: part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test-guidelines.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 2
3 /* 3 /*
4 ** Copyright (c) 2012 The Khronos Group Inc. 4 ** Copyright (c) 2012 The Khronos Group Inc.
5 ** 5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a 6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the 7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including 8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish, 9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to 10 ** distribute, sublicense, and/or sell copies of the Materials, and to
(...skipping 10 matching lines...) Expand all
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */ 24 */
25 25
26 --> 26 -->
27 <!DOCTYPE html> 27 <!DOCTYPE html>
28 <html> 28 <html>
29 <head> 29 <head>
30 <meta charset="utf-8"> 30 <meta charset="utf-8">
31 <!-- Prevents Chrome from offering to translate tests which generate
32 random characters for things like attribute names -->
33 <meta name="google" value="notranslate">
31 <title>WebGL Conformance Tests</title> 34 <title>WebGL Conformance Tests</title>
32 <style> 35 <style>
33 html, body { 36 body {
34 border: 0; 37 border: 0;
35 margin: 0; 38 margin: 0;
39 padding: 0;
36 height: 100%; 40 height: 100%;
37 height: 100%; 41 max-height:100%;
38 text-align: center;
39 font-family: monospace; 42 font-family: monospace;
43 overflow: hidden;
40 } 44 }
45
46 #testlist {
47 position:fixed;
48 top:310px;
49 left:0;
50 right:0;
51 bottom:0px;
52 overflow:auto;
53 padding:1em;
54 }
55
56 #header {
57 position:absolute;
58 top:0;
59 left:0;
60 width:100%;
61 height:310px;
62 overflow:auto;
63 }
64
65 #info {
66 text-align: center;
67 min-width: 300px;
68 }
69
41 table { 70 table {
42 width: 100%; 71 width: 100%;
43 height: 100%; 72 height: 100%;
44 } 73 }
74 #frames td {
75 border: 1px solid black;
76 min-height: 1px;
77 min-width: 1px;
78 }
79 #frames t
45 .timeout { } 80 .timeout { }
46 .success { } 81 .success { }
47 .fail { } 82 .fail { }
48 .testpage { border: 1px solid black; background-color: #ccc; } 83 .testpage { border: 1px solid black; background-color: #ccc; }
49 .testpagesuccess { border: 1px solid black; background-color: #8F8; } 84 .testpagesuccess { border: 1px solid black; background-color: #8F8; }
50 .testpagefail { border: 1px solid black; background-color: #F88; } 85 .testpagefail { border: 1px solid black; background-color: #F88; }
86 .testpageskipped { border: 1px solid black; background-color: #888; }
51 .testpagetimeout { border: 1px solid black; background-color: #FC8; } 87 .testpagetimeout { border: 1px solid black; background-color: #FC8; }
52 .nowebgl { font-weight: bold; color: red; } 88 .nowebgl { font-weight: bold; color: red; }
53 #error-wrap { 89 #error-wrap {
54 float: left; 90 float: left;
55 position: relative; 91 position: relative;
56 left: 50%; 92 left: 50%;
57 } 93 }
58 #error { 94 #error {
59 color: red; 95 color: red;
60 float: left; 96 float: left;
61 position: relative; 97 position: relative;
62 left: -50%; 98 left: -50%;
63 text-align: left; 99 text-align: left;
64 } 100 }
65 ul { 101 ul {
66 list-style: none; 102 list-style: none;
67 padding-left: 1em; 103 padding-left: 1em;
68 } 104 }
69 </style> 105 </style>
70 <script type="text/javascript" src="resources/webgl-test-harness.js"></script> 106 <script type="text/javascript" src="resources/webgl-test-harness.js"></script>
71 <script> 107 <script>
72 var CONFORMANCE_TEST_VERSION = "1.0.2 (beta)"; 108 "use strict";
109 var CONFORMANCE_TEST_VERSION = "1.0.3 (beta)";
73 110
74 var OPTIONS = { 111 var OPTIONS = {
75 version: CONFORMANCE_TEST_VERSION 112 version: CONFORMANCE_TEST_VERSION,
113 frames: 1,
114 allowSkip: 0
76 }; 115 };
77 116
78 function start() { 117 function start() {
79 118
80 function log(msg) { 119 function log(msg) {
81 if (window.console && window.console.log) { 120 if (window.console && window.console.log) {
82 window.console.log(msg); 121 window.console.log(msg);
83 } 122 }
84 } 123 }
85 124
(...skipping 10 matching lines...) Expand all
96 } catch (e) { 135 } catch (e) {
97 } 136 }
98 if (context) { 137 if (context) {
99 break; 138 break;
100 } 139 }
101 } 140 }
102 return context; 141 return context;
103 } 142 }
104 143
105 var reportType = WebGLTestHarnessModule.TestHarness.reportType; 144 var reportType = WebGLTestHarnessModule.TestHarness.reportType;
145 var pageCount = 0;
146 var folderCount = 0;
147 var autoScrollEnabled = true; // Whether the user prefers to auto scroll
148 var autoScroll = true; // Whether auto scroll is actually performed
106 149
107 var Page = function(reporter, folder, testIndex, url) { 150 var Page = function(reporter, folder, testIndex, url) {
108 this.reporter = reporter; 151 this.reporter = reporter;
109 this.folder = folder; 152 this.folder = folder;
110 this.url = url; 153 this.url = url;
111 this.totalTests = 0; 154 this.totalTests = 0;
112 this.totalSuccessful = 0; 155 this.totalSuccessful = 0;
113 this.totalTimeouts = 0; 156 this.totalTimeouts = 0;
157 this.totalSkipped = 0;
114 this.testIndex = testIndex; 158 this.testIndex = testIndex;
115 159
160 this.elementId = "page" + pageCount++;
116 var li = reporter.localDoc.createElement('li'); 161 var li = reporter.localDoc.createElement('li');
162 li.id = this.elementId;
117 var div = reporter.localDoc.createElement('div'); 163 var div = reporter.localDoc.createElement('div');
118 var check = reporter.localDoc.createElement('input'); 164 var check = reporter.localDoc.createElement('input');
119 check.type = 'checkbox'; 165 check.type = 'checkbox';
120 check.checked = true; 166 check.checked = true;
121 div.appendChild(check); 167 div.appendChild(check);
122 var button = reporter.localDoc.createElement('input'); 168 var button = reporter.localDoc.createElement('input');
123 button.type = 'button'; 169 button.type = 'button';
124 button.value = 'run'; 170 button.value = 'run';
125 button.onclick = function() { 171 button.onclick = function() {
172 autoScroll = false;
126 reporter.runTest(url); 173 reporter.runTest(url);
127 }; 174 };
128 if (reporter.noWebGL) { 175 if (reporter.noWebGL) {
129 button.disabled = true; 176 button.disabled = true;
130 } 177 }
131 div.appendChild(button); 178 div.appendChild(button);
132 var a = reporter.localDoc.createElement('a'); 179 var a = reporter.localDoc.createElement('a');
133 a.href = url; 180 a.href = url;
134 a.target = "_blank"; 181 a.target = "_blank";
135 var node = reporter.localDoc.createTextNode(url); 182 var node = reporter.localDoc.createTextNode(url);
136 a.appendChild(node); 183 a.appendChild(node);
137 div.appendChild(a); 184 div.appendChild(a);
138 li.setAttribute('class', 'testpage'); 185 li.setAttribute('class', 'testpage');
139 li.appendChild(div); 186 li.appendChild(div);
140 var ul = reporter.localDoc.createElement('ul'); 187 var ul = reporter.localDoc.createElement('ul');
141 var node = reporter.localDoc.createTextNode(''); 188 var node = reporter.localDoc.createTextNode('');
142 li.appendChild(ul); 189 li.appendChild(ul);
143 div.appendChild(node); 190 div.appendChild(node);
144 this.totalsElem = node; 191 this.totalsElem = node;
145 this.resultElem = ul; 192 this.resultElem = ul;
146 this.elem = li; 193 this.elem = li;
147 this.check = check; 194 this.check = check;
148 }; 195 };
149 196
150 Page.prototype.addResult = function(msg, success) { 197 Page.prototype.addResult = function(msg, success, skipped) {
151 ++this.totalTests; 198 ++this.totalTests;
152 if (success === undefined) { 199 if (success === undefined) {
153 ++this.totalTimeouts; 200 ++this.totalTimeouts;
154 var result = "timeout"; 201 var result = "timeout";
155 var css = "timeout"; 202 var css = "timeout";
156 } else if (success) { 203 } else if (success) {
157 ++this.totalSuccessful; 204 if(skipped) {
158 var result = "success"; 205 ++this.totalSkipped;
159 var css = "success"; 206 } else {
207 ++this.totalSuccessful;
208 }
160 // don't report success. 209 // don't report success.
161 return; 210 return;
162 } else { 211 } else {
163 var result = "failed"; 212 var result = "failed";
164 var css = "fail"; 213 var css = "fail";
165 } 214 }
166 215
167 var node = this.reporter.localDoc.createTextNode(result + ': ' + msg); 216 var node = this.reporter.localDoc.createTextNode(result + ': ' + msg);
168 var li = this.reporter.localDoc.createElement('li'); 217 var li = this.reporter.localDoc.createElement('li');
169 li.appendChild(node); 218 li.appendChild(node);
170 li.setAttribute('class', css); 219 li.setAttribute('class', css);
171 this.resultElem.appendChild(li); 220 this.resultElem.appendChild(li);
172 }; 221 };
173 222
174 Page.prototype.startPage = function() { 223 Page.prototype.startPage = function() {
224 if (autoScroll && this.elem.scrollIntoView) {
225 this.elem.scrollIntoView(false);
226 }
175 this.totalTests = 0; 227 this.totalTests = 0;
176 this.totalSuccessful = 0; 228 this.totalSuccessful = 0;
177 this.totalTimeouts = 0; 229 this.totalTimeouts = 0;
178 // remove previous results. 230 // remove previous results.
179 while (this.resultElem.hasChildNodes()) { 231 while (this.resultElem.hasChildNodes()) {
180 this.resultElem.removeChild(this.resultElem.childNodes[0]); 232 this.resultElem.removeChild(this.resultElem.childNodes[0]);
181 } 233 }
182 this.totalsElem.textContent = ''; 234 this.totalsElem.textContent = '';
183 return this.check.checked && this.folder.checked(); 235 return this.check.checked && this.folder.checked();
184 }; 236 };
185 237
186 Page.prototype.firstTestIndex = function() { 238 Page.prototype.firstTestIndex = function() {
187 return this.testIndex; 239 return this.testIndex;
188 }; 240 };
189 241
190 Page.prototype.finishPage = function(success) { 242 Page.prototype.finishPage = function(success) {
191 var msg = ' (' + this.totalSuccessful + ' of ' + 243 if(this.totalSkipped) {
192 this.totalTests + ' passed)'; 244 var msg = ' (' + this.totalSkipped + ' of ' + this.totalTests + ' skipped) ';
245 } else {
246 var msg = ' (' + this.totalSuccessful + ' of ' + this.totalTests + ' passe d)';
247 }
248
193 if (success === undefined) { 249 if (success === undefined) {
194 var css = 'testpagetimeout'; 250 var css = 'testpagetimeout';
195 msg = '(*timeout*)'; 251 msg = '(*timeout*)';
196 ++this.totalTests; 252 ++this.totalTests;
197 ++this.totalTimeouts; 253 ++this.totalTimeouts;
254 } else if (this.totalSkipped) {
255 var css = 'testpageskipped';
198 } else if (this.totalSuccessful != this.totalTests) { 256 } else if (this.totalSuccessful != this.totalTests) {
199 var css = 'testpagefail'; 257 var css = 'testpagefail';
200 } else { 258 } else {
201 var css = 'testpagesuccess'; 259 var css = 'testpagesuccess';
202 } 260 }
203 this.elem.setAttribute('class', css); 261 this.elem.setAttribute('class', css);
204 this.totalsElem.textContent = msg; 262 this.totalsElem.textContent = msg;
205 }; 263 };
206 264
207 Page.prototype.enableTest = function(re) { 265 Page.prototype.enableTest = function(re) {
(...skipping 13 matching lines...) Expand all
221 this.reporter = reporter; 279 this.reporter = reporter;
222 this.depth = depth; 280 this.depth = depth;
223 this.name = opt_name || ""; 281 this.name = opt_name || "";
224 this.subFolders = {}; 282 this.subFolders = {};
225 this.pages = []; 283 this.pages = [];
226 this.items = []; 284 this.items = [];
227 this.folder = folder; 285 this.folder = folder;
228 var that = this; 286 var that = this;
229 287
230 var doc = reporter.localDoc; 288 var doc = reporter.localDoc;
289 this.elementId = "folder" + folderCount++;
231 var li = doc.createElement('li'); 290 var li = doc.createElement('li');
291 li.id = this.elementId;
232 var div = doc.createElement('div'); 292 var div = doc.createElement('div');
233 var check = doc.createElement('input'); 293 var check = doc.createElement('input');
234 check.type = 'checkbox'; 294 check.type = 'checkbox';
235 check.checked = true; 295 check.checked = true;
236 div.appendChild(check); 296 div.appendChild(check);
237 var button = doc.createElement('input'); 297 var button = doc.createElement('input');
238 button.type = 'button'; 298 button.type = 'button';
239 button.value = 'run'; 299 button.value = 'run';
240 button.onclick = function() { 300 button.onclick = function() {
301 autoScroll = autoScrollEnabled;
241 that.run(); 302 that.run();
242 }; 303 };
243 if (reporter.noWebGL) { 304 if (reporter.noWebGL) {
244 button.disabled = true; 305 button.disabled = true;
245 } 306 }
246 div.appendChild(button); 307 div.appendChild(button);
247 var h = doc.createElement('span'); 308 var h = doc.createElement('span');
248 h.appendChild(doc.createTextNode(this.name)); 309 h.appendChild(doc.createTextNode(this.name));
249 div.appendChild(h); 310 div.appendChild(h);
250 var ul = doc.createElement('ul'); 311 var ul = doc.createElement('ul');
(...skipping 18 matching lines...) Expand all
269 for (var name in this.subFolders) { 330 for (var name in this.subFolders) {
270 numChildren += this.subFolders[name].numChildren(); 331 numChildren += this.subFolders[name].numChildren();
271 } 332 }
272 return numChildren + this.pages.length; 333 return numChildren + this.pages.length;
273 }; 334 };
274 335
275 Folder.prototype.run = function() { 336 Folder.prototype.run = function() {
276 var firstTestIndex = this.firstTestIndex(); 337 var firstTestIndex = this.firstTestIndex();
277 var count = this.numChildren(); 338 var count = this.numChildren();
278 log("run tests: " + firstTestIndex + " to " + (firstTestIndex + count - 1)) 339 log("run tests: " + firstTestIndex + " to " + (firstTestIndex + count - 1))
279 testHarness.runTests(firstTestIndex, count); 340 testHarness.runTests({start: firstTestIndex, count: count});
280 }; 341 };
281 342
282 Folder.prototype.getSubFolder = function(name) { 343 Folder.prototype.getSubFolder = function(name) {
283 var subFolder = this.subFolders[name]; 344 var subFolder = this.subFolders[name];
284 if (subFolder === undefined) { 345 if (subFolder === undefined) {
285 subFolder = new Folder(this.reporter, this, this.depth + 1, name); 346 subFolder = new Folder(this.reporter, this, this.depth + 1, name);
286 this.subFolders[name] = subFolder; 347 this.subFolders[name] = subFolder;
287 this.items.push(subFolder); 348 this.items.push(subFolder);
288 this.childUL.appendChild(subFolder.elem); 349 this.childUL.appendChild(subFolder.elem);
289 } 350 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 this.enableUp_(); 395 this.enableUp_();
335 } 396 }
336 for (var name in this.subFolders) { 397 for (var name in this.subFolders) {
337 this.subFolders[name].enableTest(re); 398 this.subFolders[name].enableTest(re);
338 } 399 }
339 for (var ii = 0; ii < this.pages.length; ++ii) { 400 for (var ii = 0; ii < this.pages.length; ++ii) {
340 this.pages[ii].enableTest(re); 401 this.pages[ii].enableTest(re);
341 } 402 }
342 }; 403 };
343 404
344 var Reporter = function() { 405 var Reporter = function(iframes) {
345 this.localDoc = document; 406 this.localDoc = document;
346 this.resultElem = document.getElementById("results"); 407 this.resultElem = document.getElementById("results");
347 this.fullResultsElem = document.getElementById("fullresults"); 408 this.fullResultsElem = document.getElementById("fullresults");
348 var node = this.localDoc.createTextNode(''); 409 var node = this.localDoc.createTextNode('');
349 this.fullResultsElem.appendChild(node); 410 this.fullResultsElem.appendChild(node);
350 this.fullResultsNode = node; 411 this.fullResultsNode = node;
351 this.iframe = document.getElementById("testframe"); 412 this.iframes = iframes;
352 this.currentPageElem = null; 413 this.currentPageElem = null;
353 this.totalPages = 0; 414 this.totalPages = 0;
354 this.pagesByURL = {}; 415 this.pagesByURL = {};
355 var canvas = document.getElementById("webglcheck"); 416 var canvas = document.getElementById("webglcheck");
356 var ctx = create3DContext(canvas); 417 var ctx = create3DContext(canvas);
357 this.noWebGL = !ctx; 418 this.noWebGL = !ctx;
358 this.contextInfo = {}; 419 this.contextInfo = {};
359 this.root = new Folder(this, null, 0, "all"); 420 this.root = new Folder(this, null, 0, "all");
360 this.resultElem.appendChild(this.root.elem); 421 this.resultElem.appendChild(this.root.elem);
361 this.callbacks = { }; 422 this.callbacks = { };
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 461
401 Reporter.prototype.executeListenerEvents_ = function(type) { 462 Reporter.prototype.executeListenerEvents_ = function(type) {
402 var callbacks = this.callbacks[type].slice(0); 463 var callbacks = this.callbacks[type].slice(0);
403 for (var ii = 0; ii < callbacks.length; ++ii) { 464 for (var ii = 0; ii < callbacks.length; ++ii) {
404 setTimeout(callbacks[ii], 0); 465 setTimeout(callbacks[ii], 0);
405 } 466 }
406 }; 467 };
407 468
408 Reporter.prototype.runTest = function(url) { 469 Reporter.prototype.runTest = function(url) {
409 var page = this.pagesByURL[url]; 470 var page = this.pagesByURL[url];
410 page.startPage(); 471 testHarness.runTests({start: page.firstTestIndex(), count: 1});
411 this.currentPage = page;
412 this.iframe.src = url;
413 }; 472 };
414 473
415 Reporter.prototype.getFolder = function(url) { 474 Reporter.prototype.getFolder = function(url) {
416 return this.root.getOrCreateFolder(url); 475 return this.root.getOrCreateFolder(url);
417 }; 476 };
418 477
419 Reporter.prototype.addPage = function(url) { 478 Reporter.prototype.addPage = function(url) {
420 var folder = this.getFolder(url); 479 var folder = this.getFolder(url);
421 var page = new Page(this, folder, this.totalPages, url); 480 var page = new Page(this, folder, this.totalPages, url);
422 folder.addPage(page); 481 folder.addPage(page);
423 ++this.totalPages; 482 ++this.totalPages;
424 this.pagesByURL[url] = page; 483 this.pagesByURL[url] = page;
425 }; 484 };
426 485
427 Reporter.prototype.startPage = function(url) { 486 Reporter.prototype.startPage = function(url) {
428 var page = this.pagesByURL[url]; 487 var page = this.pagesByURL[url];
429 this.currentPage = page;
430 return page.startPage(); 488 return page.startPage();
431 }; 489 };
432 490
433 Reporter.prototype.addResult = function(msg, success) { 491 Reporter.prototype.addResult = function(url, msg, success, skipped) {
434 if (this.currentPage != null) { 492 var page = this.pagesByURL[url];
435 this.currentPage.addResult(msg, success); 493 page.addResult(msg, success, skipped);
436 }
437 }; 494 };
438 495
439 Reporter.prototype.finishPage = function(success) { 496 Reporter.prototype.finishPage = function(url, success) {
440 if (this.currentPage != null) { 497 var page = this.pagesByURL[url];
441 this.currentPage.finishPage(success); 498 page.finishPage(success);
442 this.currentPage = null;
443 }
444 }; 499 };
445 500
446 Reporter.prototype.displayFinalResults = function(msg, success) { 501 Reporter.prototype.displayFinalResults = function(msg, success) {
447 if (success) { 502 if (success) {
448 var totalTests = 0; 503 var totalTests = 0;
449 var totalSuccessful = 0; 504 var totalSuccessful = 0;
450 var totalTimeouts = 0; 505 var totalTimeouts = 0;
506 var totalSkipped = 0;
451 for (var url in this.pagesByURL) { 507 for (var url in this.pagesByURL) {
452 var page = this.pagesByURL[url]; 508 var page = this.pagesByURL[url];
453 totalTests += page.totalTests; 509 totalTests += page.totalTests;
454 totalSuccessful += page.totalSuccessful; 510 totalSuccessful += page.totalSuccessful;
455 totalTimeouts += page.totalTimeouts; 511 totalTimeouts += page.totalTimeouts;
512 totalSkipped += page.totalSkipped;
456 } 513 }
457 var timeout = ''; 514 var timeout = '';
458 if (totalTimeouts > 0) { 515 if (totalTimeouts > 0) {
459 timeout = ', ' + totalTimeouts + ' timed out'; 516 timeout = ', ' + totalTimeouts + ' timed out';
460 } 517 }
461 var msg = ' (' + totalSuccessful + ' of ' + 518 var msg = ' (' + totalSuccessful + ' of ' +
462 totalTests + ' passed' + timeout + ')'; 519 totalTests + ' passed' + timeout + ')';
463 this.fullResultsNode.textContent = msg; 520 this.fullResultsNode.textContent = msg;
464 521
465 // generate a text summary 522 // generate a text summary
466 var tx = ""; 523 var tx = "";
467 tx += "WebGL Conformance Test Results\n"; 524 tx += "WebGL Conformance Test Results\n";
468 tx += "Version " + OPTIONS.version + "\n"; 525 tx += "Version " + OPTIONS.version + "\n";
469 tx += "\n"; 526 tx += "\n";
470 tx += "-------------------\n\n"; 527 tx += "-------------------\n\n";
471 tx += "User Agent: " + (navigator.userAgent ? navigator.userAgent : "(navi gator.userAgent is null)") + "\n"; 528 tx += "User Agent: " + (navigator.userAgent ? navigator.userAgent : "(navi gator.userAgent is null)") + "\n";
472 tx += "WebGL VENDOR: " + this.contextInfo["VENDOR"] + "\n"; 529 tx += "WebGL VENDOR: " + this.contextInfo["VENDOR"] + "\n";
473 tx += "WebGL VERSION: " + this.contextInfo["VERSION"] + "\n"; 530 tx += "WebGL VERSION: " + this.contextInfo["VERSION"] + "\n";
474 tx += "WebGL RENDERER: " + this.contextInfo["RENDERER"] + "\n"; 531 tx += "WebGL RENDERER: " + this.contextInfo["RENDERER"] + "\n";
475 tx += "Unmasked VENDOR: " + this.contextInfo["UNMASKED_VENDOR"] + "\n"; 532 tx += "Unmasked VENDOR: " + this.contextInfo["UNMASKED_VENDOR"] + "\n";
476 tx += "Unmasked RENDERER: " + this.contextInfo["UNMASKED_RENDERER"] + "\n" ; 533 tx += "Unmasked RENDERER: " + this.contextInfo["UNMASKED_RENDERER"] + "\n" ;
477 tx += "WebGL R/G/B/A/Depth/Stencil bits (default config): " + this.context Info["RED_BITS"] + "/" + this.contextInfo["GREEN_BITS"] + "/" + this.contextInfo ["BLUE_BITS"] + "/" + this.contextInfo["ALPHA_BITS"] + "/" + this.contextInfo["D EPTH_BITS"] + "/" + this.contextInfo["STENCIL_BITS"] + "\n"; 534 tx += "WebGL R/G/B/A/Depth/Stencil bits (default config): " + this.context Info["RED_BITS"] + "/" + this.contextInfo["GREEN_BITS"] + "/" + this.contextInfo ["BLUE_BITS"] + "/" + this.contextInfo["ALPHA_BITS"] + "/" + this.contextInfo["D EPTH_BITS"] + "/" + this.contextInfo["STENCIL_BITS"] + "\n";
478 tx += "\n"; 535 tx += "\n";
479 tx += "-------------------\n\n"; 536 tx += "-------------------\n\n";
480 tx += "Test Summary (" + totalTests + " total tests):\n"; 537 tx += "Test Summary (" + totalTests + " total tests):\n";
481 tx += "Tests PASSED: " + totalSuccessful + "\n"; 538 tx += "Tests PASSED: " + totalSuccessful + "\n";
482 tx += "Tests FAILED: " + (totalTests - totalSuccessful) + "\n"; 539 tx += "Tests FAILED: " + (totalTests - totalSuccessful - totalSkipped) + " \n";
483 tx += "Tests TIMED OUT: " + totalTimeouts + "\n"; 540 tx += "Tests TIMED OUT: " + totalTimeouts + "\n";
541 tx += "Tests SKIPPED: " + totalSkipped + "\n";
484 tx += "\n"; 542 tx += "\n";
485 tx += "-------------------\n\n"; 543 tx += "-------------------\n\n";
486 if (totalSuccessful < totalTests) { 544 if (totalSuccessful < totalTests) {
487 tx += "Failures:\n\n"; 545 tx += "Failures:\n\n";
488 for (var url in this.pagesByURL) { 546 for (var url in this.pagesByURL) {
489 var page = this.pagesByURL[url]; 547 var page = this.pagesByURL[url];
490 var pageTotalFail = page.totalTests - page.totalSuccessful; 548 var pageTotalFail = page.totalTests - page.totalSuccessful - page.to talSkipped;
491 if (!(page.totalTests == 0 && page.totalTimeouts == 0) && 549 if (!(page.totalTests == 0 && page.totalTimeouts == 0) &&
492 pageTotalFail > 0) 550 pageTotalFail > 0)
493 { 551 {
494 tx += url + ": " + pageTotalFail + " tests failed"; 552 tx += url + ": " + pageTotalFail + " tests failed";
495 if (page.totalTimeouts) 553 if (page.totalTimeouts)
496 tx += " (" + page.totalTimeouts + " timed out)"; 554 tx += " (" + page.totalTimeouts + " timed out)";
497 tx += "\n"; 555 tx += "\n";
498 } 556 }
499 } 557 }
500 } else { 558 } else {
501 tx += "All tests PASSED\n\n"; 559 tx += "All tests PASSED\n\n";
502 } 560 }
503 tx += "\n"; 561 tx += "\n";
504 tx += "-------------------\n\n"; 562 tx += "-------------------\n\n";
505 tx += "Complete Test Results (total / pass / fail / timeout):\n\n"; 563 tx += "Complete Test Results (total / pass / fail / timeout / skipped):\n\ n";
506 for (var url in this.pagesByURL) { 564 for (var url in this.pagesByURL) {
507 var page = this.pagesByURL[url]; 565 var page = this.pagesByURL[url];
508 var pageTotalFail = page.totalTests - page.totalSuccessful; 566 var pageTotalFail = page.totalTests - page.totalSuccessful - page.totalS kipped;
509 if (!(page.totalTests == 0 && page.totalTimeouts == 0)) { 567 if (!(page.totalTests == 0 && page.totalTimeouts == 0)) {
510 tx += url + ": " + page.totalTests + " / " + 568 tx += url + ": " + page.totalTests + " / " +
511 page.totalSuccessful + " / " + pageTotalFail + " / " + page.totalT imeouts + "\n"; 569 page.totalSuccessful + " / " + pageTotalFail + " / " + page.totalT imeouts + " / " + page.totalSkipped + "\n";
512 } 570 }
513 } 571 }
514 tx += "\n"; 572 tx += "\n";
515 tx += "-------------------\n\n"; 573 tx += "-------------------\n\n";
516 tx += "Generated on: " + (new Date()).toString() + "\n"; 574 tx += "Generated on: " + (new Date()).toString() + "\n";
517 575
518 var r = document.getElementById("testResultsAsText"); 576 var r = document.getElementById("testResultsAsText");
519 while (r.firstChild) r.removeChild(r.firstChild); 577 while (r.firstChild) r.removeChild(r.firstChild);
520 r.appendChild(document.createTextNode(tx)); 578 r.appendChild(document.createTextNode(tx));
521 document.getElementById("showTextSummary").style.visibility = "visible"; 579 document.getElementById("showTextSummary").style.visibility = "visible";
580
581 this.postResultsToServer(tx);
522 } else { 582 } else {
523 var e = document.getElementById("error"); 583 var e = document.getElementById("error");
524 e.innerHTML = msg; 584 e.innerHTML = msg;
585 this.postResultsToServer(msg);
525 } 586 }
526 }; 587 };
527 588
589 Reporter.prototype.postTestStartToServer = function(resultText) {
590 if(OPTIONS.postResults == undefined || OPTIONS.postResults == 0) {
591 return;
592 }
593
594 var xhr = new XMLHttpRequest();
595 xhr.open('POST', "/start", true);
596 xhr.send(null);
597 };
598
599 Reporter.prototype.postResultsToServer = function(resultText) {
600 if(OPTIONS.postResults == undefined || OPTIONS.postResults == 0) {
601 return;
602 }
603
604 var xhr = new XMLHttpRequest();
605 xhr.open('POST', "/finish", true);
606 xhr.setRequestHeader("Content-Type", "text/plain");
607 xhr.send(resultText);
608 };
609
528 Reporter.prototype.ready = function() { 610 Reporter.prototype.ready = function() {
529 var loading = document.getElementById("loading"); 611 var loading = document.getElementById("loading");
530 loading.style.display = "none"; 612 loading.style.display = "none";
531 if (!this.noWebGL) { 613 if (!this.noWebGL) {
532 var button = document.getElementById("runTestsButton"); 614 var button = document.getElementById("runTestsButton");
533 button.disabled = false; 615 button.disabled = false;
534 this.executeListenerEvents_("ready"); 616 this.executeListenerEvents_("ready");
535 } 617 }
536 }; 618 };
537 619
538 Reporter.prototype.reportFunc = function(type, msg, success) { 620 Reporter.prototype.reportFunc = function(type, url, msg, success, skipped) {
539 switch (type) { 621 switch (type) {
540 case reportType.ADD_PAGE: 622 case reportType.ADD_PAGE:
541 return this.addPage(msg); 623 return this.addPage(msg);
542 case reportType.READY: 624 case reportType.READY:
543 return this.ready(); 625 return this.ready();
544 case reportType.START_PAGE: 626 case reportType.START_PAGE:
545 return this.startPage(msg); 627 return this.startPage(url);
546 case reportType.TEST_RESULT: 628 case reportType.TEST_RESULT:
547 return this.addResult(msg, success); 629 return this.addResult(url, msg, success, skipped);
548 case reportType.FINISH_PAGE: 630 case reportType.FINISH_PAGE:
549 return this.finishPage(success); 631 return this.finishPage(url, success);
550 case reportType.FINISHED_ALL_TESTS: 632 case reportType.FINISHED_ALL_TESTS:
551 return this.displayFinalResults(msg, success); 633 return this.displayFinalResults(msg, success);
552 default: 634 default:
553 throw 'unhandled'; 635 throw 'unhandled';
554 break; 636 break;
555 }; 637 };
556 }; 638 };
557 639
558 var getURLOptions = function(obj) { 640 var getURLOptions = function(obj) {
559 var s = window.location.href; 641 var s = window.location.href;
560 var q = s.indexOf("?"); 642 var q = s.indexOf("?");
561 var e = s.indexOf("#"); 643 var e = s.indexOf("#");
562 if (e < 0) { 644 if (e < 0) {
563 e = s.length; 645 e = s.length;
564 } 646 }
565 var query = s.substring(q + 1, e); 647 var query = s.substring(q + 1, e);
566 var pairs = query.split("&"); 648 var pairs = query.split("&");
567 for (var ii = 0; ii < pairs.length; ++ii) { 649 for (var ii = 0; ii < pairs.length; ++ii) {
568 var keyValue = pairs[ii].split("="); 650 var keyValue = pairs[ii].split("=");
569 var key = keyValue[0]; 651 var key = keyValue[0];
570 var value = decodeURIComponent(keyValue[1]); 652 var value = decodeURIComponent(keyValue[1]);
571 obj[key] = value; 653 obj[key] = value;
572 } 654 }
573 }; 655 };
574 656
575 getURLOptions(OPTIONS); 657 getURLOptions(OPTIONS);
576 658
577 document.getElementById("testVersion").innerHTML = OPTIONS.version; 659 document.getElementById("testVersion").innerHTML = OPTIONS.version;
578 660
579 var reporter = new Reporter(); 661 // Make iframes
580 var iframe = document.getElementById("testframe"); 662 var makeIFrames = function() {
663 var toparea = document.getElementById("toparea");
664 var frame = document.getElementById("frames");
665 var areaWidth = Math.max(100, toparea.clientWidth - 300);
666 var areaHeight = Math.max(100, frame.clientHeight);
667
668 var numCells = OPTIONS.frames;
669
670 var gridWidth = Math.max(1, Math.ceil(Math.sqrt(numCells)));
671 var gridHeight = gridWidth;
672 var bestAspect = 99999;
673 var bestNumEmptyCells = 99999;
674 var bestNumEmptyCellsColumns = 0;
675 var bestNumEmptyCellsAspect = 99999;
676 var minGoodAspect = 1 / 3;
677 var maxGoodAspect = 3 / 1;
678
679 for (var columns = 1; columns <= numCells; ++columns) {
680 var rows = Math.ceil(numCells / columns);
681 var cellWidth = areaWidth / columns;
682 var cellHeight = areaHeight / rows;
683 var cellAspect = cellWidth / cellHeight;
684 if (cellAspect >= minGoodAspect && cellAspect <= maxGoodAspect) {
685 var numEmptyCells = columns * rows - numCells;
686 // Keep the one with the least number of empty cells.
687 if (numEmptyCells < bestNumEmptyCells) {
688 bestNumEmptyCells = numEmptyCells;
689 bestNumEmptyCellsColumns = columns;
690 bestNumEmptyCellsAspect = cellAspect;
691 // If it's the same number of empty cells keep the one
692 // with the best aspect.
693 } else if (numEmptyCells == bestNumEmptyCells &&
694 Math.abs(cellAspect - 1) <
695 Math.abs(bestNumEmptyCellsAspect - 1)) {
696 bestNumEmptyCellsColumns = columns;
697 bestNumEmptyCellsAspect = cellAspect;
698 }
699 }
700 if (Math.abs(cellAspect - 1) < Math.abs(bestAspect - 1)) {
701 gridWidth = columns;
702 gridHeight = rows;
703 bestAspect = cellAspect;
704 }
705 }
706
707 // if we found an aspect with few empty cells use that.
708 var numEmptyCells = gridWidth * gridHeight - numCells;
709 if (bestNumEmptyCellsColumns && bestNumEmptyCells < numEmptyCells) {
710 gridWidth = bestNumEmptyCellsColumns;
711 gridHeight = Math.ceil(numCells / gridWidth);
712 }
713
714 var table = document.createElement("table");
715 table.style.height = areaHeight + "px";
716 var tbody = document.createElement("tbody");
717 var iframes = [];
718 for (var row = 0; row < gridHeight; ++row) {
719 var tr = document.createElement("tr");
720 for (var column = 0; column < gridWidth; ++column) {
721 var td = document.createElement("td");
722 if (numCells > 0) {
723 --numCells;
724 var iframe = document.createElement("iframe");
725 iframe.setAttribute("scrolling", "yes");
726 iframe.style.width = "100%";
727 iframe.style.height = "100%";
728 iframes.push(iframe);
729 td.appendChild(iframe);
730 }
731 tr.appendChild(td);
732 }
733 tbody.appendChild(tr);
734 }
735 table.appendChild(tbody);
736 frame.appendChild(table);
737 return iframes;
738 };
739 var iframes = makeIFrames();
740
741 var reporter = new Reporter(iframes);
581 var testHarness = new WebGLTestHarnessModule.TestHarness( 742 var testHarness = new WebGLTestHarnessModule.TestHarness(
582 iframe, 743 iframes,
583 '00_test_list.txt', 744 '00_test_list.txt',
584 function(type, msg, success) { 745 function(type, url, msg, success, skipped) {
585 return reporter.reportFunc(type, msg, success); 746 return reporter.reportFunc(type, url, msg, success, skipped);
586 }, 747 },
587 OPTIONS); 748 OPTIONS);
588 reporter.addEventListener("ready", function() { 749 reporter.addEventListener("ready", function() {
589 // Set which tests to include. 750 // Set which tests to include.
590 if (OPTIONS.include) { 751 if (OPTIONS.include) {
591 reporter.disableAllTests(); 752 reporter.disableAllTests();
592 var includes = OPTIONS.include.split(",") 753 var includes = OPTIONS.include.split(",")
593 for (var ii = 0; ii < includes.length; ++ii) { 754 for (var ii = 0; ii < includes.length; ++ii) {
594 reporter.enableTest(new RegExp(includes[ii])); 755 reporter.enableTest(new RegExp(includes[ii]));
595 } 756 }
596 } 757 }
597 // Remove tests based on skip=re1,re2 in URL. 758 // Remove tests based on skip=re1,re2 in URL.
598 if (OPTIONS.skip) { 759 if (OPTIONS.skip) {
599 var skips = OPTIONS.skip.split(",") 760 var skips = OPTIONS.skip.split(",")
600 for (var ii = 0; ii < skips.length; ++ii) { 761 for (var ii = 0; ii < skips.length; ++ii) {
601 reporter.disableTest(new RegExp(skips[ii])); 762 reporter.disableTest(new RegExp(skips[ii]));
602 } 763 }
603 } 764 }
604 // Auto run the tests if the run=1 in URL 765 // Auto run the tests if the run=1 in URL
605 if (OPTIONS.run != undefined && OPTIONS.run != 0) { 766 if (OPTIONS.run != undefined && OPTIONS.run != 0) {
767 reporter.postTestStartToServer();
606 testHarness.runTests(); 768 testHarness.runTests();
607 } 769 }
608 }); 770 });
609 window.webglTestHarness = testHarness; 771 window.webglTestHarness = testHarness;
610 var button = document.getElementById("runTestsButton"); 772 var button = document.getElementById("runTestsButton");
611 button.disabled = true; 773 button.disabled = true;
612 button.onclick = function() { 774 button.onclick = function() {
775 autoScroll = autoScrollEnabled;
776 reporter.postTestStartToServer();
613 testHarness.runTests(); 777 testHarness.runTests();
614 }; 778 };
779 var autoScrollCheckbox = document.getElementById("autoScrollCheckbox");
780 autoScrollCheckbox.checked = autoScrollEnabled;
781 autoScrollCheckbox.onclick = function() {
782 autoScrollEnabled = autoScrollCheckbox.checked;
783 autoScroll = autoScrollEnabled;
784 };
615 var textbutton = document.getElementById("showTextSummary"); 785 var textbutton = document.getElementById("showTextSummary");
616 textbutton.onclick = function() { 786 textbutton.onclick = function() {
617 log("click"); 787 log("click");
618 var htmldiv = document.getElementById("testResultsHTML"); 788 var htmldiv = document.getElementById("testResultsHTML");
619 var textdiv = document.getElementById("testResultsText"); 789 var textdiv = document.getElementById("testResultsText");
620 if (textdiv.style.display == "none") { 790 if (textdiv.style.display == "none") {
621 textdiv.style.display = "block"; 791 textdiv.style.display = "block";
622 htmldiv.style.display = "none"; 792 htmldiv.style.display = "none";
623 textbutton.setAttribute("value", "display html summary"); 793 textbutton.setAttribute("value", "display html summary");
624 } else { 794 } else {
625 textdiv.style.display = "none"; 795 textdiv.style.display = "none";
626 htmldiv.style.display = "block"; 796 htmldiv.style.display = "block";
627 textbutton.setAttribute("value", "display text summary"); 797 textbutton.setAttribute("value", "display text summary");
628 } 798 }
629 }; 799 };
630 if (reporter.noWebGL) { 800 if (reporter.noWebGL) {
631 button.disabled = true; 801 button.disabled = true;
632 var elem = document.getElementById("nowebgl"); 802 var elem = document.getElementById("nowebgl");
633 elem.style.display = ""; 803 elem.style.display = "";
804 reporter.postResultsToServer("Browser does not appear to support WebGL");
634 } 805 }
635 } 806 }
636 </script> 807 </script>
637 </head> 808 </head>
638 <body onload="start()"> 809 <body onload="start()">
810
811 <div id="testlist">
812
813 <div id="testResultsHTML">
814 <ul id="results">
815 </ul>
816 </div>
817 <div style="display: none;" id="testResultsText">
818 <pre id="testResultsAsText"></pre>
819 </div>
820
821 </div> <!-- end of container -->
822
823 <div id="header">
824
639 <table border="2"> 825 <table border="2">
640 <tr style="height: 300px;"> 826 <tr style="height: 300px;">
641 <td> 827 <td>
642 <table> 828 <table id="toparea">
643 <tr><td><img src="resources/webgl-logo.png" /><br />WebGL Conformance Test Runne r<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"/> 829 <tr>
644 <div id="nowebgl" class="nowebgl" style="display: none;">This browser does not a ppear to support WebGL</div></td></tr> 830 <td style="width: 300px">
645 <tr><td><div id="loading">Loading Tests...</div> 831 <div id="info">
646 <div style="border: 1px">Results: <span id="fullresults"></span></div> 832 <img src="resources/webgl-logo.png" /><br />
647 <canvas id="webglcheck" style="display: none;"></canvas></td></tr> 833 WebGL Conformance Test Runner<br/>
648 <tr><td><div id="error-wrap"><pre id="error"></pre></div></td></tr> 834 Version
835 <span id="testVersion">
836 </span>
837 <br/>
838 <input type="button" value="run tests" id="runTestsButton"/>
839 <br/>
840 <input type="checkbox" id="autoScrollCheckbox"/>
841 <label for="autoScrollCheckbox">auto scroll</label>
842 <br/>
843 <input type="button" style="visibility: hidden;" value="display te xt summary" id="showTextSummary"/>
844 <div id="nowebgl" class="nowebgl" style="display: none;">
845 This browser does not appear to support WebGL
846 </div>
847 </div>
848 </td>
849 </tr>
850 <tr>
851 <td>
852 <div id="loading">
853 Loading Tests...
854 </div>
855 <div style="border: 1px">
856 Results:
857 <span id="fullresults">
858 </span>
859 </div>
860 <canvas id="webglcheck" style="display: none;">
861 </canvas>
862 </td>
863 </tr>
864 <tr>
865 <td>
866 <div id="error-wrap">
867 <pre id="error"></pre>
868 </div>
869 </td>
870 </tr>
871 </table>
872 </td>
873 <td id="frames"></td>
874 </tr>
649 </table> 875 </table>
650 </td> 876 </div> <!-- end of header -->
651 <td> 877
652 <iframe id="testframe" scrolling="yes" width="100%" height="100%"></iframe>
653 </td>
654 </tr>
655 <tr>
656 <td colspan="2">
657 <div style="text-align: left; width: 100%; height: 100%; overflow: auto;">
658 <div id="testResultsHTML"><ul id="results"></ul></div>
659 <div style="display: none;" id="testResultsText"><pre id="testResultsAsText"></p re></div>
660 </div>
661 </td>
662 </tr>
663 </table>
664 </body> 878 </body>
665 </html> 879 </html>
OLDNEW
« no previous file with comments | « test-guidelines.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698