Changeset 84560 in webkit
- Timestamp:
- Apr 21, 2011 4:24:13 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r84549 r84560 37 37 * Scripts/webkitpy/layout_tests/port/test.py: Update passing pngs to include a checksum. 38 38 * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py: 39 40 2011-04-21 Ojan Vafai <ojan@chromium.org> 41 42 Reviewed by Tony Chang. 43 44 final tests for results.html file 45 https://bugs.webkit.org/show_bug.cgi?id=59150 46 47 This gets us close to 100% code coverage. Once this is 48 checked in, I'll move this file over to LayoutTests/fast/harness 49 and make it a proper layout test. 50 51 * Scripts/webkitpy/layout_tests/layout_package/json_results.html: 52 * Scripts/webkitpy/layout_tests/layout_package/json_results_test.js: 39 53 40 54 2011-04-21 Ojan Vafai <ojan@chromium.org> -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results.html
r84543 r84560 298 298 continue; 299 299 } 300 301 // FIXME: put unexpected passes in a separate table.302 300 303 301 var row = '<td>' + testLink(test) + '</td>'; … … 492 490 var PixelZoomer = {}; 493 491 492 PixelZoomer.showOnDelay = true; 493 494 494 PixelZoomer._createContainer = function(e) 495 495 { … … 541 541 542 542 if (!container) { 543 PixelZoomer._mouseMoveTimeout = setTimeout(function() { 544 PixelZoomer._createContainer(e); 545 }, 200); 543 if (PixelZoomer.showOnDelay) { 544 PixelZoomer._mouseMoveTimeout = setTimeout(function() { 545 PixelZoomer._createContainer(e); 546 }, 200); 547 return; 548 } 549 550 PixelZoomer._createContainer(e); 546 551 return; 547 552 } -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_test.js
r84543 r84560 2 2 // You should see a series of PASS lines. 3 3 4 var testStyles = document.createElement('style'); 5 testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }"; 6 document.querySelector('head').appendChild(testStyles); 7 4 8 var g_testIndex = 0; 5 9 var g_log = ["You should see a serios of PASS lines."]; 6 var g_currentTestSucceeded;7 10 8 11 // Make async actually be sync for the sake of simpler testing. … … 22 25 "fixable": 0, 23 26 "num_flaky": 0, 24 "layout_tests_dir": "/WEBKITROOT",25 "uses_expectations_file": true,26 "has_pretty_patch": true,27 "has_wdiff": true27 "layout_tests_dir": "/WEBKITROOT", 28 "uses_expectations_file": true, 29 "has_pretty_patch": false, 30 "has_wdiff": false 28 31 }; 29 32 } … … 39 42 } 40 43 41 function log(msg) 42 { 43 g_log.push('TEST-' + g_testIndex + ': ' + msg); 44 function logPass(msg) 45 { 46 g_log.push('TEST-' + g_testIndex + ': <span class="test-pass">' + msg + '</span>') 47 } 48 49 function logFail(msg) 50 { 51 g_log.push('TEST-' + g_testIndex + ': <span class="test-fail">' + msg + '</span>') 44 52 } 45 53 46 54 function assertTrue(bool) 47 55 { 48 g_currentTestSucceeded &= bool; 49 log(bool ? 'PASS' : 'FAIL') 56 if (bool) 57 logPass('PASS'); 58 else 59 logFail('FAIL'); 50 60 } 51 61 … … 59 69 ADD_RESULTS(results); 60 70 originalGeneratePage(); 61 g_currentTestSucceeded = true;62 71 } catch (e) { 63 log("FAIL: uncaught exception " + e.toString()); 64 g_currentTestSucceeded = false; 72 logFail("FAIL: uncaught exception " + e.toString()); 65 73 } 66 74 … … 68 76 assertions(); 69 77 } catch (e) { 70 log("FAIL: uncaught exception executing assertions " + e.toString()); 71 g_currentTestSucceeded = false; 78 logFail("FAIL: uncaught exception executing assertions " + e.toString()); 72 79 } 73 74 if (g_currentTestSucceeded) 75 log('PASS'); 80 } 81 82 function runDefaultSingleRowTest(test, expected, actual, isExpected, textResults, imageResults) 83 { 84 results = mockResults(); 85 results.tests[test] = mockExpectation(expected, actual); 86 runSingleRowTest(results, isExpected, textResults, imageResults); 87 } 88 89 function runSingleRowTest(results, isExpected, textResults, imageResults) 90 { 91 for (var key in results.tests) 92 var test = key; 93 var expected = results.tests[test].expected; 94 var actual = results.tests[test].actual; 95 runTest(results, function() { 96 if (isExpected) 97 assertTrue(document.querySelector('tbody').className == 'expected'); 98 else 99 assertTrue(document.querySelector('tbody').className.indexOf('expected') == -1); 100 101 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent == '+' + test); 102 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent == textResults); 103 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent == imageResults); 104 assertTrue(document.querySelector('tbody td:nth-child(4)').textContent == actual); 105 assertTrue(document.querySelector('tbody td:nth-child(5)').textContent == expected); 106 }); 107 76 108 } 77 109 … … 175 207 assertTrue(document.querySelectorAll('.results-row').length == 2); 176 208 }); 177 209 210 runDefaultSingleRowTest('foo/bar-skip.html', 'TEXT', 'SKIP', true, '', ''); 211 runDefaultSingleRowTest('foo/bar-flaky-fail.html', 'PASS FAIL', 'TEXT', true, 'expected actual diff ', ''); 212 runDefaultSingleRowTest('foo/bar-flaky-fail-unexpected.html', 'PASS TEXT', 'IMAGE', false, '', 'expected actual diff '); 213 runDefaultSingleRowTest('foo/bar-crash.html', 'TEXT', 'CRASH', false, 'stack ', ''); 214 runDefaultSingleRowTest('foo/bar-audio.html', 'TEXT', 'AUDIO', false, 'expected actual ', ''); 215 runDefaultSingleRowTest('foo/bar-timeout.html', 'TEXT', 'TIMEOUT', false, 'expected actual diff ', ''); 216 runDefaultSingleRowTest('foo/bar-image.html', 'TEXT', 'IMAGE', false, '', 'expected actual diff '); 217 runDefaultSingleRowTest('foo/bar-image-plus-text.html', 'TEXT', 'IMAGE+TEXT', false, 'expected actual diff ', 'expected actual diff '); 218 219 results = mockResults(); 220 results.tests['foo/bar-reftest.html'] = mockExpectation('PASS', 'IMAGE'); 221 results.tests['foo/bar-reftest.html'].is_reftest = true; 222 runSingleRowTest(results, false, '', 'ref html expected actual diff '); 223 224 results = mockResults(); 225 results.tests['foo/bar-reftest-mismatch.html'] = mockExpectation('PASS', 'IMAGE'); 226 results.tests['foo/bar-reftest-mismatch.html'].is_mismatch_reftest = true; 227 runSingleRowTest(results, false, '', 'ref mismatch html actual '); 228 229 results = mockResults(); 230 results.tests['foo/bar-flaky-pass.html'] = mockExpectation('PASS FAIL', 'PASS'); 231 runTest(results, function() { 232 // FIXME: should a PASS FAIL test that passes go in the unexpected passes table? 233 assertTrue(document.body.textContent.indexOf('foo/bar-flaky-pass.html') == -1); 234 }); 235 236 results = mockResults(); 237 results.tests['foo/bar.html'] = mockExpectation('TEXT', 'TEXT'); 238 results.uses_expectations_file = false; 239 runTest(results, function() { 240 assertTrue(document.querySelectorAll('tbody td').length == 4); 241 assertTrue(document.querySelector('tbody').className.indexOf('expected') == -1); 242 }); 243 244 results = mockResults(); 245 results.tests['foo/bar.html'] = mockExpectation('TEXT', 'TEXT'); 246 results.has_pretty_patch = true; 247 runTest(results, function() { 248 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('pretty diff') != -1); 249 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('wdiff') == -1); 250 }); 251 252 results = mockResults(); 253 results.tests['foo/bar.html'] = mockExpectation('TEXT', 'TEXT'); 254 results.has_wdiff = true; 255 runTest(results, function() { 256 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('wdiff') != -1); 257 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('pretty diff') == -1); 258 }); 259 260 results = mockResults(); 261 results.tests['foo/bar.html'] = mockExpectation('TEXT', 'PASS'); 262 results.tests['foo/bar-1.html'] = mockExpectation('TEXT', 'CRASH'); 263 results.tests['foo/bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); 264 results.tests['foo/bar-3.html'] = mockExpectation('PASS', 'TEXT'); 265 results.tests['foo/bar-2.html'] = mockExpectation('PASS', 'IMAGE'); 266 runTest(results, function() { 267 // FIXME: This just ensures we don't get a JS error. 268 // Verify that the sort is correct and that inline expanded expectations 269 // move along with the test they're attached to. 270 TableSorter.sortColumn(0); 271 TableSorter.sortColumn(0); 272 TableSorter.sortColumn(1); 273 TableSorter.sortColumn(1); 274 TableSorter.sortColumn(2); 275 TableSorter.sortColumn(2); 276 TableSorter.sortColumn(3); 277 TableSorter.sortColumn(3); 278 TableSorter.sortColumn(4); 279 TableSorter.sortColumn(4); 280 TableSorter.sortColumn(0); 281 logPass('PASS'); 282 }); 283 284 results = mockResults(); 285 results.tests['foo/bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); 286 runTest(results, function() { 287 expandAllExpectations(); 288 var png = document.querySelector('[src*="bar-5-expected.png"]'); 289 var x = png.offsetLeft + 1; 290 var y = png.offsetTop + 1; 291 var mockEvent = { 292 target: png, 293 clientX: x, 294 clientY: y 295 } 296 PixelZoomer.showOnDelay = false; 297 PixelZoomer.handleMouseMove(mockEvent); 298 assertTrue(!!document.querySelector('.pixel-zoom-container')); 299 assertTrue(document.querySelectorAll('.zoom-image-container').length == 3); 300 }); 301 178 302 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; 179 303 }
Note: See TracChangeset
for help on using the changeset viewer.