3 <style type=
"text/css">
10 background-color: blue
;
11 transform: translateZ
(10px);
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>
16 <script type=
"application/x-javascript">
24 InspectorTest.enableLayerTreeAgent(gotLayerTree);
26 function gotLayerTree(layers)
28 var matchingLayers = layers.filter(function(layer) { return !!(layer.backendNodeId && layer.transform); });
29 InspectorTest.log(
"matchingLayers.length: " + matchingLayers.length);
30 var layerId = matchingLayers[
0].layerId;
32 InspectorTest.sendCommand(
"LayerTree.makeSnapshot", {
"layerId": layerId}, InspectorTest.wrapCallback(gotSnapshot));
35 function gotSnapshot(result)
37 snapshotId = result.snapshotId;
38 InspectorTest.sendCommand(
"LayerTree.profileSnapshot", {
"snapshotId": snapshotId,
"minRepeatCount":
4,
"minDuration":
0}, InspectorTest.wrapCallback(gotProfile));
40 function gotProfile(result)
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.timings[i].length);
46 for (var j =
0; j < result.timings[i].length; ++j)
47 InspectorTest.log(
"Profile timing [" + i +
"][" + j +
"] is a number: " + (result.timings[i][j]
>=
0));
49 InspectorTest.sendCommand(
"LayerTree.replaySnapshot", {
"snapshotId": snapshotId,
"fromStep":
2,
"toStep": result.timings[
0].length -
2}, InspectorTest.wrapCallback(replayedSnapshot));
51 function replayedSnapshot(result)
53 InspectorTest.log(
"LayerTree.replaySnapshot returned valid image: " + /^data:image\/png;base64,/.test(result.dataURL));
54 InspectorTest.log(
"DONE!");
55 InspectorTest.completeTest();
60 <body onload=
"runTest()">
61 <div class=
"composited">
62 Sanity test for DevTools Paint Profiler.