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 'layer_tree_impl_view_test.html', | |
19 'layer_impl_view_test.html', | |
20 'model_test.html', | |
21 'model_view_test.html', | |
22 'quad_view_test.html', | |
23 'quad_view_viewport_test.html', | |
24 'tile_view_test.html', | |
25 'tree_quad_view_test.html', | |
26 'ui/list_and_associated_view_test.html', | |
27 'ui/list_view_test.html', | |
28 ]; | |
29 </script> | |
30 <style> | |
31 h1 { | |
32 font-family: sans-serif; | |
33 font-size: 18pt; | |
34 } | |
35 </style> | |
36 <script src="base.js"></script> | |
37 <script> | |
38 base.require('base.unittest'); | |
39 </script> | |
40 </head> | |
41 <body> | |
42 <h1>Tests</h3> | |
43 | |
44 <div class="unittest">Interactive tests: <a href="interactive_tests.html" clas
s="unittest-error-link">Run manually</a></div> | |
45 <br> | |
46 | |
47 <script> | |
48 function runTest(runner, testCaseEl, test) { | |
49 testCaseEl.status = 'RUNNING' | |
50 | |
51 var iframe = document.createElement('iframe'); | |
52 iframe.src = test; | |
53 iframe.style.position = 'fixed'; | |
54 iframe.style.visibility = 'hidden'; | |
55 document.body.appendChild(iframe); | |
56 iframe.contentWindow.addEventListener('error', function(msg, url, lineNumber
) { | |
57 if (iframe.contentWindow.G_testRunner) | |
58 return false; | |
59 | |
60 if (iframe.contentWindow.errorsCaughtByTestHarness) | |
61 return false; | |
62 | |
63 iframe.contentWindow.errorsCaughtByTestHarness = [ | |
64 {msg: msg, url: url, lineNumber: lineNumber}]; | |
65 return false; | |
66 }); | |
67 | |
68 function checkForDone() { | |
69 if (!iframe.contentWindow) { | |
70 setTimeout(checkForDone, 100); | |
71 return; | |
72 } | |
73 | |
74 if (iframe.contentWindow.errorsCaughtByTestHarness && | |
75 iframe.contentWindow.errorsCaughtByTestHarness.length) { | |
76 testCaseEl.status = 'FAILED' | |
77 return; | |
78 } | |
79 | |
80 if (!iframe.contentWindow.G_testRunner) { | |
81 setTimeout(checkForDone, 100); | |
82 return; | |
83 } | |
84 | |
85 var runner = iframe.contentWindow.G_testRunner; | |
86 if (!runner.done) { | |
87 setTimeout(checkForDone, 100); | |
88 return; | |
89 } | |
90 | |
91 var stats = runner.computeResultStats(); | |
92 if (stats.numTestsRun && !stats.numTestsWithErrors) | |
93 testCaseEl.status = 'PASSED' | |
94 else | |
95 testCaseEl.status = 'FAILED' | |
96 } | |
97 setTimeout(checkForDone, 0); | |
98 } | |
99 | |
100 function run() { | |
101 var resultsEl = document.createElement('div'); | |
102 resultsEl.className = 'unittest'; | |
103 document.body.appendChild(resultsEl); | |
104 | |
105 var numPassed = 0; | |
106 var numFailures = 0; | |
107 var runner = { | |
108 addFailedTest: function() { | |
109 numFailures++; | |
110 }, | |
111 addPassedTest: function() { | |
112 numPassed++; | |
113 } | |
114 }; | |
115 function begin() { | |
116 for (var i = 0; i < tests.length; i++) { | |
117 (function() { | |
118 var testCaseEl = base.unittest.createTestCaseDiv_(tests[i], tests[i],
true); | |
119 resultsEl.appendChild(testCaseEl); | |
120 runTest(runner, testCaseEl, tests[i]); | |
121 })(); | |
122 } | |
123 } | |
124 begin(); | |
125 } | |
126 document.addEventListener('DOMContentLoaded', run); | |
127 </script> | |
128 </body> | |
129 </html> | |
OLD | NEW |