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

Unified 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, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test-guidelines.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webgl-conformance-tests.html
===================================================================
--- webgl-conformance-tests.html (revision 230753)
+++ webgl-conformance-tests.html (working copy)
@@ -28,26 +28,62 @@
<html>
<head>
<meta charset="utf-8">
+<!-- Prevents Chrome from offering to translate tests which generate
+ random characters for things like attribute names -->
+<meta name="google" value="notranslate">
<title>WebGL Conformance Tests</title>
<style>
- html, body {
+ body {
border: 0;
margin: 0;
+ padding: 0;
height: 100%;
- height: 100%;
- text-align: center;
+ max-height:100%;
font-family: monospace;
+ overflow: hidden;
}
+
+ #testlist {
+ position:fixed;
+ top:310px;
+ left:0;
+ right:0;
+ bottom:0px;
+ overflow:auto;
+ padding:1em;
+ }
+
+ #header {
+ position:absolute;
+ top:0;
+ left:0;
+ width:100%;
+ height:310px;
+ overflow:auto;
+ }
+
+ #info {
+ text-align: center;
+ min-width: 300px;
+ }
+
table {
width: 100%;
height: 100%;
}
+ #frames td {
+ border: 1px solid black;
+ min-height: 1px;
+ min-width: 1px;
+ }
+ #frames t
.timeout { }
.success { }
.fail { }
.testpage { border: 1px solid black; background-color: #ccc; }
.testpagesuccess { border: 1px solid black; background-color: #8F8; }
.testpagefail { border: 1px solid black; background-color: #F88; }
+ .testpageskipped { border: 1px solid black; background-color: #888; }
.testpagetimeout { border: 1px solid black; background-color: #FC8; }
.nowebgl { font-weight: bold; color: red; }
#error-wrap {
@@ -69,10 +105,13 @@
</style>
<script type="text/javascript" src="resources/webgl-test-harness.js"></script>
<script>
-var CONFORMANCE_TEST_VERSION = "1.0.2 (beta)";
+"use strict";
+var CONFORMANCE_TEST_VERSION = "1.0.3 (beta)";
var OPTIONS = {
- version: CONFORMANCE_TEST_VERSION
+ version: CONFORMANCE_TEST_VERSION,
+ frames: 1,
+ allowSkip: 0
};
function start() {
@@ -103,6 +142,10 @@
}
var reportType = WebGLTestHarnessModule.TestHarness.reportType;
+ var pageCount = 0;
+ var folderCount = 0;
+ var autoScrollEnabled = true; // Whether the user prefers to auto scroll
+ var autoScroll = true; // Whether auto scroll is actually performed
var Page = function(reporter, folder, testIndex, url) {
this.reporter = reporter;
@@ -111,9 +154,12 @@
this.totalTests = 0;
this.totalSuccessful = 0;
this.totalTimeouts = 0;
+ this.totalSkipped = 0;
this.testIndex = testIndex;
+ this.elementId = "page" + pageCount++;
var li = reporter.localDoc.createElement('li');
+ li.id = this.elementId;
var div = reporter.localDoc.createElement('div');
var check = reporter.localDoc.createElement('input');
check.type = 'checkbox';
@@ -123,6 +169,7 @@
button.type = 'button';
button.value = 'run';
button.onclick = function() {
+ autoScroll = false;
reporter.runTest(url);
};
if (reporter.noWebGL) {
@@ -147,16 +194,18 @@
this.check = check;
};
- Page.prototype.addResult = function(msg, success) {
+ Page.prototype.addResult = function(msg, success, skipped) {
++this.totalTests;
if (success === undefined) {
++this.totalTimeouts;
var result = "timeout";
var css = "timeout";
} else if (success) {
- ++this.totalSuccessful;
- var result = "success";
- var css = "success";
+ if(skipped) {
+ ++this.totalSkipped;
+ } else {
+ ++this.totalSuccessful;
+ }
// don't report success.
return;
} else {
@@ -172,6 +221,9 @@
};
Page.prototype.startPage = function() {
+ if (autoScroll && this.elem.scrollIntoView) {
+ this.elem.scrollIntoView(false);
+ }
this.totalTests = 0;
this.totalSuccessful = 0;
this.totalTimeouts = 0;
@@ -188,13 +240,19 @@
};
Page.prototype.finishPage = function(success) {
- var msg = ' (' + this.totalSuccessful + ' of ' +
- this.totalTests + ' passed)';
+ if(this.totalSkipped) {
+ var msg = ' (' + this.totalSkipped + ' of ' + this.totalTests + ' skipped)';
+ } else {
+ var msg = ' (' + this.totalSuccessful + ' of ' + this.totalTests + ' passed)';
+ }
+
if (success === undefined) {
var css = 'testpagetimeout';
msg = '(*timeout*)';
++this.totalTests;
++this.totalTimeouts;
+ } else if (this.totalSkipped) {
+ var css = 'testpageskipped';
} else if (this.totalSuccessful != this.totalTests) {
var css = 'testpagefail';
} else {
@@ -228,7 +286,9 @@
var that = this;
var doc = reporter.localDoc;
+ this.elementId = "folder" + folderCount++;
var li = doc.createElement('li');
+ li.id = this.elementId;
var div = doc.createElement('div');
var check = doc.createElement('input');
check.type = 'checkbox';
@@ -238,6 +298,7 @@
button.type = 'button';
button.value = 'run';
button.onclick = function() {
+ autoScroll = autoScrollEnabled;
that.run();
};
if (reporter.noWebGL) {
@@ -276,7 +337,7 @@
var firstTestIndex = this.firstTestIndex();
var count = this.numChildren();
log("run tests: " + firstTestIndex + " to " + (firstTestIndex + count - 1))
- testHarness.runTests(firstTestIndex, count);
+ testHarness.runTests({start: firstTestIndex, count: count});
};
Folder.prototype.getSubFolder = function(name) {
@@ -341,14 +402,14 @@
}
};
- var Reporter = function() {
+ var Reporter = function(iframes) {
this.localDoc = document;
this.resultElem = document.getElementById("results");
this.fullResultsElem = document.getElementById("fullresults");
var node = this.localDoc.createTextNode('');
this.fullResultsElem.appendChild(node);
this.fullResultsNode = node;
- this.iframe = document.getElementById("testframe");
+ this.iframes = iframes;
this.currentPageElem = null;
this.totalPages = 0;
this.pagesByURL = {};
@@ -407,9 +468,7 @@
Reporter.prototype.runTest = function(url) {
var page = this.pagesByURL[url];
- page.startPage();
- this.currentPage = page;
- this.iframe.src = url;
+ testHarness.runTests({start: page.firstTestIndex(), count: 1});
};
Reporter.prototype.getFolder = function(url) {
@@ -426,21 +485,17 @@
Reporter.prototype.startPage = function(url) {
var page = this.pagesByURL[url];
- this.currentPage = page;
return page.startPage();
};
- Reporter.prototype.addResult = function(msg, success) {
- if (this.currentPage != null) {
- this.currentPage.addResult(msg, success);
- }
+ Reporter.prototype.addResult = function(url, msg, success, skipped) {
+ var page = this.pagesByURL[url];
+ page.addResult(msg, success, skipped);
};
- Reporter.prototype.finishPage = function(success) {
- if (this.currentPage != null) {
- this.currentPage.finishPage(success);
- this.currentPage = null;
- }
+ Reporter.prototype.finishPage = function(url, success) {
+ var page = this.pagesByURL[url];
+ page.finishPage(success);
};
Reporter.prototype.displayFinalResults = function(msg, success) {
@@ -448,11 +503,13 @@
var totalTests = 0;
var totalSuccessful = 0;
var totalTimeouts = 0;
+ var totalSkipped = 0;
for (var url in this.pagesByURL) {
var page = this.pagesByURL[url];
totalTests += page.totalTests;
totalSuccessful += page.totalSuccessful;
totalTimeouts += page.totalTimeouts;
+ totalSkipped += page.totalSkipped;
}
var timeout = '';
if (totalTimeouts > 0) {
@@ -479,15 +536,16 @@
tx += "-------------------\n\n";
tx += "Test Summary (" + totalTests + " total tests):\n";
tx += "Tests PASSED: " + totalSuccessful + "\n";
- tx += "Tests FAILED: " + (totalTests - totalSuccessful) + "\n";
+ tx += "Tests FAILED: " + (totalTests - totalSuccessful - totalSkipped) + "\n";
tx += "Tests TIMED OUT: " + totalTimeouts + "\n";
+ tx += "Tests SKIPPED: " + totalSkipped + "\n";
tx += "\n";
tx += "-------------------\n\n";
if (totalSuccessful < totalTests) {
tx += "Failures:\n\n";
for (var url in this.pagesByURL) {
var page = this.pagesByURL[url];
- var pageTotalFail = page.totalTests - page.totalSuccessful;
+ var pageTotalFail = page.totalTests - page.totalSuccessful - page.totalSkipped;
if (!(page.totalTests == 0 && page.totalTimeouts == 0) &&
pageTotalFail > 0)
{
@@ -502,13 +560,13 @@
}
tx += "\n";
tx += "-------------------\n\n";
- tx += "Complete Test Results (total / pass / fail / timeout):\n\n";
+ tx += "Complete Test Results (total / pass / fail / timeout / skipped):\n\n";
for (var url in this.pagesByURL) {
var page = this.pagesByURL[url];
- var pageTotalFail = page.totalTests - page.totalSuccessful;
+ var pageTotalFail = page.totalTests - page.totalSuccessful - page.totalSkipped;
if (!(page.totalTests == 0 && page.totalTimeouts == 0)) {
tx += url + ": " + page.totalTests + " / " +
- page.totalSuccessful + " / " + pageTotalFail + " / " + page.totalTimeouts + "\n";
+ page.totalSuccessful + " / " + pageTotalFail + " / " + page.totalTimeouts + " / " + page.totalSkipped + "\n";
}
}
tx += "\n";
@@ -519,12 +577,36 @@
while (r.firstChild) r.removeChild(r.firstChild);
r.appendChild(document.createTextNode(tx));
document.getElementById("showTextSummary").style.visibility = "visible";
+
+ this.postResultsToServer(tx);
} else {
var e = document.getElementById("error");
e.innerHTML = msg;
+ this.postResultsToServer(msg);
}
};
+ Reporter.prototype.postTestStartToServer = function(resultText) {
+ if(OPTIONS.postResults == undefined || OPTIONS.postResults == 0) {
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', "/start", true);
+ xhr.send(null);
+ };
+
+ Reporter.prototype.postResultsToServer = function(resultText) {
+ if(OPTIONS.postResults == undefined || OPTIONS.postResults == 0) {
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', "/finish", true);
+ xhr.setRequestHeader("Content-Type", "text/plain");
+ xhr.send(resultText);
+ };
+
Reporter.prototype.ready = function() {
var loading = document.getElementById("loading");
loading.style.display = "none";
@@ -535,18 +617,18 @@
}
};
- Reporter.prototype.reportFunc = function(type, msg, success) {
+ Reporter.prototype.reportFunc = function(type, url, msg, success, skipped) {
switch (type) {
case reportType.ADD_PAGE:
return this.addPage(msg);
case reportType.READY:
return this.ready();
case reportType.START_PAGE:
- return this.startPage(msg);
+ return this.startPage(url);
case reportType.TEST_RESULT:
- return this.addResult(msg, success);
+ return this.addResult(url, msg, success, skipped);
case reportType.FINISH_PAGE:
- return this.finishPage(success);
+ return this.finishPage(url, success);
case reportType.FINISHED_ALL_TESTS:
return this.displayFinalResults(msg, success);
default:
@@ -576,13 +658,92 @@
document.getElementById("testVersion").innerHTML = OPTIONS.version;
- var reporter = new Reporter();
- var iframe = document.getElementById("testframe");
+ // Make iframes
+ var makeIFrames = function() {
+ var toparea = document.getElementById("toparea");
+ var frame = document.getElementById("frames");
+ var areaWidth = Math.max(100, toparea.clientWidth - 300);
+ var areaHeight = Math.max(100, frame.clientHeight);
+
+ var numCells = OPTIONS.frames;
+
+ var gridWidth = Math.max(1, Math.ceil(Math.sqrt(numCells)));
+ var gridHeight = gridWidth;
+ var bestAspect = 99999;
+ var bestNumEmptyCells = 99999;
+ var bestNumEmptyCellsColumns = 0;
+ var bestNumEmptyCellsAspect = 99999;
+ var minGoodAspect = 1 / 3;
+ var maxGoodAspect = 3 / 1;
+
+ for (var columns = 1; columns <= numCells; ++columns) {
+ var rows = Math.ceil(numCells / columns);
+ var cellWidth = areaWidth / columns;
+ var cellHeight = areaHeight / rows;
+ var cellAspect = cellWidth / cellHeight;
+ if (cellAspect >= minGoodAspect && cellAspect <= maxGoodAspect) {
+ var numEmptyCells = columns * rows - numCells;
+ // Keep the one with the least number of empty cells.
+ if (numEmptyCells < bestNumEmptyCells) {
+ bestNumEmptyCells = numEmptyCells;
+ bestNumEmptyCellsColumns = columns;
+ bestNumEmptyCellsAspect = cellAspect;
+ // If it's the same number of empty cells keep the one
+ // with the best aspect.
+ } else if (numEmptyCells == bestNumEmptyCells &&
+ Math.abs(cellAspect - 1) <
+ Math.abs(bestNumEmptyCellsAspect - 1)) {
+ bestNumEmptyCellsColumns = columns;
+ bestNumEmptyCellsAspect = cellAspect;
+ }
+ }
+ if (Math.abs(cellAspect - 1) < Math.abs(bestAspect - 1)) {
+ gridWidth = columns;
+ gridHeight = rows;
+ bestAspect = cellAspect;
+ }
+ }
+
+ // if we found an aspect with few empty cells use that.
+ var numEmptyCells = gridWidth * gridHeight - numCells;
+ if (bestNumEmptyCellsColumns && bestNumEmptyCells < numEmptyCells) {
+ gridWidth = bestNumEmptyCellsColumns;
+ gridHeight = Math.ceil(numCells / gridWidth);
+ }
+
+ var table = document.createElement("table");
+ table.style.height = areaHeight + "px";
+ var tbody = document.createElement("tbody");
+ var iframes = [];
+ for (var row = 0; row < gridHeight; ++row) {
+ var tr = document.createElement("tr");
+ for (var column = 0; column < gridWidth; ++column) {
+ var td = document.createElement("td");
+ if (numCells > 0) {
+ --numCells;
+ var iframe = document.createElement("iframe");
+ iframe.setAttribute("scrolling", "yes");
+ iframe.style.width = "100%";
+ iframe.style.height = "100%";
+ iframes.push(iframe);
+ td.appendChild(iframe);
+ }
+ tr.appendChild(td);
+ }
+ tbody.appendChild(tr);
+ }
+ table.appendChild(tbody);
+ frame.appendChild(table);
+ return iframes;
+ };
+ var iframes = makeIFrames();
+
+ var reporter = new Reporter(iframes);
var testHarness = new WebGLTestHarnessModule.TestHarness(
- iframe,
+ iframes,
'00_test_list.txt',
- function(type, msg, success) {
- return reporter.reportFunc(type, msg, success);
+ function(type, url, msg, success, skipped) {
+ return reporter.reportFunc(type, url, msg, success, skipped);
},
OPTIONS);
reporter.addEventListener("ready", function() {
@@ -603,6 +764,7 @@
}
// Auto run the tests if the run=1 in URL
if (OPTIONS.run != undefined && OPTIONS.run != 0) {
+ reporter.postTestStartToServer();
testHarness.runTests();
}
});
@@ -610,8 +772,16 @@
var button = document.getElementById("runTestsButton");
button.disabled = true;
button.onclick = function() {
+ autoScroll = autoScrollEnabled;
+ reporter.postTestStartToServer();
testHarness.runTests();
};
+ var autoScrollCheckbox = document.getElementById("autoScrollCheckbox");
+ autoScrollCheckbox.checked = autoScrollEnabled;
+ autoScrollCheckbox.onclick = function() {
+ autoScrollEnabled = autoScrollCheckbox.checked;
+ autoScroll = autoScrollEnabled;
+ };
var textbutton = document.getElementById("showTextSummary");
textbutton.onclick = function() {
log("click");
@@ -631,35 +801,79 @@
button.disabled = true;
var elem = document.getElementById("nowebgl");
elem.style.display = "";
+ reporter.postResultsToServer("Browser does not appear to support WebGL");
}
}
</script>
</head>
<body onload="start()">
+
+<div id="testlist">
+
+ <div id="testResultsHTML">
+ <ul id="results">
+ </ul>
+ </div>
+ <div style="display: none;" id="testResultsText">
+ <pre id="testResultsAsText"></pre>
+ </div>
+
+</div> <!-- end of container -->
+
+<div id="header">
+
<table border="2">
-<tr style="height: 300px;">
-<td>
-<table>
-<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"/>
-<div id="nowebgl" class="nowebgl" style="display: none;">This browser does not appear to support WebGL</div></td></tr>
-<tr><td><div id="loading">Loading Tests...</div>
-<div style="border: 1px">Results: <span id="fullresults"></span></div>
-<canvas id="webglcheck" style="display: none;"></canvas></td></tr>
-<tr><td><div id="error-wrap"><pre id="error"></pre></div></td></tr>
+ <tr style="height: 300px;">
+ <td>
+ <table id="toparea">
+ <tr>
+ <td style="width: 300px">
+ <div id="info">
+ <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="checkbox" id="autoScrollCheckbox"/>
+ <label for="autoScrollCheckbox">auto scroll</label>
+ <br/>
+ <input type="button" style="visibility: hidden;" value="display text summary" id="showTextSummary"/>
+ <div id="nowebgl" class="nowebgl" style="display: none;">
+ This browser does not appear to support WebGL
+ </div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="loading">
+ Loading Tests...
+ </div>
+ <div style="border: 1px">
+ Results:
+ <span id="fullresults">
+ </span>
+ </div>
+ <canvas id="webglcheck" style="display: none;">
+ </canvas>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="error-wrap">
+ <pre id="error"></pre>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td id="frames"></td>
+ </tr>
</table>
-</td>
-<td>
-<iframe id="testframe" scrolling="yes" width="100%" height="100%"></iframe>
-</td>
-</tr>
-<tr>
-<td colspan="2">
-<div style="text-align: left; width: 100%; height: 100%; overflow: auto;">
-<div id="testResultsHTML"><ul id="results"></ul></div>
-<div style="display: none;" id="testResultsText"><pre id="testResultsAsText"></pre></div>
-</div>
-</td>
-</tr>
-</table>
+</div> <!-- end of header -->
+
</body>
</html>
« 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