OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/layers-test.js"></script> | |
5 <script src="../tracing-test.js"></script> | |
6 | |
7 <script> | |
8 function doActions(callback) | |
9 { | |
10 var div = document.createElement("div"); | |
11 div.id = "b4"; | |
12 document.getElementById("a").appendChild(div); | |
13 | |
14 // Make sure to force commit, otherwise some owner nodes will be missing. | |
15 var style = document.createElement("style"); | |
16 style.textContent = ".layer { transform: translateZ(10px); opacity: 0.8; }"; | |
17 document.head.appendChild(style); | |
18 | |
19 if (!window.testRunner) { | |
20 callback(); | |
21 return; | |
22 } | |
23 testRunner.displayAsyncThen(callback); | |
24 } | |
25 | |
26 function test() | |
27 { | |
28 InspectorTest.invokeWithTracing("doActions", onTracingComplete); | |
29 | |
30 var target = /** @type {!WebInspector.Target} */ (WebInspector.targetManager
.mainTarget()); | |
31 var layerTree = new WebInspector.TracingLayerTree(target); | |
32 | |
33 function onTracingComplete() | |
34 { | |
35 var events = InspectorTest.tracingTimelineModel().inspectedTargetEvents(
); | |
36 for (var i = events.length - 1; i >= 0; --i) { | |
37 if (events[i].phase === WebInspector.TracingModel.Phase.SnapshotObje
ct && events[i].name === "cc::LayerTreeHostImpl") { | |
38 var rootLayer = events[i].args["snapshot"]["active_tree"]["root_
layer"]; | |
39 dumpLayerTreeSnapshot(rootLayer); | |
40 return; | |
41 } | |
42 } | |
43 InspectorTest.addResult("FAIL: cc::LayerTreeHostImpl snapshot not found"
); | |
44 InspectorTest.completeTest(); | |
45 } | |
46 | |
47 function dumpLayerTreeSnapshot(rootLayer) | |
48 { | |
49 layerTree.setLayers(rootLayer, onLayersSet); | |
50 } | |
51 | |
52 function onLayersSet() | |
53 { | |
54 InspectorTest.layerTreeModel.setLayerTree(layerTree); | |
55 InspectorTest.dumpLayerTree(); | |
56 InspectorTest.completeTest(); | |
57 } | |
58 } | |
59 </script> | |
60 | |
61 <body onload="runTestAfterDisplay()"> | |
62 Tests that LayerTreeModel successfully imports layers from a trace. | |
63 </p> | |
64 <div id="a" style="width: 200px; height: 200px" class="layer"> | |
65 <div class="layer" id="b1" style="width: 150px; height: 100px"></div> | |
66 <div id="b2" class="layer" style="width: 140px; height: 110px"> | |
67 <div id="c" class="layer" style="width: 100px; height: 90px"></div> | |
68 </div> | |
69 <div id="b3" class="layer" style="width: 140px; height: 110px"></div> | |
70 </div> | |
71 </body> | |
72 </html> | |
OLD | NEW |