| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <style type="text/css"> | 3 <style type="text/css"> |
| 4 .composited { | 4 .composited { |
| 5 position: absolute; | 5 position: absolute; |
| 6 top: 25px; | 6 top: 25px; |
| 7 left: 25px; | 7 left: 25px; |
| 8 width: 50px; | 8 width: 50px; |
| 9 height: 50px; | 9 height: 50px; |
| 10 background-color: blue; | 10 background-color: blue; |
| 11 transform: translateZ(10px); | 11 transform: translateZ(10px); |
| 12 } | 12 } |
| 13 </style> | 13 </style> |
| 14 <script type="application/x-javascript" src="../../http/tests/inspector-protocol
/inspector-protocol-test.js"></script> | 14 <script type="application/x-javascript" src="../../http/tests/inspector-protocol
/inspector-protocol-test.js"></script> |
| 15 <script type="application/x-javascript" src="layer-protocol-test.js"></script> | 15 <script type="application/x-javascript" src="layer-protocol-test.js"></script> |
| 16 <script type="application/x-javascript"> | 16 <script type="application/x-javascript"> |
| 17 | 17 |
| 18 function test() | 18 function test() |
| 19 { | 19 { |
| 20 var documentNode; | 20 var documentNode; |
| 21 var initialLayers; | 21 var initialLayers; |
| 22 var modifiedLayers; | 22 var modifiedLayers; |
| 23 | 23 |
| 24 InspectorTest.enableLayerTreeAgent(gotLayerTree); | 24 InspectorTest.enableLayerTreeAgent(gotLayerTree); |
| 25 | 25 |
| 26 function gotLayerTree(layers) | 26 function gotLayerTree(layers) |
| 27 { | 27 { |
| 28 var matchingLayers = layers.filter(function(layer) { return !!(layer.bac
kendNodeId && layer.transform); }); | 28 var matchingLayers = layers.filter(function(layer) { return !!(layer.bac
kendNodeId && layer.transform); }); |
| 29 InspectorTest.assertEquals(1, matchingLayers.length); | 29 InspectorTest.log("matchingLayers.length: " + matchingLayers.length); |
| 30 var layerId = matchingLayers[0].layerId; | 30 var layerId = matchingLayers[0].layerId; |
| 31 | 31 |
| 32 InspectorTest.sendCommand("LayerTree.makeSnapshot", {"layerId": layerId}
, InspectorTest.wrapCallback(gotSnapshot)); | 32 InspectorTest.sendCommand("LayerTree.makeSnapshot", {"layerId": layerId}
, InspectorTest.wrapCallback(gotSnapshot)); |
| 33 } | 33 } |
| 34 var snapshotId; | 34 var snapshotId; |
| 35 function gotSnapshot(result) | 35 function gotSnapshot(result) |
| 36 { | 36 { |
| 37 snapshotId = result.snapshotId; | 37 snapshotId = result.snapshotId; |
| 38 InspectorTest.sendCommand("LayerTree.profileSnapshot", {"snapshotId": sn
apshotId, "minRepeatCount":4, "minDuration": 0}, InspectorTest.wrapCallback(gotP
rofile)); | 38 InspectorTest.sendCommand("LayerTree.profileSnapshot", {"snapshotId": sn
apshotId, "minRepeatCount":4, "minDuration": 0}, InspectorTest.wrapCallback(gotP
rofile)); |
| 39 } | 39 } |
| 40 function gotProfile(result) | 40 function gotProfile(result) |
| 41 { | 41 { |
| 42 var timings = result.timings; | 42 var timings = result.timings; |
| 43 InspectorTest.assertEquals(4, result.timings.length, "invalid profile ar
ray length"); | 43 InspectorTest.log("Profile array length: " + result.timings.length); |
| 44 for (var i = 0; i < result.timings.length; ++i) { | 44 for (var i = 0; i < result.timings.length; ++i) { |
| 45 InspectorTest.assertEquals(result.timings[0].length, result.timings[
i].length, "invalid profile subarray length"); | 45 InspectorTest.log("Profile subarray " + i + " length: " + result.tim
ings[i].length); |
| 46 for (var j = 0; j < result.timings[i].length; ++j) | 46 for (var j = 0; j < result.timings[i].length; ++j) |
| 47 InspectorTest.assert(result.timings[i][j] >= 0, "profile timing
is not a number"); | 47 InspectorTest.log("Profile timing [" + i + "][" + j + "] is a nu
mber: " + (result.timings[i][j] >= 0)); |
| 48 } | 48 } |
| 49 InspectorTest.sendCommand("LayerTree.replaySnapshot", {"snapshotId": sna
pshotId, "fromStep": 2, "toStep": result.timings[0].length - 2}, InspectorTest.w
rapCallback(replayedSnapshot)); | 49 InspectorTest.sendCommand("LayerTree.replaySnapshot", {"snapshotId": sna
pshotId, "fromStep": 2, "toStep": result.timings[0].length - 2}, InspectorTest.w
rapCallback(replayedSnapshot)); |
| 50 } | 50 } |
| 51 function replayedSnapshot(result) | 51 function replayedSnapshot(result) |
| 52 { | 52 { |
| 53 InspectorTest.assert(/^data:image\/png;base64,/, "invalid image returned
from LayerTree.replaySnapshot"); | 53 InspectorTest.log("LayerTree.replaySnapshot returned valid image: " + /^
data:image\/png;base64,/.test(result.dataURL)); |
| 54 InspectorTest.log("DONE!"); | 54 InspectorTest.log("DONE!"); |
| 55 InspectorTest.completeTest(); | 55 InspectorTest.completeTest(); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 </script> | 59 </script> |
| 60 <body onload="runTest()"> | 60 <body onload="runTest()"> |
| 61 <div class="composited"> | 61 <div class="composited"> |
| 62 Sanity test for DevTools Paint Profiler. | 62 Sanity test for DevTools Paint Profiler. |
| 63 </div> | 63 </div> |
| 64 </body> | 64 </body> |
| 65 </html> | 65 </html> |
| 66 | 66 |
| OLD | NEW |