Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / harness / archived-results-dashboard.html
blob2a4fdf5f9a3ddf107f2b929322e1c3c9a08a500c
1 <!DOCTYPE html>
2 <style>
4 html {
5 height: 100%;
8 body {
9 margin: 1.0em;
10 font-family: Helvetica, sans-serif;
11 font-size: 11pt;
12 display: -webkit-flex;
13 -webkit-flex-direction: column;
14 height: 100%;
17 body > * {
18 margin-left: 4px;
19 margin-top: 4px;
22 h1 {
23 font-size: 150%;
24 margin-top: 1.5em;
25 text-align: center;
28 a {
29 text-decoration: none;
32 table {
33 position: relative;
34 top: 100px;
37 th {
38 background: rgb(200, 200, 200);
39 border-radius: 5px;
42 td {
43 padding: 1px 4px;
44 vertical-align: middle;
45 min-width: 20px;
46 height: 25px;
47 border: 1px solid rgb(200, 200, 200);
48 border-radius: 5px;
51 input[type=text] {
52 border: 2px solid rgb(128, 128, 128);
53 font-size: 120%;
54 height: 30px;
55 margin-bottom: 1.0em;
56 margin-top: 1.0em;
57 margin-left: 1.0em;
58 padding-left: 0.8em;
59 width: 500px;
62 input[type=checkbox] {
63 padding: 0.1em;
64 width: 20px;
65 height: 20px;
68 .rerun-button {
69 background: rgb(66, 184, 221);
70 border-radius: 5px;
71 font-size: 120%;
72 height: 40px;
73 text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
74 width: 150px;
77 .rerun-button:hover {
78 background: rgb(80, 200, 250);
81 .result-cell, .test-pass, .test-fail, .test-skip, .test-run{
82 border: 0px;
83 border-radius: 5px;
86 .test-pass {
87 background-color: rgb(143, 223, 95);
90 .test-fail {
91 background-color: rgb(233, 128, 128);
94 .test-skip {
95 background-color: rgb(255, 255, 255);
98 .test-run {
99 background-color: rgb(255, 252, 108);
102 .log {
103 font-family: "Courier New";
104 display: block;
105 position: relative;
108 .stdio-href {
109 color: grey;
110 font-weight: bold;
111 text-decoration: underline;
114 .stdio-href:hover {
115 color:black;
118 .odd-row {
119 background: rgb(66, 184, 221);
122 .even-row {
123 background: rgb(200, 200, 200);
126 .toolbox {
127 display: block;
128 position: fixed;
129 padding: 4px;
130 top: 10px;
131 right: 10px;
132 z-index: 9999;
135 .toolbox span {
136 color: rgb(104, 104, 104);
137 position: absolute;
138 text-align: right;
139 top: 30px;
140 left: 570px;
141 width: 100px;
144 </style>
145 <script>
146 var g_state;
147 function globalState()
149 if (!g_state) {
150 g_state = {
151 results: {}
154 return g_state;
157 function ADD_RESULTS(input)
159 globalState().results = input;
161 </script>
162 <script src="archived_results.json"></script>
163 <script>
164 function processGlobalStateFor(testObject)
166 var table = document.getElementById('results-table');
167 var row = table.insertRow(-1);
168 if (table.rows.length % 2 == 0)
169 row.className = 'even-row';
170 else
171 row.className = 'odd-row';
172 var checkboxcell = row.insertCell(-1);
173 var checkbox = document.createElement("input");
174 checkbox.setAttribute('type','checkbox');
175 checkboxcell.appendChild(checkbox);
176 var cell = row.insertCell(-1);
177 cell.innerHTML = testObject.name;
178 for (var result in testObject.archived_results) {
179 var res = testObject.archived_results[result];
180 var cell = row.insertCell(-1);
181 if( res == 'PASS')
182 cell.className = 'test-pass';
183 else if( res == 'SKIP')
184 cell.className = 'test-skip';
185 else
186 cell.className = 'test-fail';
187 var hrefElement = document.createElement("a");
188 hrefElement.href = globalState().results.result_links[result];
189 hrefElement.innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;';
190 cell.appendChild(hrefElement);
195 function forEachTest(handler, opt_tree, opt_prefix)
197 var tree = opt_tree || globalState().results.tests;
198 var prefix = opt_prefix || '';
200 for (var key in tree) {
201 var newPrefix = prefix ? (prefix + '/' + key) : key;
202 if ('archived_results' in tree[key]) {
203 var testObject = tree[key];
204 testObject.name = newPrefix;
205 handler(testObject);
206 } else
207 forEachTest(handler, tree[key], newPrefix);
210 function getTests()
212 var table = document.getElementById('results-table');
213 var testCount = table.rows.length;
214 var tests_list = {
215 tests : []
217 for(var i = 2; i < testCount; i++) {
218 var selected = table.rows[i].cells[0].getElementsByTagName("input")[0];
219 if(selected.checked) {
220 var test = table.rows[i].cells[1].innerHTML;
221 tests_list.tests.push(test);
224 return tests_list;
226 function rerun()
228 var log = document.getElementById('log');
229 var testList = JSON.stringify(getTests());
230 var logText = document.createElement('p');
231 logText.innerHTML = 'Re running the tests';
232 logText.className = 'test-run';
233 var stdioIframe = document.createElement("IFRAME");
234 stdioIframe.style.display = 'none';
235 stdioIframe.width = window.innerWidth;
236 stdioIframe.height = '100px';
237 stdioIframe.onload = function () {
238 stdioIframe.contentWindow.scrollTo(0,stdioIframe.contentWindow.document.scrollingElement.scrollHeight);
240 var stdio = document.createElement("a");
241 stdio.innerHTML = '<p>stdio<p>';
242 stdio.className = 'stdio-href';
243 stdio.onclick = function() {
244 if(stdioIframe.style.display == 'none')
245 stdioIframe.style.display = 'block';
246 else
247 stdioIframe.style.display = 'none';
250 log.appendChild(logText);
251 log.appendChild(stdio);
252 log.appendChild(stdioIframe);
253 if (testList == '')
254 alert('Please select atlest one Test');
255 else {
256 xmlhttp = new XMLHttpRequest();
257 var url ='http://localhost:9630/';
258 xmlhttp.open('POST', url, true);
259 xmlhttp.onerror = function() {
260 logText.innerHTML = 'Please run the server using "webkit-patch layout-test-server"';
261 logText.className = 'test-fail';
262 alert('Server offline');
264 xmlhttp.setRequestHeader("Content-type", "application/json");
265 xmlhttp.onreadystatechange = function() {
266 if(xmlhttp.readyState > 0) {
267 stdioIframe.srcdoc = xmlhttp.responseText;
269 if(xmlhttp.readyState == 4) {
270 logText.innerHTML = 'Tests Re-run done Reloading this page';
271 logText.className = 'test-pass';
272 location.reload();
275 xmlhttp.send(testList);
278 function checkalltests()
280 var value = document.getElementById("check_all").checked;
281 var table = document.getElementById("results-table");
282 var length = table.rows.length;
283 for (var i = 2; i < length; i++) {
284 var checkbox = table.rows[i].cells[0].getElementsByTagName("input")[0];
285 var disabled = checkbox.disabled;
286 if(!disabled)
287 checkbox.checked = value;
292 function searchTable(filterExp)
294 var table = document.getElementById('results-table');
295 var testCount = table.rows.length;
296 var tests_list = {
297 tests : []
299 var searchCount = 0;
300 for(var i = 2; i < testCount; i++) {
301 var cellContent = table.rows[i].cells[1].innerHTML;
302 var checkbox = table.rows[i].cells[0].getElementsByTagName("input")[0];
303 var index = cellContent.search(filterExp);
304 if (index < 0) {
305 table.rows[i].style.display = 'none';
306 checkbox.checked = false;
307 checkbox.disabled = true;
309 else {
310 table.rows[i].style.display = '';
311 checkbox.disabled = false;
312 searchCount += 1;
315 return searchCount;
317 function applyfilter()
319 var filterString = document.getElementById('applyfilter').value;
320 var searchCount = document.getElementById('searchcount');
321 var filterExp = new RegExp(filterString, "i");
322 var count = searchTable(filterExp);
323 if(filterString == '') {
324 searchCount.innerHTML = '';
325 return;
327 var totalCount = document.getElementById('results-table').rows.length - 2;
328 searchCount.innerHTML = count + '/' + totalCount;
331 function createTableHeader()
333 var count = globalState().results.result_links.length;
334 var tableHeader= '<table id=results-table><thead><tr>' +
335 '<th rowspan="2">' +
336 '<input type="checkbox" name="checkall" id="check_all" onclick="checkalltests()"></input>' +
337 '</th>' +
338 '<th rowspan="2" text-align:left;>Tests</th>' +
339 '<th colspan= '+ count +'>Latest &#8594; Oldest</th> </tr><tr>';
340 for( var i = 0; i < count; i++)
341 tableHeader += '<th>'+ (i+1) +'</th>';
342 tableHeader += '</tr></thead></table>';
343 document.body.innerHTML += tableHeader;
346 function generatePage()
348 createTableHeader();
349 forEachTest(processGlobalStateFor);
352 </script>
353 <!-- To run the tests -->
354 <script src="resources/archived-results-dashboard-test.js"></script>
355 <body onload="generatePage()">
356 <h1>Dashboard</h1>
357 <div id=log class="log"></div>
358 <div class="toolbox">
359 <button onclick=rerun() class="rerun-button">Re Run Tests</button>
360 <input type="text" id=applyfilter oninput="applyfilter()" placeholder="Search via regular expression"></input>
361 <span id=searchcount></span>
362 </div>
363 </body>
364 </html>