Changeset 84420 in webkit
- Timestamp:
- Apr 20, 2011 2:45:30 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r84419 r84420 1 2011-04-20 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 move page generation into a single function 6 https://bugs.webkit.org/show_bug.cgi?id=59027 7 8 Now executing the script doesn't create any state. We should then 9 be able to write tests for this by setting custom results data. 10 11 * Scripts/webkitpy/layout_tests/layout_package/json_results.html: 12 13 2011-04-20 Ojan Vafai <ojan@chromium.org> 14 15 Reviewed by Eric Seidel. 16 17 move global state into a shared object 18 https://bugs.webkit.org/show_bug.cgi?id=59023 19 20 This makes the code more testable. 21 22 * Scripts/webkitpy/layout_tests/layout_package/json_results.html: 23 1 24 2011-04-20 Ojan Vafai <ojan@chromium.org> 2 25 -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results.html
r84419 r84420 107 107 } 108 108 </style> 109 <style id="unexpected-style"></style> 109 110 110 111 <script> … … 334 335 } 335 336 336 var html = '<div id=options>' + 337 '<a href="javascript:void()" class="expand-all" onclick="expandAllExpectations()">expand all</a> ' + 338 '<a href="javascript:void()" class="collapse-all" onclick="collapseAllExpectations()">collapse all</a>'; 339 340 if (globalState().results.uses_expectations_file) 341 html += '<label><input class="unexpected-results" type=checkbox checked onchange="updateExpectedResults()">Only show unexpected results</label>'; 342 343 html += '</div>'; 344 345 var tableRowsHtml = tableRows(); 346 347 if (tableRowsHtml) { 348 html += '<p>Tests where results did not match expected results:</p>' + 349 '<table id="results-table"><thead><tr>' + 350 '<th>test</th>' + 351 '<th id="text-results-header">text results</th>' + 352 '<th id="image-results-header">image results</th>' + 353 '<th>failure type</th>'; 354 355 if (globalState().results.uses_expectations_file) 356 html += '<th>expected failure type</th>'; 357 358 html += '</tr></thead>' + tableRowsHtml + '</table>'; 359 } 360 361 function appendTestList(tests, header, tableId, fileSuffix, linkName) 337 function testList(tests, header, tableId, fileSuffix, linkName) 362 338 { 363 339 tests.sort(); 364 340 365 html += '<p>' + header + '</p><table id="' + tableId + '">';341 var html = '<p>' + header + '</p><table id="' + tableId + '">'; 366 342 for (var i = 0; i < tests.length; i++) { 367 343 var test = tests[i]; … … 382 358 html += '</td></tr></tbody>'; 383 359 } 384 html += '</table>' 385 } 386 387 if (globalState().newTests.length) 388 appendTestList(globalState().newTests, 'Tests that had no expected results (probably new):', 'new-tests-table', '-actual.txt', 'result'); 389 390 if (globalState().testsWithStderr.length) 391 appendTestList(globalState().testsWithStderr, 'Tests that had stderr output:', 'stderr-table', '-stderr.txt', 'stderr'); 392 393 if (globalState().hasHttpTests) { 394 html += '<p>httpd access log: <a href="access_log.txt">access_log.txt</a></p>' + 395 '<p>httpd error log: <a href="error_log.txt">error_log.txt</a></p>'; 396 } 397 398 document.write(html); 360 html += '</table>'; 361 return html; 362 } 399 363 400 364 function toArray(nodeList) … … 502 466 } 503 467 504 if (document.getElementById('results-table'))505 document.getElementById('results-table').addEventListener('click', TableSorter.handleClick, false);506 TableSorter.sortColumn(0);507 508 468 var PixelZoomer = {}; 509 469 … … 566 526 } 567 527 568 document.body.addEventListener('mousemove', PixelZoomer.handleMouseMove, false); 569 570 571 var unexpectedStyleNode = document.createElement('style'); 572 document.body.appendChild(unexpectedStyleNode); 528 document.addEventListener('mousemove', PixelZoomer.handleMouseMove, false); 573 529 574 530 function updateExpectedResults() 575 531 { 576 532 var checkBox = document.querySelector('.unexpected-results'); 577 if (!checkBox || checkBox.checked) 578 unexpectedStyleNode.innerText = '.expected { display: none; }'; 579 else 580 unexpectedStyleNode.innerText = ''; 581 } 582 583 updateExpectedResults(); 584 585 if (!globalState().hasTextFailures) 586 document.body.getElementById('text-results-header').textContent = ''; 587 if (!globalState().hasImageFailures) 588 document.body.getElementById('image-results-header').textContent = ''; 533 document.getElementById('unexpected-style').innerText = (!checkBox || checkBox.checked) ? 534 '.expected { display: none; }' : ''; 535 } 536 537 function generatePage() 538 { 539 var html = '<div id=options>' + 540 '<a href="javascript:void()" class="expand-all" onclick="expandAllExpectations()">expand all</a> ' + 541 '<a href="javascript:void()" class="collapse-all" onclick="collapseAllExpectations()">collapse all</a>'; 542 543 if (globalState().results.uses_expectations_file) 544 html += '<label><input class="unexpected-results" type=checkbox checked onchange="updateExpectedResults()">Only show unexpected results</label>'; 545 546 html += '</div>'; 547 548 var tableRowsHtml = tableRows(); 549 550 if (tableRowsHtml) { 551 html += '<p>Tests where results did not match expected results:</p>' + 552 '<table id="results-table"><thead><tr>' + 553 '<th>test</th>' + 554 '<th id="text-results-header">text results</th>' + 555 '<th id="image-results-header">image results</th>' + 556 '<th>failure type</th>'; 557 558 if (globalState().results.uses_expectations_file) 559 html += '<th>expected failure type</th>'; 560 561 html += '</tr></thead>' + tableRowsHtml + '</table>'; 562 } 563 564 if (globalState().newTests.length) 565 html += testList(globalState().newTests, 'Tests that had no expected results (probably new):', 'new-tests-table', '-actual.txt', 'result'); 566 567 if (globalState().testsWithStderr.length) 568 html += testList(globalState().testsWithStderr, 'Tests that had stderr output:', 'stderr-table', '-stderr.txt', 'stderr'); 569 570 if (globalState().hasHttpTests) { 571 html += '<p>httpd access log: <a href="access_log.txt">access_log.txt</a></p>' + 572 '<p>httpd error log: <a href="error_log.txt">error_log.txt</a></p>'; 573 } 574 575 document.body.innerHTML = html; 576 577 if (document.getElementById('results-table')) 578 document.getElementById('results-table').addEventListener('click', TableSorter.handleClick, false); 579 TableSorter.sortColumn(0); 580 581 updateExpectedResults(); 582 583 if (!globalState().hasTextFailures) 584 document.body.getElementById('text-results-header').textContent = ''; 585 if (!globalState().hasImageFailures) 586 document.body.getElementById('image-results-header').textContent = ''; 587 } 589 588 </script> 589 <body onload="generatePage()"></body>
Note: See TracChangeset
for help on using the changeset viewer.