Chromium Code Reviews| 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 window.outputLayerList = false; | 5 window.outputLayerList = false; |
| 6 | 6 |
| 7 // All repaint tests are asynchronous. | 7 // All repaint tests are asynchronous. |
| 8 if (window.testRunner) | 8 if (window.testRunner) |
| 9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
| 10 | 10 |
| 11 if (window.internals) { | 11 if (window.internals) { |
| 12 internals.settings.setUseDefaultImageInterpolationQuality(true); | 12 internals.settings.setUseDefaultImageInterpolationQuality(true); |
| 13 internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = true; | 13 internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = true; |
| 14 } | 14 } |
| 15 | 15 |
| 16 // Add string names of objects that should be invalidated here. If you use this feature, | 16 // Add string names of objects that should be invalidated here. If you use this feature, |
| 17 // you must also include testharness.js. | 17 // you must also include testharness.js. |
| 18 window.expectedObjectInvalidations = []; | 18 window.expectedObjectInvalidations = []; |
| 19 // Objects which must *not* be invalidated. | |
| 20 window.expectedObjectNonInvalidations = []; | |
| 19 | 21 |
| 20 function runRepaintTest() | 22 function runRepaintTest() |
| 21 { | 23 { |
| 22 if (!window.testRunner || !window.internals) { | 24 if (!window.testRunner || !window.internals) { |
| 23 setTimeout(repaintTest, 500); | 25 setTimeout(repaintTest, 500); |
| 24 return; | 26 return; |
| 25 } | 27 } |
| 26 | 28 |
| 27 if (window.enablePixelTesting) | 29 if (window.enablePixelTesting) |
| 28 testRunner.dumpAsTextWithPixelResults(); | 30 testRunner.dumpAsTextWithPixelResults(); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 57 var objectNameSet = new Set(); | 59 var objectNameSet = new Set(); |
| 58 if (layersWithInvalidations["objectPaintInvalidations"]) { | 60 if (layersWithInvalidations["objectPaintInvalidations"]) { |
| 59 layersWithInvalidations["objectPaintInvalidations"].forEach(function(obj ) { | 61 layersWithInvalidations["objectPaintInvalidations"].forEach(function(obj ) { |
| 60 objectNameSet.add(obj["object"]); | 62 objectNameSet.add(obj["object"]); |
| 61 }); | 63 }); |
| 62 } | 64 } |
| 63 | 65 |
| 64 window.expectedObjectInvalidations.forEach(function(objectName) { | 66 window.expectedObjectInvalidations.forEach(function(objectName) { |
| 65 assert_true(objectNameSet.has(objectName), "Expected object to be invali dated, but it was not: '" + objectName + "'"); | 67 assert_true(objectNameSet.has(objectName), "Expected object to be invali dated, but it was not: '" + objectName + "'"); |
| 66 }); | 68 }); |
| 69 | |
| 70 window.expectedObjectNonInvalidations.forEach(function(objectName) { | |
| 71 assert_false(objectNameSet.has(objectName), "Expected object to be inval idated, but it was not: '" + objectName + "'"); | |
|
fs
2016/10/07 07:55:33
Nit: Need to move the "not" in the description tex
chrishtr
2016/10/07 16:41:09
Done.
| |
| 72 }); | |
| 67 } | 73 } |
| 68 | 74 |
| 69 function finishRepaintTest() | 75 function finishRepaintTest() |
| 70 { | 76 { |
| 71 if (!window.testRunner || !window.internals) | 77 if (!window.testRunner || !window.internals) |
| 72 return; | 78 return; |
| 73 | 79 |
| 74 // Force a style recalc. | 80 // Force a style recalc. |
| 75 forceStyleRecalc(); | 81 forceStyleRecalc(); |
| 76 | 82 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 95 if (window.outputRepaintRects) | 101 if (window.outputRepaintRects) |
| 96 testRunner.setCustomTextOutput(layersWithInvalidationsText); | 102 testRunner.setCustomTextOutput(layersWithInvalidationsText); |
| 97 | 103 |
| 98 if (window.afterTest) | 104 if (window.afterTest) |
| 99 window.afterTest(); | 105 window.afterTest(); |
| 100 | 106 |
| 101 // Play nice with async JS tests which want to notifyDone themselves. | 107 // Play nice with async JS tests which want to notifyDone themselves. |
| 102 if (!window.jsTestIsAsync) | 108 if (!window.jsTestIsAsync) |
| 103 testRunner.notifyDone(); | 109 testRunner.notifyDone(); |
| 104 } | 110 } |
| OLD | NEW |