OLD | NEW |
1 // Asynchronous tests should manually call finishRepaintTest at the appropriate | 1 // Asynchronous tests should manually call finishRepaintTest at the appropriate |
2 // time. | 2 // time. |
3 window.testIsAsync = false; | 3 window.testIsAsync = false; |
4 window.outputRepaintRects = true; | 4 window.outputRepaintRects = true; |
5 | 5 |
6 function runRepaintTest() | 6 function runRepaintTest() |
7 { | 7 { |
8 if (!window.testRunner || !window.internals) { | 8 if (!window.testRunner || !window.internals) { |
9 setTimeout(repaintTest, 500); | 9 setTimeout(repaintTest, 500); |
10 return; | 10 return; |
(...skipping 30 matching lines...) Expand all Loading... |
41 function forceStyleRecalc() | 41 function forceStyleRecalc() |
42 { | 42 { |
43 if (document.body) | 43 if (document.body) |
44 document.body.offsetTop; | 44 document.body.offsetTop; |
45 else if (document.documentElement) | 45 else if (document.documentElement) |
46 document.documentElement.offsetTop; | 46 document.documentElement.offsetTop; |
47 } | 47 } |
48 | 48 |
49 function finishRepaintTest() | 49 function finishRepaintTest() |
50 { | 50 { |
| 51 if (!window.testRunner || !window.internals) |
| 52 return; |
| 53 |
51 // Force a style recalc. | 54 // Force a style recalc. |
52 forceStyleRecalc(); | 55 forceStyleRecalc(); |
53 | 56 |
54 var repaintRects = window.internals.layerTreeAsText(document, window.interna
ls.LAYER_TREE_INCLUDES_REPAINT_RECTS); | 57 var repaintRects = window.internals.layerTreeAsText(document, window.interna
ls.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
55 | 58 |
56 internals.stopTrackingRepaints(document); | 59 internals.stopTrackingRepaints(document); |
57 | 60 |
58 // Play nice with JS tests which may want to print out assert results. | 61 // Play nice with JS tests which may want to print out assert results. |
59 if (window.isJsTest) | 62 if (window.isJsTest) |
60 window.outputRepaintRects = false; | 63 window.outputRepaintRects = false; |
61 | 64 |
62 if (window.outputRepaintRects) | 65 if (window.outputRepaintRects) |
63 testRunner.setCustomTextOutput(repaintRects); | 66 testRunner.setCustomTextOutput(repaintRects); |
64 | 67 |
65 if (window.afterTest) | 68 if (window.afterTest) |
66 window.afterTest(); | 69 window.afterTest(); |
67 | 70 |
68 // Play nice with async JS tests which want to notifyDone themselves. | 71 // Play nice with async JS tests which want to notifyDone themselves. |
69 if (!window.jsTestIsAsync) | 72 if (!window.jsTestIsAsync) |
70 testRunner.notifyDone(); | 73 testRunner.notifyDone(); |
71 } | 74 } |
OLD | NEW |