| OLD | NEW |
| 1 // Asynchronous tests should manually call finishPaintInvalidationTest at the ap
propriate time. | 1 // Asynchronous tests should manually call finishPaintInvalidationTest at the ap
propriate time. |
| 2 window.testIsAsync = false; | 2 window.testIsAsync = false; |
| 3 | 3 |
| 4 // All paint invalidation tests are asynchronous from test-runner's point of vie
w. | 4 // All paint invalidation tests are asynchronous from test-runner's point of vie
w. |
| 5 if (window.testRunner) | 5 if (window.testRunner) { |
| 6 testRunner.waitUntilDone(); | 6 testRunner.waitUntilDone(); |
| 7 if (document.location.hash == '#as-text') |
| 8 testRunner.dumpAsText(); |
| 9 } |
| 7 | 10 |
| 8 function runPaintInvalidationTest() | 11 function runPaintInvalidationTest() |
| 9 { | 12 { |
| 10 if (!window.testRunner || !window.internals) { | 13 if (!window.testRunner || !window.internals) { |
| 11 setTimeout(paintInvalidationTest, 500); | 14 setTimeout(paintInvalidationTest, 500); |
| 12 return; | 15 return; |
| 13 } | 16 } |
| 14 | 17 |
| 15 // TODO(enne): this is a workaround for multiple svg onload events. | 18 // TODO(enne): this is a workaround for multiple svg onload events. |
| 16 // See: http://crbug.com/372946 | 19 // See: http://crbug.com/372946 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 element.removeChild(element.firstChild); | 36 element.removeChild(element.firstChild); |
| 34 } | 37 } |
| 35 | 38 |
| 36 function finishPaintInvalidationTest() | 39 function finishPaintInvalidationTest() |
| 37 { | 40 { |
| 38 if (!window.testRunner || !window.internals) | 41 if (!window.testRunner || !window.internals) |
| 39 return; | 42 return; |
| 40 | 43 |
| 41 testRunner.layoutAndPaintAsyncThen(function() | 44 testRunner.layoutAndPaintAsyncThen(function() |
| 42 { | 45 { |
| 43 var paintInvalidationObjects = JSON.stringify(internals.trackedPaintInva
lidationObjects()); | 46 testRunner.setCustomTextOutput(JSON.stringify(internals.trackedPaintInva
lidationObjects()).replace(/","/g, '",\n "')); |
| 44 var expectedPaintInvalidationObjects = JSON.stringify(window.expectedPai
ntInvalidationObjects); | |
| 45 internals.stopTrackingPaintInvalidationObjects(); | |
| 46 | |
| 47 if (paintInvalidationObjects != expectedPaintInvalidationObjects) { | |
| 48 testRunner.logToStderr('Paint invalidation objects mismatch.' | |
| 49 + '\nExpected:\n' + expectedPaintInvalidationObjects.replace(/",
"/g, '",\n "') | |
| 50 + '\nActual:\n' + paintInvalidationObjects.replace(/","/g, '",\n
"')); | |
| 51 | |
| 52 if (document.rootElement && document.rootElement.nodeName == "svg")
{ | |
| 53 var svgns = "http://www.w3.org/2000/svg" | |
| 54 var rect = document.createElementNS(svgns, 'rect'); | |
| 55 rect.setAttribute('width', '45%'); | |
| 56 rect.setAttribute('height', '10%'); | |
| 57 rect.setAttribute('x', '55%'); | |
| 58 rect.setAttribute('fill', 'white'); | |
| 59 rect.setAttribute('stroke', 'black'); | |
| 60 rect.setAttribute('stroke-width', '1px'); | |
| 61 document.documentElement.appendChild(rect); | |
| 62 var text = document.createElementNS(svgns, 'text'); | |
| 63 text.setAttribute('x', '100%'); | |
| 64 text.setAttribute('y', '5%'); | |
| 65 text.setAttribute('text-anchor', 'end'); | |
| 66 text.textContent = "Paint invalidation objects mismatch. See std
err for details."; | |
| 67 document.documentElement.appendChild(text); | |
| 68 } else { | |
| 69 var div = document.createElement('div'); | |
| 70 div.style.zIndex = '2147483647'; | |
| 71 div.style.visibility = 'visible'; | |
| 72 div.style.position = 'fixed'; | |
| 73 div.style.top = '0'; | |
| 74 div.style.right = '0'; | |
| 75 div.style.width = '350px'; | |
| 76 div.style.height = '16px'; | |
| 77 div.style.color = 'black'; | |
| 78 div.style.fontSize = '12px'; | |
| 79 div.style.lineHeight = '14px'; | |
| 80 div.style.fontFamily = 'Arial'; | |
| 81 div.style.border = '1px solid black'; | |
| 82 div.style.background = 'white'; | |
| 83 div.appendChild(document.createTextNode('Paint invalidation obje
cts mismatch. See stderr for details.')); | |
| 84 document.body.appendChild(div); | |
| 85 } | |
| 86 } | |
| 87 | |
| 88 testRunner.notifyDone(); | 47 testRunner.notifyDone(); |
| 89 }); | 48 }); |
| 90 } | 49 } |
| OLD | NEW |