OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <!-- |
| 4 Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 5 Use of this source code is governed by a BSD-style license that can be |
| 6 found in the LICENSE file. |
| 7 --> |
| 8 <head> |
| 9 <title>All Tests</title> |
| 10 <script> |
| 11 tests = [ |
| 12 'analysis_view_test.html', |
| 13 'base/bbox2_test.html', |
| 14 'base/color_test.html', |
| 15 'base/gl_matrix_test.html', |
| 16 'base/range_test.html', |
| 17 'lthi_view_test.html', |
| 18 'model_test.html', |
| 19 'model_view_test.html', |
| 20 'quad_view_test.html', |
| 21 'quad_view_viewport_test.html', |
| 22 'tile_view_test.html', |
| 23 'tree_quad_view_test.html', |
| 24 'ui/list_and_associated_view_test.html', |
| 25 'ui/list_view_test.html', |
| 26 ]; |
| 27 </script> |
| 28 <style> |
| 29 h1 { |
| 30 font-family: sans-serif; |
| 31 font-size: 18pt; |
| 32 } |
| 33 </style> |
| 34 <script src="base.js"></script> |
| 35 <script> |
| 36 base.require('base.unittest'); |
| 37 </script> |
| 38 </head> |
| 39 <body> |
| 40 <h1>Tests</h3> |
| 41 |
| 42 <div class="unittest">Interactive tests: <a href="interactive_tests.html" clas
s="unittest-error-link">Run manually</a></div> |
| 43 <br> |
| 44 |
| 45 <script> |
| 46 function runTest(runner, testCaseEl, test) { |
| 47 testCaseEl.status = 'RUNNING' |
| 48 |
| 49 var iframe = document.createElement('iframe'); |
| 50 iframe.src = test; |
| 51 iframe.style.position = 'fixed'; |
| 52 iframe.style.visibility = 'hidden'; |
| 53 document.body.appendChild(iframe); |
| 54 iframe.contentWindow.addEventListener('error', function(msg, url, lineNumber
) { |
| 55 if (iframe.contentWindow.G_testRunner) |
| 56 return false; |
| 57 |
| 58 if (iframe.contentWindow.errorsCaughtByTestHarness) |
| 59 return false; |
| 60 |
| 61 iframe.contentWindow.errorsCaughtByTestHarness = [ |
| 62 {msg: msg, url: url, lineNumber: lineNumber}]; |
| 63 return false; |
| 64 }); |
| 65 |
| 66 function checkForDone() { |
| 67 if (!iframe.contentWindow) { |
| 68 setTimeout(checkForDone, 100); |
| 69 return; |
| 70 } |
| 71 |
| 72 if (iframe.contentWindow.errorsCaughtByTestHarness && |
| 73 iframe.contentWindow.errorsCaughtByTestHarness.length) { |
| 74 testCaseEl.status = 'FAILED' |
| 75 return; |
| 76 } |
| 77 |
| 78 if (!iframe.contentWindow.G_testRunner) { |
| 79 setTimeout(checkForDone, 100); |
| 80 return; |
| 81 } |
| 82 |
| 83 var runner = iframe.contentWindow.G_testRunner; |
| 84 if (!runner.done) { |
| 85 setTimeout(checkForDone, 100); |
| 86 return; |
| 87 } |
| 88 |
| 89 var stats = runner.computeResultStats(); |
| 90 if (stats.numTestsRun && !stats.numTestsWithErrors) |
| 91 testCaseEl.status = 'PASSED' |
| 92 else |
| 93 testCaseEl.status = 'FAILED' |
| 94 } |
| 95 setTimeout(checkForDone, 0); |
| 96 } |
| 97 |
| 98 function run() { |
| 99 var resultsEl = document.createElement('div'); |
| 100 resultsEl.className = 'unittest'; |
| 101 document.body.appendChild(resultsEl); |
| 102 |
| 103 var numPassed = 0; |
| 104 var numFailures = 0; |
| 105 var runner = { |
| 106 addFailedTest: function() { |
| 107 numFailures++; |
| 108 }, |
| 109 addPassedTest: function() { |
| 110 numPassed++; |
| 111 } |
| 112 }; |
| 113 function begin() { |
| 114 for (var i = 0; i < tests.length; i++) { |
| 115 (function() { |
| 116 var testCaseEl = base.unittest.createTestCaseDiv_(tests[i], tests[i],
true); |
| 117 resultsEl.appendChild(testCaseEl); |
| 118 runTest(runner, testCaseEl, tests[i]); |
| 119 })(); |
| 120 } |
| 121 } |
| 122 begin(); |
| 123 } |
| 124 document.addEventListener('DOMContentLoaded', run); |
| 125 </script> |
| 126 </body> |
| 127 </html> |
OLD | NEW |