| 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; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 { | 53 { |
| 54 return { | 54 return { |
| 55 expected: expected, | 55 expected: expected, |
| 56 time_ms: 1, | 56 time_ms: 1, |
| 57 actual: actual, | 57 actual: actual, |
| 58 has_stderr: false, | 58 has_stderr: false, |
| 59 is_unexpected: !isFailureExpected(expected, actual) | 59 is_unexpected: !isFailureExpected(expected, actual) |
| 60 }; | 60 }; |
| 61 } | 61 } |
| 62 | 62 |
| 63 function currentTestName() { |
| 64 var testName = 'TEST ' + g_testIndex; |
| 65 if (g_testName) |
| 66 testName += ' (' + g_testName + ')'; |
| 67 return testName; |
| 68 } |
| 69 |
| 63 function logPass(msg) | 70 function logPass(msg) |
| 64 { | 71 { |
| 65 g_log.push('TEST-' + g_testIndex + ': <span class="test-pass">' + msg + '</s
pan>') | 72 g_log.push('<span class="test-pass">' + msg + '</span>: ' + currentTestName(
)) |
| 66 } | 73 } |
| 67 | 74 |
| 68 function logFail(msg) | 75 function logFail(msg) |
| 69 { | 76 { |
| 70 g_log.push('TEST-' + g_testIndex + ': <span class="test-fail">' + msg + '</s
pan>') | 77 g_log.push('<span class="test-fail">' + msg + '</span>: ' + currentTestName(
)) |
| 71 } | 78 } |
| 72 | 79 |
| 73 function assertTrue(bool) | 80 function assertTrue(bool) |
| 74 { | 81 { |
| 75 if (bool) | 82 if (bool) |
| 76 logPass('PASS'); | 83 logPass('PASS'); |
| 77 else | 84 else |
| 78 logFail('FAIL'); | 85 logFail('FAIL'); |
| 79 } | 86 } |
| 80 | 87 |
| 81 function runTest(results, assertions, opt_localStorageValue) | 88 function runTest(results, assertions, opt_testName, opt_localStorageValue) |
| 82 { | 89 { |
| 83 document.body.innerHTML = ''; | 90 document.body.innerHTML = ''; |
| 84 g_testIndex++; | 91 g_testIndex++; |
| 85 g_state = undefined; | 92 g_state = undefined; |
| 93 g_testName = opt_testName || ''; |
| 86 localStorage.setItem(OptionWriter._key, opt_localStorageValue || ''); | 94 localStorage.setItem(OptionWriter._key, opt_localStorageValue || ''); |
| 87 | 95 |
| 88 try { | 96 try { |
| 89 ADD_RESULTS(results); | 97 ADD_RESULTS(results); |
| 90 originalGeneratePage(); | 98 originalGeneratePage(); |
| 91 } catch (e) { | 99 } catch (e) { |
| 92 logFail("FAIL: uncaught exception " + e.toString()); | 100 logFail("FAIL: uncaught exception " + e.toString()); |
| 93 } | 101 } |
| 94 | 102 |
| 95 try { | 103 try { |
| 96 assertions(); | 104 assertions(); |
| 97 } catch (e) { | 105 } catch (e) { |
| 98 logFail("FAIL: uncaught exception executing assertions " + e.toString())
; | 106 logFail("FAIL: uncaught exception executing assertions " + e.toString())
; |
| 99 } | 107 } |
| 100 } | 108 } |
| 101 | 109 |
| 102 function runDefaultSingleRowTest(test, expected, actual, isExpected, textResults
, imageResults) | 110 function runDefaultSingleRowTest(test, expected, actual, isExpected, textResults
, imageResults, opt_testName) |
| 103 { | 111 { |
| 104 results = mockResults(); | 112 results = mockResults(); |
| 105 results.tests[test] = mockExpectation(expected, actual); | 113 results.tests[test] = mockExpectation(expected, actual); |
| 106 runSingleRowTest(results, isExpected, textResults, imageResults); | 114 runSingleRowTest(results, isExpected, textResults, imageResults, opt_testNam
e); |
| 107 } | 115 } |
| 108 | 116 |
| 109 function runSingleRowTest(results, isExpected, textResults, imageResults) | 117 function runSingleRowTest(results, isExpected, textResults, imageResults, opt_te
stName) |
| 110 { | 118 { |
| 111 for (var key in results.tests) | 119 for (var key in results.tests) |
| 112 var test = key; | 120 var test = key; |
| 113 var expected = results.tests[test].expected; | 121 var expected = results.tests[test].expected; |
| 114 var actual = results.tests[test].actual; | 122 var actual = results.tests[test].actual; |
| 115 runTest(results, function() { | 123 runTest(results, function() { |
| 116 if (isExpected) | 124 if (isExpected) |
| 117 assertTrue(document.querySelector('tbody').className == 'expected'); | 125 assertTrue(document.querySelector('tbody').className == 'expected'); |
| 118 else | 126 else |
| 119 assertTrue(document.querySelector('tbody').className.indexOf('expect
ed') == -1); | 127 assertTrue(document.querySelector('tbody').className.indexOf('expect
ed') == -1); |
| 120 | 128 |
| 121 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= '+' + test + ' \u2691'); | 129 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= '+' + test + ' \u2691'); |
| 122 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent =
= textResults); | 130 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent =
= textResults); |
| 123 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= imageResults); | 131 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= imageResults); |
| 124 assertTrue(document.querySelector('tbody td:nth-child(4)').textContent =
= actual); | 132 assertTrue(document.querySelector('tbody td:nth-child(4)').textContent =
= actual); |
| 125 assertTrue(document.querySelector('tbody td:nth-child(5)').textContent =
= expected); | 133 assertTrue(document.querySelector('tbody td:nth-child(5)').textContent =
= expected); |
| 126 }); | 134 }, opt_testName || 'single row test'); |
| 127 | 135 |
| 128 } | 136 } |
| 129 | 137 |
| 130 function runTests() | 138 function runTests() |
| 131 { | 139 { |
| 132 var results = mockResults(); | 140 var results = mockResults(); |
| 133 var subtree = results.tests['foo'] = {} | 141 var subtree = results.tests['foo'] = {} |
| 134 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); | 142 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); |
| 135 runTest(results, function() { | 143 runTest(results, function() { |
| 136 assertTrue(document.getElementById('image-results-header').textContent =
= ''); | 144 assertTrue(document.getElementById('image-results-header').textContent =
= ''); |
| 137 assertTrue(document.getElementById('text-results-header').textContent !=
''); | 145 assertTrue(document.getElementById('text-results-header').textContent !=
''); |
| 138 }); | 146 }, 'text results header'); |
| 139 | 147 |
| 140 results = mockResults(); | 148 results = mockResults(); |
| 141 var subtree = results.tests['foo'] = {} | 149 var subtree = results.tests['foo'] = {} |
| 142 subtree['bar.html'] = mockExpectation('TEXT', 'MISSING'); | 150 subtree['bar.html'] = mockExpectation('TEXT', 'MISSING'); |
| 143 subtree['bar.html'].is_missing_text = true; | 151 subtree['bar.html'].is_missing_text = true; |
| 144 subtree['bar.html'].is_missing_audio = true; | 152 subtree['bar.html'].is_missing_audio = true; |
| 145 subtree['bar.html'].is_missing_image = true; | 153 subtree['bar.html'].is_missing_image = true; |
| 146 runTest(results, function() { | 154 runTest(results, function() { |
| 147 assertTrue(!document.getElementById('results-table')); | 155 assertTrue(!document.getElementById('results-table')); |
| 148 assertTrue(document.querySelector('#missing-table .test-link').textConte
nt == 'foo/bar.html'); | 156 assertTrue(document.querySelector('#missing-table .test-link').textConte
nt == 'foo/bar.html'); |
| 149 assertTrue(document.getElementsByClassName('result-link')[0].textContent
== 'audio result'); | 157 assertTrue(document.getElementsByClassName('result-link')[0].textContent
== 'audio result'); |
| 150 assertTrue(document.getElementsByClassName('result-link')[1].textContent
== 'result'); | 158 assertTrue(document.getElementsByClassName('result-link')[1].textContent
== 'result'); |
| 151 assertTrue(document.getElementsByClassName('result-link')[2].textContent
== 'png result'); | 159 assertTrue(document.getElementsByClassName('result-link')[2].textContent
== 'png result'); |
| 152 }); | 160 }, 'actual result links'); |
| 153 | 161 |
| 154 results = mockResults(); | 162 results = mockResults(); |
| 155 var subtree = results.tests['foo'] = {} | 163 var subtree = results.tests['foo'] = {} |
| 156 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); | 164 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); |
| 157 subtree['bar.html'].has_stderr = true; | 165 subtree['bar.html'].has_stderr = true; |
| 158 runTest(results, function() { | 166 runTest(results, function() { |
| 159 assertTrue(document.getElementById('results-table')); | 167 assertTrue(document.getElementById('results-table')); |
| 160 assertTrue(document.querySelector('#stderr-table .result-link').textCont
ent == 'stderr'); | 168 assertTrue(document.querySelector('#stderr-table .result-link').textCont
ent == 'stderr'); |
| 161 }); | 169 }, 'stderr link'); |
| 162 | 170 |
| 163 results = mockResults(); | 171 results = mockResults(); |
| 164 var subtree = results.tests['foo'] = {} | 172 var subtree = results.tests['foo'] = {} |
| 165 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); | 173 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); |
| 166 subtree['bar1.html'] = mockExpectation('CRASH', 'PASS'); | 174 subtree['bar1.html'] = mockExpectation('CRASH', 'PASS'); |
| 167 subtree['bar2.html'] = mockExpectation('IMAGE', 'PASS'); | 175 subtree['bar2.html'] = mockExpectation('IMAGE', 'PASS'); |
| 168 subtree['crash.html'] = mockExpectation('IMAGE', 'CRASH'); | 176 subtree['crash.html'] = mockExpectation('IMAGE', 'CRASH'); |
| 169 subtree['timeout.html'] = mockExpectation('IMAGE', 'TIMEOUT'); | 177 subtree['timeout.html'] = mockExpectation('IMAGE', 'TIMEOUT'); |
| 170 runTest(results, function() { | 178 runTest(results, function() { |
| 171 assertTrue(!document.getElementById('results-table')); | 179 assertTrue(!document.getElementById('results-table')); |
| 172 | 180 |
| 173 var testLinks = document.querySelectorAll('#passes-table .test-link'); | 181 var testLinks = document.querySelectorAll('#passes-table .test-link'); |
| 174 assertTrue(testLinks[0].textContent == 'foo/bar.html'); | 182 assertTrue(testLinks[0].textContent == 'foo/bar.html'); |
| 175 assertTrue(testLinks[1].textContent == 'foo/bar1.html'); | 183 assertTrue(testLinks[1].textContent == 'foo/bar1.html'); |
| 176 assertTrue(testLinks[2].textContent == 'foo/bar2.html'); | 184 assertTrue(testLinks[2].textContent == 'foo/bar2.html'); |
| 177 | 185 |
| 178 assertTrue(!document.querySelector('#passes-table .expand-button')); | 186 assertTrue(!document.querySelector('#passes-table .expand-button')); |
| 179 | 187 |
| 180 var expectationTypes = document.querySelectorAll('#passes-table td:last-
of-type'); | 188 var expectationTypes = document.querySelectorAll('#passes-table td:last-
of-type'); |
| 181 assertTrue(expectationTypes[0].textContent == 'TEXT'); | 189 assertTrue(expectationTypes[0].textContent == 'TEXT'); |
| 182 assertTrue(expectationTypes[1].textContent == 'CRASH'); | 190 assertTrue(expectationTypes[1].textContent == 'CRASH'); |
| 183 assertTrue(expectationTypes[2].textContent == 'IMAGE'); | 191 assertTrue(expectationTypes[2].textContent == 'IMAGE'); |
| 184 | 192 |
| 185 assertTrue(document.getElementById('crash-tests-table')); | 193 assertTrue(document.getElementById('crash-tests-table')); |
| 186 assertTrue(document.getElementById('crash-tests-table').textContent.inde
xOf('crash log') != -1); | 194 assertTrue(document.getElementById('crash-tests-table').textContent.inde
xOf('crash log') != -1); |
| 187 assertTrue(document.getElementById('timeout-tests-table')); | 195 assertTrue(document.getElementById('timeout-tests-table')); |
| 188 assertTrue(document.getElementById('timeout-tests-table').textContent.in
dexOf('expected actual diff') != -1); | 196 assertTrue(document.getElementById('timeout-tests-table').textContent.in
dexOf('expected actual diff') != -1); |
| 189 }); | 197 }, 'crash and timeout tests tables'); |
| 190 | 198 |
| 191 function isExpanded(expandLink) | 199 function isExpanded(expandLink) |
| 192 { | 200 { |
| 193 var enDash = '\u2013'; | 201 var enDash = '\u2013'; |
| 194 return expandLink.textContent == enDash; | 202 return expandLink.textContent == enDash; |
| 195 } | 203 } |
| 196 | 204 |
| 197 function isCollapsed(expandLink) | 205 function isCollapsed(expandLink) |
| 198 { | 206 { |
| 199 return expandLink.textContent == '+'; | 207 return expandLink.textContent == '+'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 221 var expandLinks = document.querySelectorAll('.expand-button-text'); | 229 var expandLinks = document.querySelectorAll('.expand-button-text'); |
| 222 for (var i = 0; i < expandLinks.length; i++) | 230 for (var i = 0; i < expandLinks.length; i++) |
| 223 assertTrue(isCollapsed(expandLinks[i])); | 231 assertTrue(isCollapsed(expandLinks[i])); |
| 224 | 232 |
| 225 expandExpectations(expandLinks[1]); | 233 expandExpectations(expandLinks[1]); |
| 226 assertTrue(isCollapsed(expandLinks[0])); | 234 assertTrue(isCollapsed(expandLinks[0])); |
| 227 assertTrue(isExpanded(expandLinks[1])); | 235 assertTrue(isExpanded(expandLinks[1])); |
| 228 | 236 |
| 229 collapseExpectations(expandLinks[1]); | 237 collapseExpectations(expandLinks[1]); |
| 230 assertTrue(expandLinks[1].textContent == '+'); | 238 assertTrue(expandLinks[1].textContent == '+'); |
| 231 }); | 239 }, 'collapsing expectation rows'); |
| 232 | 240 |
| 233 results = mockResults(); | 241 results = mockResults(); |
| 234 var subtree = results.tests['foo'] = {} | 242 var subtree = results.tests['foo'] = {} |
| 235 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); | 243 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); |
| 236 subtree['bar-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); | 244 subtree['bar-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); |
| 237 runTest(results, function() { | 245 runTest(results, function() { |
| 238 assertTrue(document.querySelectorAll('.expected').length == 1); | 246 assertTrue(document.querySelectorAll('.expected').length == 1); |
| 239 assertTrue(document.querySelector('.expected .test-link').textContent ==
'foo/bar-expected-fail.html'); | 247 assertTrue(document.querySelector('.expected .test-link').textContent ==
'foo/bar-expected-fail.html'); |
| 240 | 248 |
| 241 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); | 249 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); |
| 242 | 250 |
| 243 expandAllExpectations(); | 251 expandAllExpectations(); |
| 244 assertTrue(visibleExpandLinks().length == 1); | 252 assertTrue(visibleExpandLinks().length == 1); |
| 245 assertTrue(document.querySelectorAll('.results-row').length == 1); | 253 assertTrue(document.querySelectorAll('.results-row').length == 1); |
| 246 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); | 254 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); |
| 247 | 255 |
| 248 document.getElementById('show-expected-failures').checked = true; | 256 document.getElementById('show-expected-failures').checked = true; |
| 249 document.getElementById('show-expected-failures').onchange(); | 257 document.getElementById('show-expected-failures').onchange(); |
| 250 | 258 |
| 251 assertTrue(visibleExpandLinks().length == 2); | 259 assertTrue(visibleExpandLinks().length == 2); |
| 252 assertTrue(document.querySelectorAll('.results-row').length == 1); | 260 assertTrue(document.querySelectorAll('.results-row').length == 1); |
| 253 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); | 261 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); |
| 254 | 262 |
| 255 expandAllExpectations(); | 263 expandAllExpectations(); |
| 256 assertTrue(document.querySelectorAll('.results-row').length == 2); | 264 assertTrue(document.querySelectorAll('.results-row').length == 2); |
| 257 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); | 265 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); |
| 258 }); | 266 }, 'expanding expectation rows'); |
| 259 | 267 |
| 260 results = mockResults(); | 268 results = mockResults(); |
| 261 results.tests['only-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); | 269 results.tests['only-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); |
| 262 runTest(results, function() { | 270 runTest(results, function() { |
| 263 assertTrue(window.getComputedStyle(document.getElementById('results-tabl
e').parentNode, null)['display'] == 'none'); | 271 assertTrue(window.getComputedStyle(document.getElementById('results-tabl
e').parentNode, null)['display'] == 'none'); |
| 264 }); | 272 }, 'only one expected fail result'); |
| 265 | 273 |
| 266 runDefaultSingleRowTest('bar-skip.html', 'TEXT', 'SKIP', true, '', ''); | 274 runDefaultSingleRowTest('bar-skip.html', 'TEXT', 'SKIP', true, '', ''); |
| 267 runDefaultSingleRowTest('bar-flaky-fail.html', 'PASS FAIL', 'TEXT', true, 'e
xpected actual diff pretty diff ', ''); | 275 runDefaultSingleRowTest('bar-flaky-fail.html', 'PASS FAIL', 'TEXT', true, 'e
xpected actual diff pretty diff ', ''); |
| 268 runDefaultSingleRowTest('bar-flaky-fail-unexpected.html', 'PASS TEXT', 'IMAG
E', false, '', 'images diff '); | 276 runDefaultSingleRowTest('bar-flaky-fail-unexpected.html', 'PASS TEXT', 'IMAG
E', false, '', 'images diff '); |
| 269 runDefaultSingleRowTest('bar-audio.html', 'TEXT', 'AUDIO', false, 'expected
audio actual audio ', ''); | 277 runDefaultSingleRowTest('bar-audio.html', 'TEXT', 'AUDIO', false, 'expected
audio actual audio ', ''); |
| 270 runDefaultSingleRowTest('bar-image.html', 'TEXT', 'IMAGE', false, '', 'image
s diff '); | 278 runDefaultSingleRowTest('bar-image.html', 'TEXT', 'IMAGE', false, '', 'image
s diff '); |
| 271 runDefaultSingleRowTest('bar-image-plus-text.html', 'TEXT', 'IMAGE+TEXT', fa
lse, 'expected actual diff pretty diff ', 'images diff '); | 279 runDefaultSingleRowTest('bar-image-plus-text.html', 'TEXT', 'IMAGE+TEXT', fa
lse, 'expected actual diff pretty diff ', 'images diff '); |
| 272 | 280 |
| 273 // Test the mapping for FAIL onto only ['IMAGE+TEXT', 'AUDIO', 'TEXT', 'IMAG
E']. | 281 // Test the mapping for FAIL onto only ['IMAGE+TEXT', 'AUDIO', 'TEXT', 'IMAG
E']. |
| 274 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE+TEXT', true, 'expec
ted actual diff pretty diff ', 'images diff '); | 282 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE+TEXT', true, 'expec
ted actual diff pretty diff ', 'images diff '); |
| 275 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'AUDIO', true, 'expected a
udio actual audio ', ''); | 283 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'AUDIO', true, 'expected a
udio actual audio ', ''); |
| 276 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'TEXT', true, 'expected ac
tual diff pretty diff ', ''); | 284 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'TEXT', true, 'expected ac
tual diff pretty diff ', ''); |
| 277 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE', false, '', 'image
s diff '); | 285 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE', false, '', 'image
s diff '); |
| 278 | 286 |
| 279 results = mockResults(); | 287 results = mockResults(); |
| 280 results.tests['bar-reftest.html'] = mockExpectation('PASS', 'IMAGE'); | 288 results.tests['bar-reftest.html'] = mockExpectation('PASS', 'IMAGE'); |
| 281 results.tests['bar-reftest.html'].reftest_type = ['==']; | 289 results.tests['bar-reftest.html'].reftest_type = ['==']; |
| 282 runSingleRowTest(results, false, '', 'ref html images diff '); | 290 runSingleRowTest(results, false, '', 'ref html images diff ', 'match reftest
single row test'); |
| 283 | 291 |
| 284 results = mockResults(); | 292 results = mockResults(); |
| 285 results.tests['bar-reftest-mismatch.html'] = mockExpectation('PASS', 'IMAGE'
); | 293 results.tests['bar-reftest-mismatch.html'] = mockExpectation('PASS', 'IMAGE'
); |
| 286 results.tests['bar-reftest-mismatch.html'].reftest_type = ['!=']; | 294 results.tests['bar-reftest-mismatch.html'].reftest_type = ['!=']; |
| 287 runSingleRowTest(results, false, '', 'ref mismatch html actual '); | 295 runSingleRowTest(results, false, '', 'ref mismatch html actual ', 'mismatch
reftest single row test'); |
| 288 | 296 |
| 289 results = mockResults(); | 297 results = mockResults(); |
| 290 results.tests['bar-reftest.html'] = mockExpectation('IMAGE', 'PASS'); | 298 results.tests['bar-reftest.html'] = mockExpectation('IMAGE', 'PASS'); |
| 291 results.tests['bar-reftest.html'].reftest_type = ['==']; | 299 results.tests['bar-reftest.html'].reftest_type = ['==']; |
| 292 results.pixel_tests_enabled = false; | 300 results.pixel_tests_enabled = false; |
| 293 runTest(results, function() { | 301 runTest(results, function() { |
| 294 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= 'bar-reftest.html \u2691'); | 302 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= 'bar-reftest.html \u2691'); |
| 295 }); | 303 }, 'match reftest'); |
| 296 | 304 |
| 297 results = mockResults(); | 305 results = mockResults(); |
| 298 results.tests['bar-reftest-mismatch.html'] = mockExpectation('IMAGE', 'PASS'
); | 306 results.tests['bar-reftest-mismatch.html'] = mockExpectation('IMAGE', 'PASS'
); |
| 299 results.tests['bar-reftest-mismatch.html'].reftest_type = ['!=']; | 307 results.tests['bar-reftest-mismatch.html'].reftest_type = ['!=']; |
| 300 results.pixel_tests_enabled = false; | 308 results.pixel_tests_enabled = false; |
| 301 runTest(results, function() { | 309 runTest(results, function() { |
| 302 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= 'bar-reftest-mismatch.html \u2691'); | 310 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= 'bar-reftest-mismatch.html \u2691'); |
| 303 }); | 311 }, 'mismatch reftest'); |
| 304 | 312 |
| 305 results = mockResults(); | 313 results = mockResults(); |
| 306 var subtree = results.tests['foo'] = {} | 314 var subtree = results.tests['foo'] = {} |
| 307 subtree['bar-flaky-pass.html'] = mockExpectation('PASS TEXT', 'PASS'); | 315 subtree['bar-flaky-pass.html'] = mockExpectation('PASS TEXT', 'PASS'); |
| 308 runTest(results, function() { | 316 runTest(results, function() { |
| 309 assertTrue(!document.getElementById('results-table')); | 317 assertTrue(!document.getElementById('results-table')); |
| 310 assertTrue(document.getElementById('passes-table')); | 318 assertTrue(document.getElementById('passes-table')); |
| 311 assertTrue(document.body.textContent.indexOf('foo/bar-flaky-pass.html')
!= -1); | 319 assertTrue(document.body.textContent.indexOf('foo/bar-flaky-pass.html')
!= -1); |
| 312 }); | 320 }, 'expected flaky and passed'); |
| 313 | 321 |
| 314 results = mockResults(); | 322 results = mockResults(); |
| 315 var subtree = results.tests['foo'] = {} | 323 var subtree = results.tests['foo'] = {} |
| 316 subtree['bar-flaky-fail.html'] = mockExpectation('PASS TEXT', 'IMAGE PASS'); | 324 subtree['bar-flaky-fail.html'] = mockExpectation('PASS TEXT', 'IMAGE PASS'); |
| 317 runTest(results, function() { | 325 runTest(results, function() { |
| 318 assertTrue(!document.getElementById('results-table')); | 326 assertTrue(!document.getElementById('results-table')); |
| 319 assertTrue(document.getElementById('flaky-tests-table')); | 327 assertTrue(document.getElementById('flaky-tests-table')); |
| 320 assertTrue(document.body.textContent.indexOf('bar-flaky-fail.html') != -
1); | 328 assertTrue(document.body.textContent.indexOf('bar-flaky-fail.html') != -
1); |
| 321 }); | 329 }, 'expected flaky and image mismatch'); |
| 322 | 330 |
| 323 results = mockResults(); | 331 results = mockResults(); |
| 324 var subtree = results.tests['foo'] = {} | 332 var subtree = results.tests['foo'] = {} |
| 325 subtree['bar-flaky-expected.html'] = mockExpectation('PASS FAIL', 'PASS TEXT
'); | 333 subtree['bar-flaky-expected.html'] = mockExpectation('PASS FAIL', 'PASS TEXT
'); |
| 326 runTest(results, function() { | 334 runTest(results, function() { |
| 327 assertTrue(!document.getElementById('results-table')); | 335 assertTrue(!document.getElementById('results-table')); |
| 328 assertTrue(document.getElementById('flaky-tests-table')); | 336 assertTrue(document.getElementById('flaky-tests-table')); |
| 329 assertTrue(document.body.textContent.indexOf('bar-flaky-expected.html')
!= -1); | 337 assertTrue(document.body.textContent.indexOf('bar-flaky-expected.html')
!= -1); |
| 330 assertTrue(document.querySelector('tbody').className == 'expected'); | 338 assertTrue(document.querySelector('tbody').className == 'expected'); |
| 331 }); | 339 }, 'expected flaky and text mismatch'); |
| 332 | 340 |
| 333 results = mockResults(); | 341 results = mockResults(); |
| 334 var subtree = results.tests['foo'] = {} | 342 var subtree = results.tests['foo'] = {} |
| 335 subtree['bar-really-long-path-that-should-probably-wrap-because-otherwise-th
e-table-will-be-too-wide.html'] = mockExpectation('PASS', 'TEXT'); | 343 subtree['bar-really-long-path-that-should-probably-wrap-because-otherwise-th
e-table-will-be-too-wide.html'] = mockExpectation('PASS', 'TEXT'); |
| 336 runTest(results, function() { | 344 runTest(results, function() { |
| 337 document.body.style.width = '800px'; | 345 document.body.style.width = '800px'; |
| 338 var links = document.querySelectorAll('tbody a'); | 346 var links = document.querySelectorAll('tbody a'); |
| 339 assertTrue(links[0].getClientRects().length == 2); | 347 assertTrue(links[0].getClientRects().length == 2); |
| 340 assertTrue(links[1].getClientRects().length == 1); | 348 assertTrue(links[1].getClientRects().length == 1); |
| 341 document.body.style.width = ''; | 349 document.body.style.width = ''; |
| 342 }); | 350 }, 'long test name'); |
| 343 | 351 |
| 344 results = mockResults(); | 352 results = mockResults(); |
| 345 var subtree = results.tests['foo'] = {} | 353 var subtree = results.tests['foo'] = {} |
| 346 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); | 354 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); |
| 347 runTest(results, function() { | 355 runTest(results, function() { |
| 348 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') != -1); | 356 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') != -1); |
| 349 }); | 357 }, 'pretty diff link'); |
| 350 | 358 |
| 351 results = mockResults(); | 359 results = mockResults(); |
| 352 var subtree = results.tests['foo'] = {} | 360 var subtree = results.tests['foo'] = {} |
| 353 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); | 361 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); |
| 354 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); | 362 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); |
| 355 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 363 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 356 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); | 364 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); |
| 357 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); | 365 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); |
| 358 runTest(results, function() { | 366 runTest(results, function() { |
| 359 // FIXME: This just ensures we don't get a JS error. | 367 // FIXME: This just ensures we don't get a JS error. |
| 360 // Verify that the sort is correct and that inline expanded expectations | 368 // Verify that the sort is correct and that inline expanded expectations |
| 361 // move along with the test they're attached to. | 369 // move along with the test they're attached to. |
| 362 TableSorter.sortColumn(0); | 370 TableSorter.sortColumn(0); |
| 363 TableSorter.sortColumn(0); | 371 TableSorter.sortColumn(0); |
| 364 TableSorter.sortColumn(1); | 372 TableSorter.sortColumn(1); |
| 365 TableSorter.sortColumn(1); | 373 TableSorter.sortColumn(1); |
| 366 TableSorter.sortColumn(2); | 374 TableSorter.sortColumn(2); |
| 367 TableSorter.sortColumn(2); | 375 TableSorter.sortColumn(2); |
| 368 TableSorter.sortColumn(3); | 376 TableSorter.sortColumn(3); |
| 369 TableSorter.sortColumn(3); | 377 TableSorter.sortColumn(3); |
| 370 TableSorter.sortColumn(4); | 378 TableSorter.sortColumn(4); |
| 371 TableSorter.sortColumn(4); | 379 TableSorter.sortColumn(4); |
| 372 TableSorter.sortColumn(0); | 380 TableSorter.sortColumn(0); |
| 373 logPass('PASS'); | 381 logPass('PASS'); |
| 374 }); | 382 }, 'TableSorter.sortColumn does not raise a JS error'); |
| 375 | 383 |
| 376 results = mockResults(); | 384 results = mockResults(); |
| 377 var subtree = results.tests['foo'] = {} | 385 var subtree = results.tests['foo'] = {} |
| 378 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 386 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 379 runTest(results, function() { | 387 runTest(results, function() { |
| 380 expandAllExpectations(); | 388 expandAllExpectations(); |
| 381 var png = document.querySelector('[src*="bar-5-expected.png"]'); | 389 var png = document.querySelector('[src*="bar-5-expected.png"]'); |
| 382 var x = png.offsetLeft + 1; | 390 var x = png.offsetLeft + 1; |
| 383 var y = png.offsetTop + 1; | 391 var y = png.offsetTop + 1; |
| 384 var mockEvent = { | 392 var mockEvent = { |
| 385 target: png, | 393 target: png, |
| 386 clientX: x, | 394 clientX: x, |
| 387 clientY: y | 395 clientY: y |
| 388 } | 396 } |
| 389 PixelZoomer.showOnDelay = false; | 397 PixelZoomer.showOnDelay = false; |
| 390 PixelZoomer.handleMouseMove(mockEvent); | 398 PixelZoomer.handleMouseMove(mockEvent); |
| 391 assertTrue(!!document.querySelector('.pixel-zoom-container')); | 399 assertTrue(!!document.querySelector('.pixel-zoom-container')); |
| 392 assertTrue(document.querySelectorAll('.zoom-image-container').length ==
3); | 400 assertTrue(document.querySelectorAll('.zoom-image-container').length ==
3); |
| 393 }); | 401 }, 'zoom image on hover'); |
| 394 | 402 |
| 395 results = mockResults(); | 403 results = mockResults(); |
| 396 var subtree = results.tests['fullscreen'] = {} | 404 var subtree = results.tests['fullscreen'] = {} |
| 397 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 405 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 398 runTest(results, function() { | 406 runTest(results, function() { |
| 399 // Use a regexp to match windows and unix-style paths. | 407 // Use a regexp to match windows and unix-style paths. |
| 400 var expectedRegExp = new RegExp('^file.*' + results.layout_tests_dir + '
/fullscreen/full-screen-api.html$'); | 408 var expectedRegExp = new RegExp('^file.*' + results.layout_tests_dir + '
/fullscreen/full-screen-api.html$'); |
| 401 assertTrue(expectedRegExp.exec(document.querySelector('tbody td:first-ch
ild a').href)); | 409 assertTrue(expectedRegExp.exec(document.querySelector('tbody td:first-ch
ild a').href)); |
| 402 }); | 410 }, 'local test link'); |
| 403 | 411 |
| 404 var oldShouldUseTracLinks = shouldUseTracLinks; | 412 var oldShouldUseTracLinks = shouldUseTracLinks; |
| 405 shouldUseTracLinks = function() { return true; }; | 413 shouldUseTracLinks = function() { return true; }; |
| 406 | 414 |
| 407 results = mockResults(); | 415 results = mockResults(); |
| 408 var subtree = results.tests['fullscreen'] = {} | 416 var subtree = results.tests['fullscreen'] = {} |
| 409 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 417 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 410 runTest(results, function() { | 418 runTest(results, function() { |
| 411 var expectedHref = 'https://crrev.com/' + results.chromium_revision + '/
third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; | 419 var expectedHref = 'https://crrev.com/' + results.chromium_revision + '/
third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; |
| 412 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); | 420 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); |
| 413 }); | 421 }, 'chromium revision link'); |
| 414 | 422 |
| 415 results = mockResults(); | 423 results = mockResults(); |
| 416 var subtree = results.tests['fullscreen'] = {} | 424 var subtree = results.tests['fullscreen'] = {} |
| 417 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 425 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 418 results.chromium_revision = ''; | 426 results.chromium_revision = ''; |
| 419 runTest(results, function() { | 427 runTest(results, function() { |
| 420 var expectedHref = 'https://chromium.googlesource.com/chromium/src/+/mas
ter/third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; | 428 var expectedHref = 'https://chromium.googlesource.com/chromium/src/+/mas
ter/third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; |
| 421 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); | 429 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); |
| 422 }); | 430 }, 'googlesource test link'); |
| 423 | 431 |
| 424 shouldUseTracLinks = oldShouldUseTracLinks; | 432 shouldUseTracLinks = oldShouldUseTracLinks; |
| 425 | 433 |
| 426 results = mockResults(); | 434 results = mockResults(); |
| 427 results.tests['bar.html'] = mockExpectation('PASS', 'IMAGE'); | 435 results.tests['bar.html'] = mockExpectation('PASS', 'IMAGE'); |
| 428 runTest(results, function() { | 436 runTest(results, function() { |
| 429 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'images diff '); | 437 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'images diff '); |
| 430 | 438 |
| 431 document.getElementById('toggle-images').checked = false; | 439 document.getElementById('toggle-images').checked = false; |
| 432 // FIXME: We shouldn't need to call updateTogglingImages. Setting checke
d above should call it. | 440 // FIXME: We shouldn't need to call updateTogglingImages. Setting checke
d above should call it. |
| 433 updateTogglingImages(); | 441 updateTogglingImages(); |
| 434 // FIXME: We get extra spaces in the DOM every time we enable/disable im
age toggling. | 442 // FIXME: We get extra spaces in the DOM every time we enable/disable im
age toggling. |
| 435 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); | 443 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); |
| 436 | 444 |
| 437 document.getElementById('toggle-images').checked = true; | 445 document.getElementById('toggle-images').checked = true; |
| 438 updateTogglingImages(); | 446 updateTogglingImages(); |
| 439 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= ' images diff '); | 447 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= ' images diff '); |
| 440 }); | 448 }, 'toggle images option'); |
| 441 | 449 |
| 442 results = mockResults(); | 450 results = mockResults(); |
| 443 results.tests['reading-options-from-localstorage.html'] = mockExpectation('I
MAGE+TEXT', 'IMAGE+TEXT'); | 451 results.tests['reading-options-from-localstorage.html'] = mockExpectation('I
MAGE+TEXT', 'IMAGE+TEXT'); |
| 444 runTest(results, function() { | 452 runTest(results, function() { |
| 445 assertTrue(window.getComputedStyle(document.querySelector('tbody'), null
)['display'] != 'none'); | 453 assertTrue(window.getComputedStyle(document.querySelector('tbody'), null
)['display'] != 'none'); |
| 446 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); | 454 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); |
| 447 }, '{"toggle-images":false,"show-expected-failures":true}'); | 455 }, 'reading options from localstorage', '{"toggle-images":false,"show-expect
ed-failures":true}'); |
| 448 | 456 |
| 449 function enclosingNodeWithTagNameHasClassName(node, tagName, className) { | 457 function enclosingNodeWithTagNameHasClassName(node, tagName, className) { |
| 450 while (node && (!node.tagName || node.localName != tagName)) | 458 while (node && (!node.tagName || node.localName != tagName)) |
| 451 node = node.parentNode; | 459 node = node.parentNode; |
| 452 if (!node) | 460 if (!node) |
| 453 return false; | 461 return false; |
| 454 return node.className == className; | 462 return node.className == className; |
| 455 } | 463 } |
| 456 | 464 |
| 457 results = mockResults(); | 465 results = mockResults(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 476 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[2], 'tbody',
'expected')); | 484 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[2], 'tbody',
'expected')); |
| 477 assertTrue(testLinks[3].innerText == 'foo/expected-to-pass-or-timeout-an
d-timeouted.html'); | 485 assertTrue(testLinks[3].innerText == 'foo/expected-to-pass-or-timeout-an
d-timeouted.html'); |
| 478 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[3], 'tbody', '
expected')); | 486 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[3], 'tbody', '
expected')); |
| 479 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[2], 'table',
'expected')); | 487 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[2], 'table',
'expected')); |
| 480 | 488 |
| 481 assertTrue(testLinks[4].innerText == 'foo/expected-fail-but-passed.html'
); | 489 assertTrue(testLinks[4].innerText == 'foo/expected-fail-but-passed.html'
); |
| 482 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[4], 'tbody',
'expected')); | 490 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[4], 'tbody',
'expected')); |
| 483 assertTrue(testLinks[5].innerText == 'foo/expected-pass-or-fail-and-pass
ed.html'); | 491 assertTrue(testLinks[5].innerText == 'foo/expected-pass-or-fail-and-pass
ed.html'); |
| 484 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[5], 'tbody', '
expected')); | 492 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[5], 'tbody', '
expected')); |
| 485 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[4], 'table',
'expected')); | 493 assertTrue(!enclosingNodeWithTagNameHasClassName(testLinks[4], 'table',
'expected')); |
| 486 }); | 494 }, 'class names 1'); |
| 487 | 495 |
| 488 results = mockResults(); | 496 results = mockResults(); |
| 489 var subtree = results.tests['foo'] = {} | 497 var subtree = results.tests['foo'] = {} |
| 490 subtree['expected-to-pass-or-crash-and-crashed.html'] = mockExpectation('PAS
S CRASH', 'CRASH'); | 498 subtree['expected-to-pass-or-crash-and-crashed.html'] = mockExpectation('PAS
S CRASH', 'CRASH'); |
| 491 subtree['expected-to-pass-or-timeout-and-timeouted.html'] = mockExpectation(
'PASS TIMEOUT', 'TIMEOUT'); | 499 subtree['expected-to-pass-or-timeout-and-timeouted.html'] = mockExpectation(
'PASS TIMEOUT', 'TIMEOUT'); |
| 492 subtree['expected-pass-or-fail-and-passed.html'] = mockExpectation('PASS FAI
L', 'PASS'); | 500 subtree['expected-pass-or-fail-and-passed.html'] = mockExpectation('PASS FAI
L', 'PASS'); |
| 493 runTest(results, function() { | 501 runTest(results, function() { |
| 494 assertTrue(!document.getElementById('results-table')); | 502 assertTrue(!document.getElementById('results-table')); |
| 495 | 503 |
| 496 var testLinks = document.querySelectorAll('.test-link'); | 504 var testLinks = document.querySelectorAll('.test-link'); |
| 497 assertTrue(testLinks[0].innerText == 'foo/expected-to-pass-or-crash-and-
crashed.html'); | 505 assertTrue(testLinks[0].innerText == 'foo/expected-to-pass-or-crash-and-
crashed.html'); |
| 498 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[0], 'tbody', '
expected')); | 506 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[0], 'tbody', '
expected')); |
| 499 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[0], 'div', 'ex
pected')); | 507 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[0], 'div', 'ex
pected')); |
| 500 | 508 |
| 501 assertTrue(testLinks[1].innerText == 'foo/expected-to-pass-or-timeout-an
d-timeouted.html'); | 509 assertTrue(testLinks[1].innerText == 'foo/expected-to-pass-or-timeout-an
d-timeouted.html'); |
| 502 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[1], 'tbody', '
expected')); | 510 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[1], 'tbody', '
expected')); |
| 503 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[1], 'div', 'ex
pected')); | 511 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[1], 'div', 'ex
pected')); |
| 504 | 512 |
| 505 assertTrue(testLinks[2].innerText == 'foo/expected-pass-or-fail-and-pass
ed.html'); | 513 assertTrue(testLinks[2].innerText == 'foo/expected-pass-or-fail-and-pass
ed.html'); |
| 506 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[2], 'tbody', '
expected')); | 514 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[2], 'tbody', '
expected')); |
| 507 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[2], 'div', 'ex
pected')); | 515 assertTrue(enclosingNodeWithTagNameHasClassName(testLinks[2], 'div', 'ex
pected')); |
| 508 }); | 516 }, 'class names 2'); |
| 509 | 517 |
| 510 results = mockResults(); | 518 results = mockResults(); |
| 511 var subtree = results.tests['foo'] = {} | 519 var subtree = results.tests['foo'] = {} |
| 512 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); | 520 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); |
| 513 subtree['crash.html'] = mockExpectation('IMAGE', 'CRASH'); | 521 subtree['crash.html'] = mockExpectation('IMAGE', 'CRASH'); |
| 514 subtree['flaky-fail.html'] = mockExpectation('PASS TEXT', 'IMAGE PASS'); | 522 subtree['flaky-fail.html'] = mockExpectation('PASS TEXT', 'IMAGE PASS'); |
| 515 runTest(results, function() { | 523 runTest(results, function() { |
| 516 assertTrue(!document.getElementById('results-table')); | 524 assertTrue(!document.getElementById('results-table')); |
| 517 | 525 |
| 518 var resultText = document.body.textContent; | 526 var resultText = document.body.textContent; |
| 519 assertTrue(resultText.indexOf('crash.html') != -1); | 527 assertTrue(resultText.indexOf('crash.html') != -1); |
| 520 assertTrue(resultText.indexOf('flaky-fail.html') != -1); | 528 assertTrue(resultText.indexOf('flaky-fail.html') != -1); |
| 521 assertTrue(resultText.indexOf('crash.html') < resultText.indexOf('flaky-
fail.html')); | 529 assertTrue(resultText.indexOf('crash.html') < resultText.indexOf('flaky-
fail.html')); |
| 522 }); | 530 }, 'crash and flaky fail test order'); |
| 523 | 531 |
| 524 results = mockResults(); | 532 results = mockResults(); |
| 525 var subtree = results.tests['foo'] = {} | 533 var subtree = results.tests['foo'] = {} |
| 526 subtree['expected-missing.html'] = mockExpectation('MISSING', 'MISSING'); | 534 subtree['expected-missing.html'] = mockExpectation('MISSING', 'MISSING'); |
| 527 subtree['expected-missing.html'].is_missing_text = true; | 535 subtree['expected-missing.html'].is_missing_text = true; |
| 528 subtree['expected-missing.html'].is_missing_image = true; | 536 subtree['expected-missing.html'].is_missing_image = true; |
| 529 subtree['unexpected-missing.html'] = mockExpectation('PASS', 'MISSING'); | 537 subtree['unexpected-missing.html'] = mockExpectation('PASS', 'MISSING'); |
| 530 subtree['unexpected-missing.html'].is_missing_text = true; | 538 subtree['unexpected-missing.html'].is_missing_text = true; |
| 531 runTest(results, function() { | 539 runTest(results, function() { |
| 532 assertTrue(!document.getElementById('results-table')); | 540 assertTrue(!document.getElementById('results-table')); |
| 533 assertTrue(visibleExpandLinks().length == 1); | 541 assertTrue(visibleExpandLinks().length == 1); |
| 534 assertTrue(document.querySelector('#missing-table tbody.expected .test-l
ink').textContent == 'foo/expected-missing.html'); | 542 assertTrue(document.querySelector('#missing-table tbody.expected .test-l
ink').textContent == 'foo/expected-missing.html'); |
| 535 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[0].textContent == 'result'); | 543 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[0].textContent == 'result'); |
| 536 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[1].textContent == 'png result'); | 544 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[1].textContent == 'png result'); |
| 537 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
test-link').textContent == 'foo/unexpected-missing.html'); | 545 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
test-link').textContent == 'foo/unexpected-missing.html'); |
| 538 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
result-link').textContent == 'result'); | 546 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
result-link').textContent == 'result'); |
| 539 | 547 |
| 540 document.getElementById('show-expected-failures').checked = true; | 548 document.getElementById('show-expected-failures').checked = true; |
| 541 document.getElementById('show-expected-failures').onchange(); | 549 document.getElementById('show-expected-failures').onchange(); |
| 542 expandAllExpectations(); | 550 expandAllExpectations(); |
| 543 assertTrue(visibleExpandLinks().length == 2); | 551 assertTrue(visibleExpandLinks().length == 2); |
| 544 }); | 552 }, 'missing results table'); |
| 545 | |
| 546 | 553 |
| 547 results = mockResults(); | 554 results = mockResults(); |
| 548 var subtree = results.tests['foo'] = {} | 555 var subtree = results.tests['foo'] = {} |
| 549 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); | 556 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); |
| 550 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); | 557 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); |
| 551 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); | 558 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); |
| 552 | 559 |
| 553 runTest(results, function() { | 560 runTest(results, function() { |
| 554 if (window.eventSender) { | 561 if (window.eventSender) { |
| 555 eventSender.keyDown('k'); // previous | 562 eventSender.keyDown('k'); // previous |
| 556 var testRows = document.querySelectorAll('#results-table tbody'); | 563 var testRows = document.querySelectorAll('#results-table tbody'); |
| 557 assertTrue(!testRows[0].classList.contains('current')); | 564 assertTrue(!testRows[0].classList.contains('current')); |
| 558 assertTrue(!testRows[1].classList.contains('current')); | 565 assertTrue(!testRows[1].classList.contains('current')); |
| 559 assertTrue(testRows[2].classList.contains('current')); | 566 assertTrue(testRows[2].classList.contains('current')); |
| 560 } | 567 } |
| 561 }); | 568 }, 'keyboard shortcuts: prev'); |
| 562 | 569 |
| 563 runTest(results, function() { | 570 runTest(results, function() { |
| 564 if (window.eventSender) { | 571 if (window.eventSender) { |
| 565 eventSender.keyDown('j'); // next | 572 eventSender.keyDown('j'); // next |
| 566 var testRows = document.querySelectorAll('#results-table tbody'); | 573 var testRows = document.querySelectorAll('#results-table tbody'); |
| 567 assertTrue(testRows[0].classList.contains('current')); | 574 assertTrue(testRows[0].classList.contains('current')); |
| 568 assertTrue(!testRows[1].classList.contains('current')); | 575 assertTrue(!testRows[1].classList.contains('current')); |
| 569 assertTrue(!testRows[2].classList.contains('current')); | 576 assertTrue(!testRows[2].classList.contains('current')); |
| 570 } | 577 } |
| 571 }); | 578 }, 'keyboard shortcuts: next'); |
| 572 | 579 |
| 573 results = mockResults(); | 580 results = mockResults(); |
| 574 var subtree = results.tests['foo'] = {} | 581 var subtree = results.tests['foo'] = {} |
| 575 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); | 582 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); |
| 576 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); | 583 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); |
| 577 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); | 584 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); |
| 578 subtree['bar3.html'] = mockExpectation('TEXT', 'PASS'); | 585 subtree['bar3.html'] = mockExpectation('TEXT', 'PASS'); |
| 579 subtree['bar4.html'] = mockExpectation('IMAGE', 'PASS'); | 586 subtree['bar4.html'] = mockExpectation('IMAGE', 'PASS'); |
| 580 | 587 |
| 581 runTest(results, function() { | 588 runTest(results, function() { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 TestNavigator.updateFlaggedTestTextBox(); | 680 TestNavigator.updateFlaggedTestTextBox(); |
| 674 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html foo/bar1.h
tml'); | 681 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html foo/bar1.h
tml'); |
| 675 | 682 |
| 676 eventSender.keyDown('f'); // unflag | 683 eventSender.keyDown('f'); // unflag |
| 677 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html'); | 684 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html'); |
| 678 | 685 |
| 679 eventSender.keyDown('k'); // previous | 686 eventSender.keyDown('k'); // previous |
| 680 eventSender.keyDown('f'); // flag | 687 eventSender.keyDown('f'); // flag |
| 681 assertTrue(flaggedTestsTextbox.innerText == ''); | 688 assertTrue(flaggedTestsTextbox.innerText == ''); |
| 682 } | 689 } |
| 683 }); | 690 }, 'keyboard shortcuts'); |
| 684 | 691 |
| 685 results = mockResults(); | 692 results = mockResults(); |
| 686 var subtree = results.tests['foo'] = {} | 693 var subtree = results.tests['foo'] = {} |
| 687 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); | 694 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); |
| 688 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); | 695 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); |
| 689 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); | 696 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); |
| 690 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); | 697 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); |
| 691 subtree['bar-4.html'] = mockExpectation('TEXT', 'TEXT'); | 698 subtree['bar-4.html'] = mockExpectation('TEXT', 'TEXT'); |
| 692 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 699 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
| 693 subtree['bar-stderr-expected.html'] = mockExpectation('IMAGE', 'IMAGE'); | 700 subtree['bar-stderr-expected.html'] = mockExpectation('IMAGE', 'IMAGE'); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 707 | 714 |
| 708 document.getElementById('show-expected-failures').checked = true; | 715 document.getElementById('show-expected-failures').checked = true; |
| 709 document.getElementById('show-expected-failures').onchange(); | 716 document.getElementById('show-expected-failures').onchange(); |
| 710 | 717 |
| 711 assertTrue(titles[0].textContent == 'Tests that crashed (2): [flag all]
[unflag all]'); | 718 assertTrue(titles[0].textContent == 'Tests that crashed (2): [flag all]
[unflag all]'); |
| 712 assertTrue(titles[1].textContent == 'Tests that failed text/pixel/audio
diff (5): [flag all] [unflag all]'); | 719 assertTrue(titles[1].textContent == 'Tests that failed text/pixel/audio
diff (5): [flag all] [unflag all]'); |
| 713 assertTrue(titles[2].textContent == 'Tests that had no expected results
(probably new) (1): [flag all] [unflag all]'); | 720 assertTrue(titles[2].textContent == 'Tests that had no expected results
(probably new) (1): [flag all] [unflag all]'); |
| 714 assertTrue(titles[3].textContent == 'Tests that timed out (1): [flag all
] [unflag all]'); | 721 assertTrue(titles[3].textContent == 'Tests that timed out (1): [flag all
] [unflag all]'); |
| 715 assertTrue(titles[4].textContent == 'Tests that had stderr output (1): [
flag all] [unflag all]'); | 722 assertTrue(titles[4].textContent == 'Tests that had stderr output (1): [
flag all] [unflag all]'); |
| 716 assertTrue(titles[5].textContent == 'Tests expected to fail but passed (
1): [flag all] [unflag all]'); | 723 assertTrue(titles[5].textContent == 'Tests expected to fail but passed (
1): [flag all] [unflag all]'); |
| 717 }); | 724 }, 'table titles 1'); |
| 718 | 725 |
| 719 results = mockResults(); | 726 results = mockResults(); |
| 720 var subtree = results.tests['foo'] = {} | 727 var subtree = results.tests['foo'] = {} |
| 721 subtree['bar.html'] = mockExpectation('', 'PASS TEXT'); | 728 subtree['bar.html'] = mockExpectation('', 'PASS TEXT'); |
| 722 subtree['bar-1.html'] = mockExpectation('', 'TEXT IMAGE'); | 729 subtree['bar-1.html'] = mockExpectation('', 'TEXT IMAGE'); |
| 723 subtree['bar-2.html'] = mockExpectation('IMAGE TEXT', 'TEXT IMAGE'); | 730 subtree['bar-2.html'] = mockExpectation('IMAGE TEXT', 'TEXT IMAGE'); |
| 724 subtree['bar-3.html'] = mockExpectation('PASS TEXT', 'TEXT PASS'); | 731 subtree['bar-3.html'] = mockExpectation('PASS TEXT', 'TEXT PASS'); |
| 725 runTest(results, function() { | 732 runTest(results, function() { |
| 726 var titles = document.getElementsByTagName('h1'); | 733 var titles = document.getElementsByTagName('h1'); |
| 727 assertTrue(titles[0].textContent == 'Tests that failed text/pixel/audio
diff (1): [flag all] [unflag all]'); | 734 assertTrue(titles[0].textContent == 'Tests that failed text/pixel/audio
diff (1): [flag all] [unflag all]'); |
| 728 assertTrue(titles[1].textContent =='Flaky tests (failed the first run an
d passed on retry) (1): [flag all] [unflag all]'); | 735 assertTrue(titles[1].textContent == 'Flaky tests (failed the first run a
nd passed on retry) (1): [flag all] [unflag all]'); |
| 729 | 736 |
| 730 assertTrue(document.querySelectorAll('#results-table tbody').length == 2
); | 737 assertTrue(document.querySelectorAll('#results-table tbody').length == 2
); |
| 731 assertTrue(document.querySelectorAll('#flaky-tests-table tbody').length
== 2); | 738 assertTrue(document.querySelectorAll('#flaky-tests-table tbody').length
== 2); |
| 732 }); | 739 }, 'table titles 2'); |
| 733 | 740 |
| 734 results = mockResults(); | 741 results = mockResults(); |
| 735 var subtree = results.tests['foo'] = {} | 742 var subtree = results.tests['foo'] = {} |
| 736 subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE'); | 743 subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE'); |
| 737 subtree['bar1.html'] = mockExpectation('TEXT', 'TEXT'); | 744 subtree['bar1.html'] = mockExpectation('TEXT', 'TEXT'); |
| 738 subtree['bar2.html'] = mockExpectation('TEXT', 'TEXT'); | 745 subtree['bar2.html'] = mockExpectation('TEXT', 'TEXT'); |
| 739 runTest(results, function() { | 746 runTest(results, function() { |
| 740 flagAll(document.querySelector('.flag-all')); | 747 flagAll(document.querySelector('.flag-all')); |
| 741 var flaggedTestsTextbox = document.getElementById('flagged-tests'); | 748 var flaggedTestsTextbox = document.getElementById('flagged-tests'); |
| 742 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html'); | 749 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html'); |
| 743 | 750 |
| 744 document.getElementById('show-expected-failures').checked = true; | 751 document.getElementById('show-expected-failures').checked = true; |
| 745 document.getElementById('show-expected-failures').onchange(); | 752 document.getElementById('show-expected-failures').onchange(); |
| 746 | 753 |
| 747 flagAll(document.querySelector('.flag-all')); | 754 flagAll(document.querySelector('.flag-all')); |
| 748 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html\nfoo/bar1.html
\nfoo/bar2.html'); | 755 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html\nfoo/bar1.html
\nfoo/bar2.html'); |
| 749 | 756 |
| 750 unflag(document.querySelector('.flag')); | 757 unflag(document.querySelector('.flag')); |
| 751 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar1.html\nfoo/bar2.htm
l'); | 758 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar1.html\nfoo/bar2.htm
l'); |
| 752 }); | 759 }, 'flagging tests'); |
| 753 | 760 |
| 754 results = mockResults(); | 761 results = mockResults(); |
| 755 var subtree = results.tests['foo'] = {} | 762 var subtree = results.tests['foo'] = {} |
| 756 subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE'); | 763 subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE'); |
| 757 subtree['bar1.html'] = mockExpectation('TEXT', 'IMAGE'); | 764 subtree['bar1.html'] = mockExpectation('TEXT', 'IMAGE'); |
| 758 runTest(results, function() { | 765 runTest(results, function() { |
| 759 flagAll(document.querySelector('.flag-all')); | 766 flagAll(document.querySelector('.flag-all')); |
| 760 var flaggedTestsTextbox = document.getElementById('flagged-tests'); | 767 var flaggedTestsTextbox = document.getElementById('flagged-tests'); |
| 761 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html\nfoo/bar1.html
'); | 768 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html\nfoo/bar1.html
'); |
| 762 }, '{"use-newlines":true}'); | 769 }, 'flagged tests with newlines', '{"use-newlines":true}'); |
| 763 | 770 |
| 764 results = mockResults(); | 771 results = mockResults(); |
| 765 var subtree = results.tests['foo'] = {} | 772 var subtree = results.tests['foo'] = {} |
| 766 subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE'); | 773 subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE'); |
| 767 subtree['bar1.html'] = mockExpectation('TEXT', 'IMAGE'); | 774 subtree['bar1.html'] = mockExpectation('TEXT', 'IMAGE'); |
| 768 runTest(results, function() { | 775 runTest(results, function() { |
| 769 flagAll(document.querySelector('.flag-all')); | 776 flagAll(document.querySelector('.flag-all')); |
| 770 var flaggedTestsTextbox = document.getElementById('flagged-tests'); | 777 var flaggedTestsTextbox = document.getElementById('flagged-tests'); |
| 771 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html foo/bar1.html'
); | 778 assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html foo/bar1.html'
); |
| 772 }, '{"use-newlines":false}'); | 779 }, 'flagged tests with spaces', '{"use-newlines":false}'); |
| 773 | 780 |
| 774 results = mockResults(); | 781 results = mockResults(); |
| 775 results.tests['foo/bar-image.html'] = mockExpectation('PASS', 'TEXT IMAGE+TE
XT'); | 782 results.tests['foo/bar-image.html'] = mockExpectation('PASS', 'TEXT IMAGE+TE
XT'); |
| 776 results.pixel_tests_enabled = false; | 783 results.pixel_tests_enabled = false; |
| 777 runTest(results, function() { | 784 runTest(results, function() { |
| 778 assertTrue(document.querySelector('tbody td:nth-child(3) a').getAttribut
e('href') == 'retries/foo/bar-image-diffs.html'); | 785 assertTrue(document.querySelector('tbody td:nth-child(3) a').getAttribut
e('href') == 'retries/foo/bar-image-diffs.html'); |
| 779 }); | 786 }, 'image diff links with IMAGE+TEXT result'); |
| 780 | 787 |
| 781 results = mockResults(); | 788 results = mockResults(); |
| 782 results.tests['foo/bar-image.html'] = mockExpectation('PASS', 'TEXT IMAGE'); | 789 results.tests['foo/bar-image.html'] = mockExpectation('PASS', 'TEXT IMAGE'); |
| 783 results.pixel_tests_enabled = false; | 790 results.pixel_tests_enabled = false; |
| 784 runTest(results, function() { | 791 runTest(results, function() { |
| 785 assertTrue(!document.getElementById('results-table')); | 792 assertTrue(!document.getElementById('results-table')); |
| 786 assertTrue(document.querySelector('#flaky-tests-table td:nth-child(3) a'
).getAttribute('href') == 'retries/foo/bar-image-diffs.html'); | 793 assertTrue(document.querySelector('#flaky-tests-table td:nth-child(3) a'
).getAttribute('href') == 'retries/foo/bar-image-diffs.html'); |
| 787 }); | 794 }, 'image diff links flaky TEXT IMAGE result'); |
| 788 | 795 |
| 789 results = mockResults(); | 796 results = mockResults(); |
| 790 results.tests['foo'] = mockExpectation('PASS', 'TEXT'); | 797 results.tests['foo'] = mockExpectation('PASS', 'TEXT'); |
| 791 results.tests['foo'].has_repaint_overlay = true; | 798 results.tests['foo'].has_repaint_overlay = true; |
| 792 runTest(results, function() { | 799 runTest(results, function() { |
| 793 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('overlay') != -1); | 800 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('overlay') != -1); |
| 794 }) | 801 }, 'repaint overlay') |
| 795 | 802 |
| 796 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; | 803 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; |
| 797 } | 804 } |
| 798 | 805 |
| 799 var originalGeneratePage = generatePage; | 806 var originalGeneratePage = generatePage; |
| 800 generatePage = runTests; | 807 generatePage = runTests; |
| OLD | NEW |