| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <style> | 3 <style> |
| 4 .my-class { | 4 .my-class { |
| 5 min-width: 100px; | 5 min-width: 100px; |
| 6 background-color: red; | 6 background-color: red; |
| 7 } | 7 } |
| 8 </style> | 8 </style> |
| 9 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 9 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 10 <script type="text/javascript" src="../../http/tests/inspector-protocol/tracing-
test.js"></script> | 10 <script type="text/javascript" src="../../http/tests/inspector-protocol/tracing-
test.js"></script> |
| 11 <script> | 11 <script> |
| 12 | 12 |
| 13 function performActions(callback) | 13 function performActions(callback) |
| 14 { | 14 { |
| 15 var div = document.querySelector("#myDiv"); | 15 var div = document.querySelector("#myDiv"); |
| 16 div.classList.add("my-class"); | 16 div.classList.add("my-class"); |
| 17 div.offsetWidth; | 17 div.offsetWidth; |
| 18 callback(); | 18 callback(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function test() | 21 function test() |
| 22 { | 22 { |
| 23 InspectorTest.invokeAsyncWithTracing("performActions", finish); | 23 InspectorTest.invokeAsyncWithTracing("performActions", finish); |
| 24 | 24 |
| 25 function finish(devtoolsEvents) | 25 function finish(devtoolsEvents) |
| 26 { | 26 { |
| 27 var schedRecalc = InspectorTest.findEvent("ScheduleStyleRecalculation",
"I"); | 27 var schedRecalc = InspectorTest.findEvent("ScheduleStyleRecalculation",
"I"); |
| 28 var recalcBegin = InspectorTest.findEvent("RecalculateStyles", "B"); | 28 var recalcBegin = InspectorTest.findEvent("RecalculateStyles", "B"); |
| 29 var recalcEnd = InspectorTest.findEvent("RecalculateStyles", "E"); | 29 var recalcEnd = InspectorTest.findEvent("RecalculateStyles", "E"); |
| 30 InspectorTest.assertEquals(schedRecalc.args.data.frame, recalcBegin.args
.beginData.frame, "RecalculateStyles frame"); | 30 InspectorTest.log("RecalculateStyles frames match: " + (schedRecalc.args
.data.frame === recalcBegin.args.beginData.frame)); |
| 31 InspectorTest.assert(recalcEnd.args.elementCount > 0, "RecalculateStyles
elementCount"); | 31 InspectorTest.log("RecalculateStyles elementCount > 0: " + (recalcEnd.ar
gs.elementCount > 0)); |
| 32 | 32 |
| 33 var invalidate = InspectorTest.findEvent("InvalidateLayout", "I"); | 33 var invalidate = InspectorTest.findEvent("InvalidateLayout", "I"); |
| 34 var layoutBegin = InspectorTest.findEvent("Layout", "B"); | 34 var layoutBegin = InspectorTest.findEvent("Layout", "B"); |
| 35 var layoutEnd = InspectorTest.findEvent("Layout", "E"); | 35 var layoutEnd = InspectorTest.findEvent("Layout", "E"); |
| 36 | 36 |
| 37 InspectorTest.assertEquals(recalcBegin.args.beginData.frame, invalidate.
args.data.frame, "InvalidateLayout frame"); | 37 InspectorTest.log("InvalidateLayout frames match: " + (recalcBegin.args.
beginData.frame === invalidate.args.data.frame)); |
| 38 | 38 |
| 39 var beginData = layoutBegin.args.beginData; | 39 var beginData = layoutBegin.args.beginData; |
| 40 InspectorTest.assertEquals(invalidate.args.data.frame, beginData.frame,
"Layout frame"); | 40 InspectorTest.log("Layout frames match: " + (invalidate.args.data.frame
=== beginData.frame)); |
| 41 InspectorTest.assert(beginData.dirtyObjects > 0, "dirtyObjects"); | 41 InspectorTest.log("dirtyObjects > 0: " + (beginData.dirtyObjects > 0)); |
| 42 InspectorTest.assert(beginData.totalObjects > 0, "totalObjects"); | 42 InspectorTest.log("totalObjects > 0: " + (beginData.totalObjects > 0)); |
| 43 | 43 |
| 44 var endData = layoutEnd.args.endData; | 44 var endData = layoutEnd.args.endData; |
| 45 InspectorTest.assert(endData.rootNode > 0, "rootNode id"); | 45 InspectorTest.log("has rootNode id: " + (endData.rootNode > 0)); |
| 46 InspectorTest.assert(!!endData.root , "root quad"); | 46 InspectorTest.log("has root quad: " + !!endData.root); |
| 47 | 47 |
| 48 InspectorTest.log("SUCCESS: found all expected events."); | 48 InspectorTest.log("SUCCESS: found all expected events."); |
| 49 InspectorTest.completeTest(); | 49 InspectorTest.completeTest(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } | 52 } |
| 53 </script> | 53 </script> |
| 54 </head> | 54 </head> |
| 55 <body onLoad="runTest();"> | 55 <body onLoad="runTest();"> |
| 56 <div id="myDiv">DIV</div> | 56 <div id="myDiv">DIV</div> |
| 57 </body> | 57 </body> |
| 58 </html> | 58 </html> |
| OLD | NEW |