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 | 7 |
8 function runPaintInvalidationTest() | 8 function runPaintInvalidationTest() |
9 { | 9 { |
10 if (!window.testRunner || !window.internals) { | 10 if (!window.testRunner || !window.internals) { |
(...skipping 22 matching lines...) Expand all Loading... | |
33 element.removeChild(element.firstChild); | 33 element.removeChild(element.firstChild); |
34 } | 34 } |
35 | 35 |
36 function finishPaintInvalidationTest() | 36 function finishPaintInvalidationTest() |
37 { | 37 { |
38 if (!window.testRunner || !window.internals) | 38 if (!window.testRunner || !window.internals) |
39 return; | 39 return; |
40 | 40 |
41 testRunner.layoutAndPaintAsyncThen(function() | 41 testRunner.layoutAndPaintAsyncThen(function() |
42 { | 42 { |
43 document.body.offsetTop; | |
ojan
2015/09/19 03:15:57
Doesn't removing this make your tests flaky becaus
| |
44 var paintInvalidationObjects = JSON.stringify(internals.trackedPaintInva lidationObjects()); | 43 var paintInvalidationObjects = JSON.stringify(internals.trackedPaintInva lidationObjects()); |
45 var expectedPaintInvalidationObjects = JSON.stringify(window.expectedPai ntInvalidationObjects); | 44 var expectedPaintInvalidationObjects = JSON.stringify(window.expectedPai ntInvalidationObjects); |
46 internals.stopTrackingPaintInvalidationObjects(); | 45 internals.stopTrackingPaintInvalidationObjects(); |
47 | 46 |
48 if (paintInvalidationObjects != expectedPaintInvalidationObjects) { | 47 if (paintInvalidationObjects != expectedPaintInvalidationObjects) { |
49 var message = 'Paint invalidation objects mismatch.' | 48 testRunner.logToStderr('Paint invalidation objects mismatch.' |
50 + '\nExpected:\n' + expectedPaintInvalidationObjects.replace(/", "/g, '",\n "') | 49 + '\nExpected:\n' + expectedPaintInvalidationObjects.replace(/", "/g, '",\n "') |
51 + '\nActual:\n' + paintInvalidationObjects.replace(/","/g, '",\n "'); | 50 + '\nActual:\n' + paintInvalidationObjects.replace(/","/g, '",\n "')); |
52 testRunner.logToStderr(message); | 51 |
53 while (document.body.firstChild) | 52 if (document.rootElement && document.rootElement.nodeName == "svg") { |
54 document.body.removeChild(document.body.firstChild); | 53 var svgns = "http://www.w3.org/2000/svg" |
55 var pre = document.createElement('pre'); | 54 var rect = document.createElementNS(svgns, 'rect'); |
56 pre.appendChild(document.createTextNode('(To copy results as text, s ee stderr.)\n\n' + message)); | 55 rect.setAttribute('width', '45%'); |
57 document.body.appendChild(pre); | 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 } | |
58 } | 86 } |
87 | |
59 testRunner.notifyDone(); | 88 testRunner.notifyDone(); |
60 }); | 89 }); |
61 } | 90 } |
OLD | NEW |