| OLD | NEW |
| 1 // To run these tests, load results.html in a browser. | 1 // To run these tests, load results.html in a browser. |
| 2 // You should see a series of PASS lines. | 2 // You should see a series of PASS lines. |
| 3 if (window.testRunner) | 3 if (window.testRunner) |
| 4 testRunner.dumpAsText(); | 4 testRunner.dumpAsText(); |
| 5 | 5 |
| 6 var testStyles = document.createElement('style'); | 6 var testStyles = document.createElement('style'); |
| 7 testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }"
; | 7 testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }"
; |
| 8 document.querySelector('head').appendChild(testStyles); | 8 document.querySelector('head').appendChild(testStyles); |
| 9 | 9 |
| 10 var g_testIndex = 0; | 10 var g_testIndex = 0; |
| 11 var g_log = ["You should see a series of PASS lines."]; | 11 var g_log = ["You should see a series of PASS lines."]; |
| 12 | 12 |
| 13 // Make async actually be sync for the sake of simpler testing. | 13 // Make async actually be sync for the sake of simpler testing. |
| 14 function async(func, args) | 14 function async(func, args) |
| 15 { | 15 { |
| 16 func.apply(null, args); | 16 func.apply(null, args); |
| 17 } | 17 } |
| 18 | 18 |
| 19 function mockResults() | 19 function mockResults() |
| 20 { | 20 { |
| 21 return { | 21 return { |
| 22 tests: {}, | 22 tests: {}, |
| 23 "skipped": 0, | 23 "skipped": 0, |
| 24 "num_regressions": 0, | 24 "num_regressions": 0, |
| 25 "version": 0, | 25 "version": 0, |
| 26 "num_passes": 0, | 26 "num_passes": 0, |
| 27 "fixable": 0, | 27 "fixable": 0, |
| 28 "num_flaky": 0, | 28 "num_flaky": 0, |
| 29 "layout_tests_dir": "/WEBKITROOT", | 29 "layout_tests_dir": "/WEBKITROOT", |
| 30 "has_wdiff": false, | |
| 31 "chromium_revision": 12345, | 30 "chromium_revision": 12345, |
| 32 "pixel_tests_enabled": true | 31 "pixel_tests_enabled": true |
| 33 }; | 32 }; |
| 34 } | 33 } |
| 35 | 34 |
| 36 function isFailureExpected(expected, actual) | 35 function isFailureExpected(expected, actual) |
| 37 { | 36 { |
| 38 var isExpected = true; | 37 var isExpected = true; |
| 39 if (actual != 'SKIP') { | 38 if (actual != 'SKIP') { |
| 40 var expectedArray = expected.split(' '); | 39 var expectedArray = expected.split(' '); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 343 |
| 345 results = mockResults(); | 344 results = mockResults(); |
| 346 var subtree = results.tests['foo'] = {} | 345 var subtree = results.tests['foo'] = {} |
| 347 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); | 346 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); |
| 348 runTest(results, function() { | 347 runTest(results, function() { |
| 349 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') != -1); | 348 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') != -1); |
| 350 }); | 349 }); |
| 351 | 350 |
| 352 results = mockResults(); | 351 results = mockResults(); |
| 353 var subtree = results.tests['foo'] = {} | 352 var subtree = results.tests['foo'] = {} |
| 354 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); | |
| 355 results.has_wdiff = true; | |
| 356 runTest(results, function() { | |
| 357 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('wdiff') != -1); | |
| 358 | |
| 359 }); | |
| 360 | |
| 361 results = mockResults(); | |
| 362 var subtree = results.tests['foo'] = {} | |
| 363 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); | 353 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); |
| 364 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); | 354 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); |
| 365 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 355 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 366 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); | 356 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); |
| 367 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); | 357 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); |
| 368 runTest(results, function() { | 358 runTest(results, function() { |
| 369 // FIXME: This just ensures we don't get a JS error. | 359 // FIXME: This just ensures we don't get a JS error. |
| 370 // Verify that the sort is correct and that inline expanded expectations | 360 // Verify that the sort is correct and that inline expanded expectations |
| 371 // move along with the test they're attached to. | 361 // move along with the test they're attached to. |
| 372 TableSorter.sortColumn(0); | 362 TableSorter.sortColumn(0); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 results.tests['foo'].has_repaint_overlay = true; | 791 results.tests['foo'].has_repaint_overlay = true; |
| 802 runTest(results, function() { | 792 runTest(results, function() { |
| 803 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('overlay') != -1); | 793 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('overlay') != -1); |
| 804 }) | 794 }) |
| 805 | 795 |
| 806 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; | 796 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; |
| 807 } | 797 } |
| 808 | 798 |
| 809 var originalGeneratePage = generatePage; | 799 var originalGeneratePage = generatePage; |
| 810 generatePage = runTests; | 800 generatePage = runTests; |
| OLD | NEW |