summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjrt@chromium.org <jrt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 22:28:48 +0000
committerjrt@chromium.org <jrt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 22:28:48 +0000
commitfdc70e6a71d99246a7c5471b9233b5a864ede61f (patch)
tree2ce50a0d4b39b876547d15e7d7ea11aeef116e9d /chrome
parent3d715c08e5b15c37ea117739f8db02e126f6514c (diff)
downloadchromium_src-fdc70e6a71d99246a7c5471b9233b5a864ede61f.zip
chromium_src-fdc70e6a71d99246a7c5471b9233b5a864ede61f.tar.gz
chromium_src-fdc70e6a71d99246a7c5471b9233b5a864ede61f.tar.bz2
Improved the WebGL conformance tests.
If the test now results in a timeout, it fails. Before, it would erroneously pass. Also, the test first checks if it can create a WebGL context, failing immediately if it cannot (what's the point of a WebGL conformance test without WebGL?). When a test fails, it now prints informative, machine-specific WebGL data. TEST=gpu_tests --gtest_filter=WebGLConformanceTests.* Review URL: http://codereview.chromium.org/7359004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/data/gpu/webgl_conformance.html76
1 files changed, 55 insertions, 21 deletions
diff --git a/chrome/test/data/gpu/webgl_conformance.html b/chrome/test/data/gpu/webgl_conformance.html
index 6df30cd..90263fc 100644
--- a/chrome/test/data/gpu/webgl_conformance.html
+++ b/chrome/test/data/gpu/webgl_conformance.html
@@ -4,34 +4,69 @@
src="webgl_conformance/resources/webgl-test-harness.js">
</script>
<script>
-var reportType = WebGLTestHarnessModule.TestHarness.reportType;
var running;
var result;
var message;
-// Report function called by each conformance test.
-function report(type, msg, success) {
- switch (type) {
- case reportType.START_PAGE:
- // Accept every page loaded.
- return true;
- case reportType.TEST_RESULT:
- if (!success) {
- // If any test fails, the result is false.
- result = false;
- message += msg + "\n";
- }
- break;
- case reportType.FINISHED_ALL_TESTS:
- running = false;
- break;
- }
-}
-
function start(start_url) {
running = true;
result = true;
message = "";
+
+ // 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.
+ return true;
+ case reportType.TEST_RESULT:
+ if (!success) {
+ // If any test fails, the result is false.
+ result = false;
+ message += msg + "\n";
+ }
+ break;
+ case reportType.FINISH_PAGE:
+ if (!success) {
+ // Result is false if a timeout occurs.
+ result = false;
+ message += "Timeout (" + window.webglTestHarness.timeoutDelay +
+ " ms)\n";
+ }
+ case reportType.FINISHED_ALL_TESTS:
+ running = false;
+ 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.
+ var context = create3DContext();
+ if (!context) {
+ message += "Unable to fetch WebGL rendering context for Canvas.\n";
+ running = false;
+ result = false;
+ return;
+ }
+ message += "WebGL VENDOR: " + context.getParameter(context.VENDOR) + "\n";
+ message += "WebGL RENDERER: " + context.getParameter(context.RENDERER) + "\n";
+
var iframe = document.getElementById("testframe");
var testHarness = new WebGLTestHarnessModule.TestHarness(
iframe,
@@ -44,6 +79,5 @@ function start(start_url) {
</head>
<body>
<iframe id="testframe" scrolling="yes" width="100%" height="100%"></iframe>
-</table>
</body>
</html>