Re-enable index-basics-workers test to see if still times
[chromium-blink-merge.git] / tools / cc-frame-viewer / src / tests.html
blob67fac660a56615f03213a5fc0b2781774cc6b1c1
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',
29 </script>
30 <style>
31 h1 {
32 font-family: sans-serif;
33 font-size: 18pt;
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>
44 <div class="unittest">Interactive tests: <a href="interactive_tests.html" class="unittest-error-link">Run manually</a></div>
45 <br>
47 <script>
48 function runTest(runner, testCaseEl, test) {
49 testCaseEl.status = 'RUNNING'
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;
60 if (iframe.contentWindow.errorsCaughtByTestHarness)
61 return false;
63 iframe.contentWindow.errorsCaughtByTestHarness = [
64 {msg: msg, url: url, lineNumber: lineNumber}];
65 return false;
66 });
68 function checkForDone() {
69 if (!iframe.contentWindow) {
70 setTimeout(checkForDone, 100);
71 return;
74 if (iframe.contentWindow.errorsCaughtByTestHarness &&
75 iframe.contentWindow.errorsCaughtByTestHarness.length) {
76 testCaseEl.status = 'FAILED'
77 return;
80 if (!iframe.contentWindow.G_testRunner) {
81 setTimeout(checkForDone, 100);
82 return;
85 var runner = iframe.contentWindow.G_testRunner;
86 if (!runner.done) {
87 setTimeout(checkForDone, 100);
88 return;
91 var stats = runner.computeResultStats();
92 if (stats.numTestsRun && !stats.numTestsWithErrors)
93 testCaseEl.status = 'PASSED'
94 else
95 testCaseEl.status = 'FAILED'
97 setTimeout(checkForDone, 0);
100 function run() {
101 var resultsEl = document.createElement('div');
102 resultsEl.className = 'unittest';
103 document.body.appendChild(resultsEl);
105 var numPassed = 0;
106 var numFailures = 0;
107 var runner = {
108 addFailedTest: function() {
109 numFailures++;
111 addPassedTest: function() {
112 numPassed++;
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 })();
124 begin();
126 document.addEventListener('DOMContentLoaded', run);
127 </script>
128 </body>
129 </html>