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_pretty_patch": false, | |
31 "has_wdiff": false, | 30 "has_wdiff": false, |
32 "chromium_revision": 12345, | 31 "chromium_revision": 12345, |
33 "pixel_tests_enabled": true | 32 "pixel_tests_enabled": true |
34 }; | 33 }; |
35 } | 34 } |
36 | 35 |
37 function isFailureExpected(expected, actual) | 36 function isFailureExpected(expected, actual) |
38 { | 37 { |
39 var isExpected = true; | 38 var isExpected = true; |
40 if (actual != 'SKIP') { | 39 if (actual != 'SKIP') { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 g_testIndex++; | 85 g_testIndex++; |
87 g_state = undefined; | 86 g_state = undefined; |
88 localStorage.setItem(OptionWriter._key, opt_localStorageValue || ''); | 87 localStorage.setItem(OptionWriter._key, opt_localStorageValue || ''); |
89 | 88 |
90 try { | 89 try { |
91 ADD_RESULTS(results); | 90 ADD_RESULTS(results); |
92 originalGeneratePage(); | 91 originalGeneratePage(); |
93 } catch (e) { | 92 } catch (e) { |
94 logFail("FAIL: uncaught exception " + e.toString()); | 93 logFail("FAIL: uncaught exception " + e.toString()); |
95 } | 94 } |
96 | 95 |
97 try { | 96 try { |
98 assertions(); | 97 assertions(); |
99 } catch (e) { | 98 } catch (e) { |
100 logFail("FAIL: uncaught exception executing assertions " + e.toString())
; | 99 logFail("FAIL: uncaught exception executing assertions " + e.toString())
; |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 function runDefaultSingleRowTest(test, expected, actual, isExpected, textResults
, imageResults) | 103 function runDefaultSingleRowTest(test, expected, actual, isExpected, textResults
, imageResults) |
105 { | 104 { |
106 results = mockResults(); | 105 results = mockResults(); |
(...skipping 12 matching lines...) Expand all Loading... |
119 assertTrue(document.querySelector('tbody').className == 'expected'); | 118 assertTrue(document.querySelector('tbody').className == 'expected'); |
120 else | 119 else |
121 assertTrue(document.querySelector('tbody').className.indexOf('expect
ed') == -1); | 120 assertTrue(document.querySelector('tbody').className.indexOf('expect
ed') == -1); |
122 | 121 |
123 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= '+' + test + ' \u2691'); | 122 assertTrue(document.querySelector('tbody td:nth-child(1)').textContent =
= '+' + test + ' \u2691'); |
124 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent =
= textResults); | 123 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent =
= textResults); |
125 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= imageResults); | 124 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= imageResults); |
126 assertTrue(document.querySelector('tbody td:nth-child(4)').textContent =
= actual); | 125 assertTrue(document.querySelector('tbody td:nth-child(4)').textContent =
= actual); |
127 assertTrue(document.querySelector('tbody td:nth-child(5)').textContent =
= expected); | 126 assertTrue(document.querySelector('tbody td:nth-child(5)').textContent =
= expected); |
128 }); | 127 }); |
129 | 128 |
130 } | 129 } |
131 | 130 |
132 function runTests() | 131 function runTests() |
133 { | 132 { |
134 var results = mockResults(); | 133 var results = mockResults(); |
135 var subtree = results.tests['foo'] = {} | 134 var subtree = results.tests['foo'] = {} |
136 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); | 135 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); |
137 runTest(results, function() { | 136 runTest(results, function() { |
138 assertTrue(document.getElementById('image-results-header').textContent =
= ''); | 137 assertTrue(document.getElementById('image-results-header').textContent =
= ''); |
139 assertTrue(document.getElementById('text-results-header').textContent !=
''); | 138 assertTrue(document.getElementById('text-results-header').textContent !=
''); |
(...skipping 29 matching lines...) Expand all Loading... |
169 subtree['bar2.html'] = mockExpectation('IMAGE', 'PASS'); | 168 subtree['bar2.html'] = mockExpectation('IMAGE', 'PASS'); |
170 subtree['crash.html'] = mockExpectation('IMAGE', 'CRASH'); | 169 subtree['crash.html'] = mockExpectation('IMAGE', 'CRASH'); |
171 subtree['timeout.html'] = mockExpectation('IMAGE', 'TIMEOUT'); | 170 subtree['timeout.html'] = mockExpectation('IMAGE', 'TIMEOUT'); |
172 runTest(results, function() { | 171 runTest(results, function() { |
173 assertTrue(!document.getElementById('results-table')); | 172 assertTrue(!document.getElementById('results-table')); |
174 | 173 |
175 var testLinks = document.querySelectorAll('#passes-table .test-link'); | 174 var testLinks = document.querySelectorAll('#passes-table .test-link'); |
176 assertTrue(testLinks[0].textContent == 'foo/bar.html'); | 175 assertTrue(testLinks[0].textContent == 'foo/bar.html'); |
177 assertTrue(testLinks[1].textContent == 'foo/bar1.html'); | 176 assertTrue(testLinks[1].textContent == 'foo/bar1.html'); |
178 assertTrue(testLinks[2].textContent == 'foo/bar2.html'); | 177 assertTrue(testLinks[2].textContent == 'foo/bar2.html'); |
179 | 178 |
180 assertTrue(!document.querySelector('#passes-table .expand-button')); | 179 assertTrue(!document.querySelector('#passes-table .expand-button')); |
181 | 180 |
182 var expectationTypes = document.querySelectorAll('#passes-table td:last-
of-type'); | 181 var expectationTypes = document.querySelectorAll('#passes-table td:last-
of-type'); |
183 assertTrue(expectationTypes[0].textContent == 'TEXT'); | 182 assertTrue(expectationTypes[0].textContent == 'TEXT'); |
184 assertTrue(expectationTypes[1].textContent == 'CRASH'); | 183 assertTrue(expectationTypes[1].textContent == 'CRASH'); |
185 assertTrue(expectationTypes[2].textContent == 'IMAGE'); | 184 assertTrue(expectationTypes[2].textContent == 'IMAGE'); |
186 | 185 |
187 assertTrue(document.getElementById('crash-tests-table')); | 186 assertTrue(document.getElementById('crash-tests-table')); |
188 assertTrue(document.getElementById('crash-tests-table').textContent.inde
xOf('crash log') != -1); | 187 assertTrue(document.getElementById('crash-tests-table').textContent.inde
xOf('crash log') != -1); |
189 assertTrue(document.getElementById('timeout-tests-table')); | 188 assertTrue(document.getElementById('timeout-tests-table')); |
190 assertTrue(document.getElementById('timeout-tests-table').textContent.in
dexOf('expected actual diff') != -1); | 189 assertTrue(document.getElementById('timeout-tests-table').textContent.in
dexOf('expected actual diff') != -1); |
191 }); | 190 }); |
192 | 191 |
193 function isExpanded(expandLink) | 192 function isExpanded(expandLink) |
194 { | 193 { |
195 var enDash = '\u2013'; | 194 var enDash = '\u2013'; |
196 return expandLink.textContent == enDash; | 195 return expandLink.textContent == enDash; |
(...skipping 12 matching lines...) Expand all Loading... |
209 subtree['bar-stderr.html'] = mockExpectation('PASS', 'TEXT'); | 208 subtree['bar-stderr.html'] = mockExpectation('PASS', 'TEXT'); |
210 subtree['bar-stderr.html'].has_stderr = true; | 209 subtree['bar-stderr.html'].has_stderr = true; |
211 subtree['bar-unexpected-pass.html'] = mockExpectation('TEXT', 'PASS'); | 210 subtree['bar-unexpected-pass.html'] = mockExpectation('TEXT', 'PASS'); |
212 runTest(results, function() { | 211 runTest(results, function() { |
213 assertTrue(document.querySelectorAll('tbody tr').length == 5); | 212 assertTrue(document.querySelectorAll('tbody tr').length == 5); |
214 expandAllExpectations(); | 213 expandAllExpectations(); |
215 assertTrue(document.querySelectorAll('tbody tr').length == 8); | 214 assertTrue(document.querySelectorAll('tbody tr').length == 8); |
216 var expandLinks = document.querySelectorAll('.expand-button-text'); | 215 var expandLinks = document.querySelectorAll('.expand-button-text'); |
217 for (var i = 0; i < expandLinks.length; i++) | 216 for (var i = 0; i < expandLinks.length; i++) |
218 assertTrue(isExpanded(expandLinks[i])); | 217 assertTrue(isExpanded(expandLinks[i])); |
219 | 218 |
220 collapseAllExpectations(); | 219 collapseAllExpectations(); |
221 // Collapsed expectations stay in the dom, but are display:none. | 220 // Collapsed expectations stay in the dom, but are display:none. |
222 assertTrue(document.querySelectorAll('tbody tr').length == 8); | 221 assertTrue(document.querySelectorAll('tbody tr').length == 8); |
223 var expandLinks = document.querySelectorAll('.expand-button-text'); | 222 var expandLinks = document.querySelectorAll('.expand-button-text'); |
224 for (var i = 0; i < expandLinks.length; i++) | 223 for (var i = 0; i < expandLinks.length; i++) |
225 assertTrue(isCollapsed(expandLinks[i])); | 224 assertTrue(isCollapsed(expandLinks[i])); |
226 | 225 |
227 expandExpectations(expandLinks[1]); | 226 expandExpectations(expandLinks[1]); |
228 assertTrue(isCollapsed(expandLinks[0])); | 227 assertTrue(isCollapsed(expandLinks[0])); |
229 assertTrue(isExpanded(expandLinks[1])); | 228 assertTrue(isExpanded(expandLinks[1])); |
230 | 229 |
231 collapseExpectations(expandLinks[1]); | 230 collapseExpectations(expandLinks[1]); |
232 assertTrue(expandLinks[1].textContent == '+'); | 231 assertTrue(expandLinks[1].textContent == '+'); |
233 }); | 232 }); |
234 | 233 |
235 results = mockResults(); | 234 results = mockResults(); |
236 var subtree = results.tests['foo'] = {} | 235 var subtree = results.tests['foo'] = {} |
237 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); | 236 subtree['bar.html'] = mockExpectation('PASS', 'TEXT'); |
238 subtree['bar-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); | 237 subtree['bar-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); |
239 runTest(results, function() { | 238 runTest(results, function() { |
240 assertTrue(document.querySelectorAll('.expected').length == 1); | 239 assertTrue(document.querySelectorAll('.expected').length == 1); |
241 assertTrue(document.querySelector('.expected .test-link').textContent ==
'foo/bar-expected-fail.html'); | 240 assertTrue(document.querySelector('.expected .test-link').textContent ==
'foo/bar-expected-fail.html'); |
242 | 241 |
243 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); | 242 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); |
244 | 243 |
245 expandAllExpectations(); | 244 expandAllExpectations(); |
246 assertTrue(visibleExpandLinks().length == 1); | 245 assertTrue(visibleExpandLinks().length == 1); |
247 assertTrue(document.querySelectorAll('.results-row').length == 1); | 246 assertTrue(document.querySelectorAll('.results-row').length == 1); |
248 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); | 247 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] == 'none'); |
249 | 248 |
250 document.getElementById('show-expected-failures').checked = true; | 249 document.getElementById('show-expected-failures').checked = true; |
251 document.getElementById('show-expected-failures').onchange(); | 250 document.getElementById('show-expected-failures').onchange(); |
252 | 251 |
253 assertTrue(visibleExpandLinks().length == 2); | 252 assertTrue(visibleExpandLinks().length == 2); |
254 assertTrue(document.querySelectorAll('.results-row').length == 1); | 253 assertTrue(document.querySelectorAll('.results-row').length == 1); |
255 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); | 254 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); |
256 | 255 |
257 expandAllExpectations(); | 256 expandAllExpectations(); |
258 assertTrue(document.querySelectorAll('.results-row').length == 2); | 257 assertTrue(document.querySelectorAll('.results-row').length == 2); |
259 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); | 258 assertTrue(window.getComputedStyle(document.querySelectorAll('tbody')[0]
, null)['display'] != 'none'); |
260 }); | 259 }); |
261 | 260 |
262 results = mockResults(); | 261 results = mockResults(); |
263 results.tests['only-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); | 262 results.tests['only-expected-fail.html'] = mockExpectation('TEXT', 'TEXT'); |
264 runTest(results, function() { | 263 runTest(results, function() { |
265 assertTrue(window.getComputedStyle(document.getElementById('results-tabl
e').parentNode, null)['display'] == 'none'); | 264 assertTrue(window.getComputedStyle(document.getElementById('results-tabl
e').parentNode, null)['display'] == 'none'); |
266 }); | 265 }); |
267 | 266 |
268 runDefaultSingleRowTest('bar-skip.html', 'TEXT', 'SKIP', true, '', ''); | 267 runDefaultSingleRowTest('bar-skip.html', 'TEXT', 'SKIP', true, '', ''); |
269 runDefaultSingleRowTest('bar-flaky-fail.html', 'PASS FAIL', 'TEXT', true, 'e
xpected actual diff ', ''); | 268 runDefaultSingleRowTest('bar-flaky-fail.html', 'PASS FAIL', 'TEXT', true, 'e
xpected actual diff pretty diff ', ''); |
270 runDefaultSingleRowTest('bar-flaky-fail-unexpected.html', 'PASS TEXT', 'IMAG
E', false, '', 'images diff '); | 269 runDefaultSingleRowTest('bar-flaky-fail-unexpected.html', 'PASS TEXT', 'IMAG
E', false, '', 'images diff '); |
271 runDefaultSingleRowTest('bar-audio.html', 'TEXT', 'AUDIO', false, 'expected
audio actual audio ', ''); | 270 runDefaultSingleRowTest('bar-audio.html', 'TEXT', 'AUDIO', false, 'expected
audio actual audio ', ''); |
272 runDefaultSingleRowTest('bar-image.html', 'TEXT', 'IMAGE', false, '', 'image
s diff '); | 271 runDefaultSingleRowTest('bar-image.html', 'TEXT', 'IMAGE', false, '', 'image
s diff '); |
273 runDefaultSingleRowTest('bar-image-plus-text.html', 'TEXT', 'IMAGE+TEXT', fa
lse, 'expected actual diff ', 'images diff '); | 272 runDefaultSingleRowTest('bar-image-plus-text.html', 'TEXT', 'IMAGE+TEXT', fa
lse, 'expected actual diff pretty diff ', 'images diff '); |
274 | 273 |
275 // test the mapping for FAIL onto only ['TEXT', 'IMAGE+TEXT', 'AUDIO'] | 274 // Test the mapping for FAIL onto only ['IMAGE+TEXT', 'AUDIO', 'TEXT', 'IMAG
E']. |
276 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE+TEXT', true, 'expec
ted actual diff ', 'images diff '); | 275 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE+TEXT', true, 'expec
ted actual diff pretty diff ', 'images diff '); |
277 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'AUDIO', true, 'expected a
udio actual audio ', ''); | 276 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'AUDIO', true, 'expected a
udio actual audio ', ''); |
278 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'TEXT', true, 'expected ac
tual diff ', ''); | 277 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'TEXT', true, 'expected ac
tual diff pretty diff ', ''); |
279 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE', false, '', 'image
s diff '); | 278 runDefaultSingleRowTest('bar-image.html', 'FAIL', 'IMAGE', false, '', 'image
s diff '); |
280 | 279 |
281 results = mockResults(); | 280 results = mockResults(); |
282 results.tests['bar-reftest.html'] = mockExpectation('PASS', 'IMAGE'); | 281 results.tests['bar-reftest.html'] = mockExpectation('PASS', 'IMAGE'); |
283 results.tests['bar-reftest.html'].reftest_type = ['==']; | 282 results.tests['bar-reftest.html'].reftest_type = ['==']; |
284 runSingleRowTest(results, false, '', 'ref html images diff '); | 283 runSingleRowTest(results, false, '', 'ref html images diff '); |
285 | 284 |
286 results = mockResults(); | 285 results = mockResults(); |
287 results.tests['bar-reftest-mismatch.html'] = mockExpectation('PASS', 'IMAGE'
); | 286 results.tests['bar-reftest-mismatch.html'] = mockExpectation('PASS', 'IMAGE'
); |
288 results.tests['bar-reftest-mismatch.html'].reftest_type = ['!=']; | 287 results.tests['bar-reftest-mismatch.html'].reftest_type = ['!=']; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 document.body.style.width = '800px'; | 338 document.body.style.width = '800px'; |
340 var links = document.querySelectorAll('tbody a'); | 339 var links = document.querySelectorAll('tbody a'); |
341 assertTrue(links[0].getClientRects().length == 2); | 340 assertTrue(links[0].getClientRects().length == 2); |
342 assertTrue(links[1].getClientRects().length == 1); | 341 assertTrue(links[1].getClientRects().length == 1); |
343 document.body.style.width = ''; | 342 document.body.style.width = ''; |
344 }); | 343 }); |
345 | 344 |
346 results = mockResults(); | 345 results = mockResults(); |
347 var subtree = results.tests['foo'] = {} | 346 var subtree = results.tests['foo'] = {} |
348 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); | 347 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); |
349 results.has_pretty_patch = true; | |
350 runTest(results, function() { | 348 runTest(results, function() { |
351 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') != -1); | 349 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') != -1); |
352 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('wdiff') == -1); | |
353 }); | 350 }); |
354 | 351 |
355 results = mockResults(); | 352 results = mockResults(); |
356 var subtree = results.tests['foo'] = {} | 353 var subtree = results.tests['foo'] = {} |
357 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); | 354 subtree['bar.html'] = mockExpectation('TEXT', 'TEXT'); |
358 results.has_wdiff = true; | 355 results.has_wdiff = true; |
359 runTest(results, function() { | 356 runTest(results, function() { |
360 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('wdiff') != -1); | 357 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('wdiff') != -1); |
361 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('pretty diff') == -1); | 358 |
362 }); | 359 }); |
363 | 360 |
364 results = mockResults(); | 361 results = mockResults(); |
365 var subtree = results.tests['foo'] = {} | 362 var subtree = results.tests['foo'] = {} |
366 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); | 363 subtree['bar.html'] = mockExpectation('TEXT', 'PASS'); |
367 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); | 364 subtree['bar-1.html'] = mockExpectation('TEXT', 'CRASH'); |
368 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 365 subtree['bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
369 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); | 366 subtree['bar-3.html'] = mockExpectation('PASS', 'TEXT'); |
370 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); | 367 subtree['bar-2.html'] = mockExpectation('PASS', 'IMAGE'); |
371 runTest(results, function() { | 368 runTest(results, function() { |
372 // FIXME: This just ensures we don't get a JS error. | 369 // FIXME: This just ensures we don't get a JS error. |
373 // Verify that the sort is correct and that inline expanded expectations | 370 // Verify that the sort is correct and that inline expanded expectations |
(...skipping 23 matching lines...) Expand all Loading... |
397 var mockEvent = { | 394 var mockEvent = { |
398 target: png, | 395 target: png, |
399 clientX: x, | 396 clientX: x, |
400 clientY: y | 397 clientY: y |
401 } | 398 } |
402 PixelZoomer.showOnDelay = false; | 399 PixelZoomer.showOnDelay = false; |
403 PixelZoomer.handleMouseMove(mockEvent); | 400 PixelZoomer.handleMouseMove(mockEvent); |
404 assertTrue(!!document.querySelector('.pixel-zoom-container')); | 401 assertTrue(!!document.querySelector('.pixel-zoom-container')); |
405 assertTrue(document.querySelectorAll('.zoom-image-container').length ==
3); | 402 assertTrue(document.querySelectorAll('.zoom-image-container').length ==
3); |
406 }); | 403 }); |
407 | 404 |
408 results = mockResults(); | 405 results = mockResults(); |
409 var subtree = results.tests['fullscreen'] = {} | 406 var subtree = results.tests['fullscreen'] = {} |
410 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 407 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
411 runTest(results, function() { | 408 runTest(results, function() { |
412 // Use a regexp to match windows and unix-style paths. | 409 // Use a regexp to match windows and unix-style paths. |
413 var expectedRegExp = new RegExp('^file.*' + results.layout_tests_dir + '
/fullscreen/full-screen-api.html$'); | 410 var expectedRegExp = new RegExp('^file.*' + results.layout_tests_dir + '
/fullscreen/full-screen-api.html$'); |
414 assertTrue(expectedRegExp.exec(document.querySelector('tbody td:first-ch
ild a').href)); | 411 assertTrue(expectedRegExp.exec(document.querySelector('tbody td:first-ch
ild a').href)); |
415 }); | 412 }); |
416 | 413 |
417 var oldShouldUseTracLinks = shouldUseTracLinks; | 414 var oldShouldUseTracLinks = shouldUseTracLinks; |
418 shouldUseTracLinks = function() { return true; }; | 415 shouldUseTracLinks = function() { return true; }; |
419 | 416 |
420 results = mockResults(); | 417 results = mockResults(); |
421 var subtree = results.tests['fullscreen'] = {} | 418 var subtree = results.tests['fullscreen'] = {} |
422 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 419 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
423 runTest(results, function() { | 420 runTest(results, function() { |
424 var expectedHref = 'https://crrev.com/' + results.chromium_revision + '/
third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; | 421 var expectedHref = 'https://crrev.com/' + results.chromium_revision + '/
third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; |
425 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); | 422 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); |
426 }); | 423 }); |
427 | 424 |
428 results = mockResults(); | 425 results = mockResults(); |
429 var subtree = results.tests['fullscreen'] = {} | 426 var subtree = results.tests['fullscreen'] = {} |
430 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); | 427 subtree['full-screen-api.html'] = mockExpectation('TEXT', 'IMAGE+TEXT'); |
431 results.chromium_revision = ''; | 428 results.chromium_revision = ''; |
432 runTest(results, function() { | 429 runTest(results, function() { |
433 var expectedHref = 'https://chromium.googlesource.com/chromium/src/+/mas
ter/third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; | 430 var expectedHref = 'https://chromium.googlesource.com/chromium/src/+/mas
ter/third_party/WebKit/LayoutTests/fullscreen/full-screen-api.html'; |
434 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); | 431 assertTrue(document.querySelector('tbody td:first-child a').href == expe
ctedHref); |
435 }); | 432 }); |
436 | 433 |
437 shouldUseTracLinks = oldShouldUseTracLinks; | 434 shouldUseTracLinks = oldShouldUseTracLinks; |
438 | 435 |
439 results = mockResults(); | 436 results = mockResults(); |
440 results.tests['bar.html'] = mockExpectation('PASS', 'IMAGE'); | 437 results.tests['bar.html'] = mockExpectation('PASS', 'IMAGE'); |
441 runTest(results, function() { | 438 runTest(results, function() { |
442 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'images diff '); | 439 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'images diff '); |
443 | 440 |
444 document.getElementById('toggle-images').checked = false; | 441 document.getElementById('toggle-images').checked = false; |
445 // FIXME: We shouldn't need to call updateTogglingImages. Setting checke
d above should call it. | 442 // FIXME: We shouldn't need to call updateTogglingImages. Setting checke
d above should call it. |
446 updateTogglingImages(); | 443 updateTogglingImages(); |
447 // FIXME: We get extra spaces in the DOM every time we enable/disable im
age toggling. | 444 // FIXME: We get extra spaces in the DOM every time we enable/disable im
age toggling. |
448 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); | 445 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); |
449 | 446 |
450 document.getElementById('toggle-images').checked = true; | 447 document.getElementById('toggle-images').checked = true; |
451 updateTogglingImages(); | 448 updateTogglingImages(); |
452 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= ' images diff '); | 449 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= ' images diff '); |
453 }); | 450 }); |
454 | 451 |
455 results = mockResults(); | 452 results = mockResults(); |
456 results.tests['reading-options-from-localstorage.html'] = mockExpectation('I
MAGE+TEXT', 'IMAGE+TEXT'); | 453 results.tests['reading-options-from-localstorage.html'] = mockExpectation('I
MAGE+TEXT', 'IMAGE+TEXT'); |
457 runTest(results, function() { | 454 runTest(results, function() { |
458 assertTrue(window.getComputedStyle(document.querySelector('tbody'), null
)['display'] != 'none'); | 455 assertTrue(window.getComputedStyle(document.querySelector('tbody'), null
)['display'] != 'none'); |
459 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); | 456 assertTrue(document.querySelector('tbody td:nth-child(3)').textContent =
= 'expected actual diff '); |
460 }, '{"toggle-images":false,"show-expected-failures":true}'); | 457 }, '{"toggle-images":false,"show-expected-failures":true}'); |
461 | 458 |
462 function enclosingNodeWithTagNameHasClassName(node, tagName, className) { | 459 function enclosingNodeWithTagNameHasClassName(node, tagName, className) { |
463 while (node && (!node.tagName || node.localName != tagName)) | 460 while (node && (!node.tagName || node.localName != tagName)) |
464 node = node.parentNode; | 461 node = node.parentNode; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[0].textContent == 'result'); | 545 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[0].textContent == 'result'); |
549 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[1].textContent == 'png result'); | 546 assertTrue(document.querySelector('#missing-table tbody.expected').getEl
ementsByClassName('result-link')[1].textContent == 'png result'); |
550 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
test-link').textContent == 'foo/unexpected-missing.html'); | 547 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
test-link').textContent == 'foo/unexpected-missing.html'); |
551 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
result-link').textContent == 'result'); | 548 assertTrue(document.querySelector('#missing-table tbody:not(.expected) .
result-link').textContent == 'result'); |
552 | 549 |
553 document.getElementById('show-expected-failures').checked = true; | 550 document.getElementById('show-expected-failures').checked = true; |
554 document.getElementById('show-expected-failures').onchange(); | 551 document.getElementById('show-expected-failures').onchange(); |
555 expandAllExpectations(); | 552 expandAllExpectations(); |
556 assertTrue(visibleExpandLinks().length == 2); | 553 assertTrue(visibleExpandLinks().length == 2); |
557 }); | 554 }); |
558 | 555 |
559 | 556 |
560 results = mockResults(); | 557 results = mockResults(); |
561 var subtree = results.tests['foo'] = {} | 558 var subtree = results.tests['foo'] = {} |
562 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); | 559 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); |
563 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); | 560 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); |
564 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); | 561 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); |
565 | 562 |
566 runTest(results, function() { | 563 runTest(results, function() { |
567 if (window.eventSender) { | 564 if (window.eventSender) { |
568 eventSender.keyDown('k'); // previous | 565 eventSender.keyDown('k'); // previous |
(...skipping 18 matching lines...) Expand all Loading... |
587 var subtree = results.tests['foo'] = {} | 584 var subtree = results.tests['foo'] = {} |
588 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); | 585 subtree['bar.html'] = mockExpectation('TEXT', 'FAIL'); |
589 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); | 586 subtree['bar1.html'] = mockExpectation('TEXT', 'FAIL'); |
590 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); | 587 subtree['bar2.html'] = mockExpectation('TEXT', 'FAIL'); |
591 subtree['bar3.html'] = mockExpectation('TEXT', 'PASS'); | 588 subtree['bar3.html'] = mockExpectation('TEXT', 'PASS'); |
592 subtree['bar4.html'] = mockExpectation('IMAGE', 'PASS'); | 589 subtree['bar4.html'] = mockExpectation('IMAGE', 'PASS'); |
593 | 590 |
594 runTest(results, function() { | 591 runTest(results, function() { |
595 assertTrue(document.getElementById('results-table')); | 592 assertTrue(document.getElementById('results-table')); |
596 assertTrue(visibleExpandLinks().length == 3); | 593 assertTrue(visibleExpandLinks().length == 3); |
597 | 594 |
598 if (window.eventSender) { | 595 if (window.eventSender) { |
599 eventSender.keyDown('i', ["metaKey"]); | 596 eventSender.keyDown('i', ["metaKey"]); |
600 eventSender.keyDown('i', ["shiftKey"]); | 597 eventSender.keyDown('i', ["shiftKey"]); |
601 eventSender.keyDown('i', ["ctrlKey"]); | 598 eventSender.keyDown('i', ["ctrlKey"]); |
602 var testRows = document.querySelectorAll('tbody'); | 599 var testRows = document.querySelectorAll('tbody'); |
603 assertTrue(!testRows[0].classList.contains('current')); | 600 assertTrue(!testRows[0].classList.contains('current')); |
604 assertTrue(!testRows[1].classList.contains('current')); | 601 assertTrue(!testRows[1].classList.contains('current')); |
605 assertTrue(!testRows[2].classList.contains('current')); | 602 assertTrue(!testRows[2].classList.contains('current')); |
606 | 603 |
607 eventSender.keyDown('i'); // first | 604 eventSender.keyDown('i'); // first |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 results.tests['foo'].has_repaint_overlay = true; | 801 results.tests['foo'].has_repaint_overlay = true; |
805 runTest(results, function() { | 802 runTest(results, function() { |
806 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('overlay') != -1); | 803 assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.i
ndexOf('overlay') != -1); |
807 }) | 804 }) |
808 | 805 |
809 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; | 806 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; |
810 } | 807 } |
811 | 808 |
812 var originalGeneratePage = generatePage; | 809 var originalGeneratePage = generatePage; |
813 generatePage = runTests; | 810 generatePage = runTests; |
OLD | NEW |