Index: tools/cc-frame-viewer/src/tests.html |
diff --git a/tools/cc-frame-viewer/src/tests.html b/tools/cc-frame-viewer/src/tests.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..640f4aa98f1c76a218cc71379f31782d4732935b |
--- /dev/null |
+++ b/tools/cc-frame-viewer/src/tests.html |
@@ -0,0 +1,127 @@ |
+<!DOCTYPE html> |
+<html> |
+<!-- |
+Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+Use of this source code is governed by a BSD-style license that can be |
+found in the LICENSE file. |
+--> |
+<head> |
+<title>All Tests</title> |
+<script> |
+ tests = [ |
+ 'analysis_view_test.html', |
+ 'base/bbox2_test.html', |
+ 'base/color_test.html', |
+ 'base/gl_matrix_test.html', |
+ 'base/range_test.html', |
+ 'lthi_view_test.html', |
+ 'model_test.html', |
+ 'model_view_test.html', |
+ 'quad_view_test.html', |
+ 'quad_view_viewport_test.html', |
+ 'tile_view_test.html', |
+ 'tree_quad_view_test.html', |
+ 'ui/list_and_associated_view_test.html', |
+ 'ui/list_view_test.html', |
+ ]; |
+</script> |
+<style> |
+ h1 { |
+ font-family: sans-serif; |
+ font-size: 18pt; |
+ } |
+</style> |
+<script src="base.js"></script> |
+<script> |
+ base.require('base.unittest'); |
+</script> |
+</head> |
+<body> |
+ <h1>Tests</h3> |
+ |
+ <div class="unittest">Interactive tests: <a href="interactive_tests.html" class="unittest-error-link">Run manually</a></div> |
+ <br> |
+ |
+ <script> |
+ function runTest(runner, testCaseEl, test) { |
+ testCaseEl.status = 'RUNNING' |
+ |
+ var iframe = document.createElement('iframe'); |
+ iframe.src = test; |
+ iframe.style.position = 'fixed'; |
+ iframe.style.visibility = 'hidden'; |
+ document.body.appendChild(iframe); |
+ iframe.contentWindow.addEventListener('error', function(msg, url, lineNumber) { |
+ if (iframe.contentWindow.G_testRunner) |
+ return false; |
+ |
+ if (iframe.contentWindow.errorsCaughtByTestHarness) |
+ return false; |
+ |
+ iframe.contentWindow.errorsCaughtByTestHarness = [ |
+ {msg: msg, url: url, lineNumber: lineNumber}]; |
+ return false; |
+ }); |
+ |
+ function checkForDone() { |
+ if (!iframe.contentWindow) { |
+ setTimeout(checkForDone, 100); |
+ return; |
+ } |
+ |
+ if (iframe.contentWindow.errorsCaughtByTestHarness && |
+ iframe.contentWindow.errorsCaughtByTestHarness.length) { |
+ testCaseEl.status = 'FAILED' |
+ return; |
+ } |
+ |
+ if (!iframe.contentWindow.G_testRunner) { |
+ setTimeout(checkForDone, 100); |
+ return; |
+ } |
+ |
+ var runner = iframe.contentWindow.G_testRunner; |
+ if (!runner.done) { |
+ setTimeout(checkForDone, 100); |
+ return; |
+ } |
+ |
+ var stats = runner.computeResultStats(); |
+ if (stats.numTestsRun && !stats.numTestsWithErrors) |
+ testCaseEl.status = 'PASSED' |
+ else |
+ testCaseEl.status = 'FAILED' |
+ } |
+ setTimeout(checkForDone, 0); |
+ } |
+ |
+ function run() { |
+ var resultsEl = document.createElement('div'); |
+ resultsEl.className = 'unittest'; |
+ document.body.appendChild(resultsEl); |
+ |
+ var numPassed = 0; |
+ var numFailures = 0; |
+ var runner = { |
+ addFailedTest: function() { |
+ numFailures++; |
+ }, |
+ addPassedTest: function() { |
+ numPassed++; |
+ } |
+ }; |
+ function begin() { |
+ for (var i = 0; i < tests.length; i++) { |
+ (function() { |
+ var testCaseEl = base.unittest.createTestCaseDiv_(tests[i], tests[i], true); |
+ resultsEl.appendChild(testCaseEl); |
+ runTest(runner, testCaseEl, tests[i]); |
+ })(); |
+ } |
+ } |
+ begin(); |
+ } |
+ document.addEventListener('DOMContentLoaded', run); |
+ </script> |
+</body> |
+</html> |