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