Index: third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-layout.js |
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-layout.js b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-layout.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ea28959602701a5d16573ab252367e50a88bfc7 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-layout.js |
@@ -0,0 +1,48 @@ |
+(async function() { |
+ let {page, session, Protocol} = await InspectorTest.startHTML(` |
+ <style> |
+ .my-class { |
+ min-width: 100px; |
+ background-color: red; |
+ } |
+ </style> |
+ <div id='myDiv'>DIV</div> |
+ `, ''); |
+ |
+ function performActions() { |
+ var div = document.querySelector('#myDiv'); |
+ div.classList.add('my-class'); |
+ div.offsetWidth; |
+ return Promise.resolve(); |
+ } |
+ |
+ (await InspectorTest.loadScript('../resources/tracing-test.js'))(session); |
+ await session.evaluate(performActions.toString()); |
+ InspectorTest.invokeAsyncWithTracing('performActions', finish); |
+ |
+ function finish(devtoolsEvents) { |
+ var schedRecalc = InspectorTest.findEvent('ScheduleStyleRecalculation', 'I'); |
+ var recalcBegin = InspectorTest.findEvent('UpdateLayoutTree', 'B'); |
+ var recalcEnd = InspectorTest.findEvent('UpdateLayoutTree', 'E'); |
+ InspectorTest.log('UpdateLayoutTree frames match: ' + (schedRecalc.args.data.frame === recalcBegin.args.beginData.frame)); |
+ InspectorTest.log('UpdateLayoutTree elementCount > 0: ' + (recalcEnd.args.elementCount > 0)); |
+ |
+ var invalidate = InspectorTest.findEvent('InvalidateLayout', 'I'); |
+ var layoutBegin = InspectorTest.findEvent('Layout', 'B'); |
+ var layoutEnd = InspectorTest.findEvent('Layout', 'E'); |
+ |
+ InspectorTest.log('InvalidateLayout frames match: ' + (recalcBegin.args.beginData.frame === invalidate.args.data.frame)); |
+ |
+ var beginData = layoutBegin.args.beginData; |
+ InspectorTest.log('Layout frames match: ' + (invalidate.args.data.frame === beginData.frame)); |
+ InspectorTest.log('dirtyObjects > 0: ' + (beginData.dirtyObjects > 0)); |
+ InspectorTest.log('totalObjects > 0: ' + (beginData.totalObjects > 0)); |
+ |
+ var endData = layoutEnd.args.endData; |
+ InspectorTest.log('has rootNode id: ' + (endData.rootNode > 0)); |
+ InspectorTest.log('has root quad: ' + !!endData.root); |
+ |
+ InspectorTest.log('SUCCESS: found all expected events.'); |
+ InspectorTest.completeTest(); |
+ } |
+})(); |